Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion ios/Controllers/MediaLibraryManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ class MediaLibraryManager: NSObject {
struct Playlist: Codable {
var name: String
var songs: [Song]
var id: String

}

Expand All @@ -184,6 +185,7 @@ class MediaLibraryManager: NSObject {
let playlists = myPlaylistQuery.collections

for playlist in playlists! {
let playlistId = String(describing: playlist.value(forProperty: MPMediaItemPropertyPersistentID)!)
let songs = playlist.items
var songsInPlaylist: [Song] = []
for song in songs {
Expand All @@ -207,7 +209,7 @@ class MediaLibraryManager: NSObject {
// task.resume()
}
let playlistName = String(describing: playlist.value(forProperty: MPMediaPlaylistPropertyName)!)
allPlaylists.append(Playlist(name: playlistName, songs: songsInPlaylist))
allPlaylists.append(Playlist(name: playlistName, songs: songsInPlaylist, id: playlistId))
}

let jsonEncoder = JSONEncoder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Release"
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
Expand Down
16 changes: 8 additions & 8 deletions ios/HumClient/Images.xcassets/AppIcon.appiconset/Contents.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,49 +3,49 @@
{
"size" : "20x20",
"idiom" : "iphone",
"filename" : "hum-5.png",
"filename" : "Icon-40@2x-5.png",
"scale" : "2x"
},
{
"size" : "20x20",
"idiom" : "iphone",
"filename" : "hum-4.png",
"filename" : "Icon-40@2x-4.png",
"scale" : "3x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "hum-2.png",
"filename" : "Icon-40@2x-3.png",
"scale" : "2x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "hum-3.png",
"filename" : "Icon-40@2x-2.png",
"scale" : "3x"
},
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "hum-7.png",
"filename" : "Icon-40@2x.png",
"scale" : "2x"
},
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "hum-6.png",
"filename" : "Icon-40@2x-1.png",
"scale" : "3x"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "hum.png",
"filename" : "Icon-60@2x.png",
"scale" : "2x"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "hum-1.png",
"filename" : "Icon-60@3x.png",
"scale" : "3x"
},
{
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,22 @@
"orientation" : "portrait",
"scale" : "2x"
},
{
"orientation" : "portrait",
"idiom" : "ipad",
"filename" : "Default-Portrait~ipad_768x1024-1.png",
"extent" : "full-screen",
"minimum-system-version" : "7.0",
"scale" : "1x"
},
{
"orientation" : "landscape",
"idiom" : "ipad",
"filename" : "Default-Landscape~ipad_1024x768-1.png",
"extent" : "full-screen",
"minimum-system-version" : "7.0",
"scale" : "1x"
},
{
"orientation" : "portrait",
"idiom" : "ipad",
Expand All @@ -42,6 +58,14 @@
"minimum-system-version" : "7.0",
"scale" : "2x"
},
{
"orientation" : "landscape",
"idiom" : "ipad",
"filename" : "Default-Landscape@2x~ipad_2048x1536-1.png",
"extent" : "full-screen",
"minimum-system-version" : "7.0",
"scale" : "2x"
},
{
"orientation" : "portrait",
"idiom" : "iphone",
Expand Down Expand Up @@ -84,6 +108,13 @@
"extent" : "to-status-bar",
"scale" : "2x"
},
{
"orientation" : "portrait",
"idiom" : "ipad",
"filename" : "Default-Portrait@2x~ipad_1536x2048-1.png",
"extent" : "full-screen",
"scale" : "2x"
},
{
"orientation" : "landscape",
"idiom" : "ipad",
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions ios/HumClient/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>Hum</string>
<string>Humm</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
Expand Down Expand Up @@ -45,7 +45,7 @@
<key>NSAppleMusicUsageDescription</key>
<string>Give Hum Authorization</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string/>
<string></string>
<key>UIAppFonts</key>
<array>
<string>Entypo.ttf</string>
Expand Down
5 changes: 2 additions & 3 deletions js/components/home/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,8 @@ export default class Home extends Component {
colors={['#FF5A5F', '#FC642D', '#ebcbb9']}
style={styles.container}
>
<Text style={styles.subtitle}>Back to the basics</Text>
<Text style={styles.title}>HUM</Text>
<Text style={styles.subtitle}>of sharing music</Text>
<Text style={styles.title}>HUMM</Text>
<Text style={styles.subtitle}>Welcome to HUMM.</Text>
<View style={styles.buttonContainer}>
<View style={{ marginTop: 5, marginBottom: 5 }}>
<Button
Expand Down
2 changes: 1 addition & 1 deletion js/components/home/style.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default StyleSheet.create({
marginTop: 60
},
title: {
fontSize: 65,
fontSize: 70,
textAlign: 'center',
color: '#fff',
fontFamily: "PingFangTC-Light",
Expand Down
4 changes: 2 additions & 2 deletions js/components/playlists/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ export default class Playlists extends Component {
Database.getSharedPlaylists().on('value', this.pendingCallback);
}

goToPlaylist = playlist => {
this.props.navigation.navigate('SinglePlaylist', playlist);
goToPlaylist = (playlist, compare) => {
this.props.navigation.navigate('SinglePlaylist', {playlist: playlist, compare: compare});
};

goToSharedPlaylist = playlist => {
Expand Down
92 changes: 66 additions & 26 deletions js/components/playlists/myPlaylists.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,33 +24,39 @@ import {
} from 'native-base';
import styles from './styles';
import * as Database from '../../../utils/database';
import { AsyncStorage } from 'react-native';
import { AsyncStorage, RefreshControl } from 'react-native';

export default class MyPlaylists extends Component {
constructor(props) {
super(props);
this.state = {
playlists: [],
pendingPlaylists: [], //refered to as SharedPlaylists
compareForRefresh: [],
isLoading: true,
searchPlaylist: ''
searchPlaylist: '',
refreshing: false
};
}

userPlaylistCallback = async snapshot => {
let playlists = snapshot.val();
console.log(playlists)
let temp = [];
serviceIdArray = [];
for (let playlistId in playlists) {
if (playlists[playlistId] === 'original') {
const tempPlaylist = await Database.getPlaylistFromId(playlistId);
const playlist = Object.assign({}, tempPlaylist.val(), { playlistId });
let songArr = []
if(tempPlaylist.val().songs) songArr = Object.keys(tempPlaylist.val().songs)
serviceIdArray.push({serviceId: playlist.serviceId, id: playlistId, songs: songArr});
temp.push(playlist);
}
}
this.setState({ playlists: [] }, () => {
this.setState({ playlists: [], compareForRefresh: [] }, () => {
this.setState({
playlists: this.state.playlists.concat(temp),
compareForRefresh: this.state.compareForRefresh.concat(serviceIdArray),
isLoading: false
});
});
Expand All @@ -71,6 +77,33 @@ export default class MyPlaylists extends Component {
});
};

_onRefresh() {
this.setState({ refreshing: true }, () => {
Database.updateAppleMusic(this.state.compareForRefresh, this.appleUpdateDone);
});
}

appleUpdateDone = async playlistsIds => {
const idArr = playlistsIds
this.setState({ refreshing: false}, async () => {
for(playlistId of idArr){
const tempPlaylist = await Database.getPlaylistFromId(playlistId);
const playlist = Object.assign({}, tempPlaylist.val(), { playlistId });
let songArr = []
if(tempPlaylist.val().songs) songArr = Object.keys(tempPlaylist.val().songs)
let service = {serviceId: playlist.serviceId, id: playlistId, songs: songArr};
this.setState({playlists: this.state.playlists.map(oldPlaylist => {
if(oldPlaylist.playlistId === playlist.playlistId) return playlist;
else return oldPlaylist
}), compareForRefresh: this.state.compareForRefresh.map(oldPlaylist => {
console.log(oldPlaylist.id, service.id)
if(oldPlaylist.id === service.id) return service;
else return oldPlaylist
})})
}
});
}

async componentDidMount() {
Database.getUserPlaylists().on('value', this.userPlaylistCallback);
Database.getSharedPlaylists().on('value', this.pendingPlaylistCallback);
Expand All @@ -92,25 +125,32 @@ export default class MyPlaylists extends Component {
<Icon name="ios-musical-notes" />
</Item>
</Header>
<Content>
<Content
refreshControl={
<RefreshControl
refreshing={this.state.refreshing}
onRefresh={this._onRefresh.bind(this)}
/>
}
>
{this.props.pendingPlaylists.length
? <Card>
<CardItem
button
onPress={() => this.props.goToPending()}
header
>
<Badge style={{ backgroundColor: '#FC642D' }}>
<Text>
{this.props.pendingPlaylists.length}
</Text>
</Badge>
<Text style={styles.header}> Pending Playlists</Text>
<Right>
<Icon name="arrow-forward" style={styles.arrow} />
</Right>
</CardItem>
</Card>
<CardItem
button
onPress={() => this.props.goToPending()}
header
>
<Badge style={{ backgroundColor: '#FC642D' }}>
<Text>
{this.props.pendingPlaylists.length}
</Text>
</Badge>
<Text style={styles.header}> Pending Playlists</Text>
<Right>
<Icon name="arrow-forward" style={styles.arrow} />
</Right>
</CardItem>
</Card>
: null}
<Card>
<CardItem header>
Expand All @@ -121,10 +161,10 @@ export default class MyPlaylists extends Component {
{this.state.isLoading
? <Spinner color="#FC642D" />
: <View>
{!this.state.playlists.length
? <CardItem>
<Text style={styles.header}>
Connect a music streaming service to view playlists!
{!this.state.playlists.length
? <CardItem>
<Text style={styles.header}>
Connect a music streaming service to view playlists!
</Text>
</CardItem>
: <View>
Expand All @@ -140,7 +180,7 @@ export default class MyPlaylists extends Component {
button
key={index}
onPress={() =>
this.props.goToPlaylist(playlist)}
this.props.goToPlaylist(playlist, {serviceId: playlist.serviceId, id: playlist.playlistId, songs: Object.keys(playlist.songs)})}
>
<Body>
<Text style={styles.bodytxt}>
Expand Down
Loading