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
80 changes: 40 additions & 40 deletions MusicMind/MusicMind/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,49 +32,49 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
self.window?.rootViewController = welcomeViewController
}

// Setup spotify auth
spotifyAuth.sessionUserDefaultsKey = "MMSpotifySession" // Enable automatic saving of the session to defaults
spotifyAuth.clientID = "a87022d4244f46129aac192c58fb6389"
spotifyAuth.redirectURL = URL(string: "musicmind://returnAfterSpotify")
spotifyAuth.requestedScopes = [SPTAuthStreamingScope]

do {
try spotifyStreamingController.start(withClientId: spotifyAuth.clientID)

spotifyStreamingController.setTargetBitrate(SPTBitrate.normal, callback: { (error) in
if let error = error {
print(error.localizedDescription)
}
})

spotifyStreamingController.diskCache = SPTDiskCache(capacity: 5)
} catch {
print(error)
}
// // Setup spotify auth
// spotifyAuth.sessionUserDefaultsKey = "MMSpotifySession" // Enable automatic saving of the session to defaults
// spotifyAuth.clientID = "a87022d4244f46129aac192c58fb6389"
// spotifyAuth.redirectURL = URL(string: "musicmind://returnAfterSpotify")
// spotifyAuth.requestedScopes = [SPTAuthStreamingScope]
//
// do {
// try spotifyStreamingController.start(withClientId: spotifyAuth.clientID)
//
// spotifyStreamingController.setTargetBitrate(SPTBitrate.normal, callback: { (error) in
// if let error = error {
// print(error.localizedDescription)
// }
// })
//
// spotifyStreamingController.diskCache = SPTDiskCache(capacity: 5)
// } catch {
// print(error)
// }

return true
}

func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool {

// Check if this is coming from the Spotify login flow
if spotifyAuth.canHandle(url) {
spotifyAuth.handleAuthCallback(withTriggeredAuthURL: url, callback: {
(error, session) in

if let error = error {
print(error.localizedDescription)
} else if let session = session {
if session.isValid() {
spotifyAuth.session = session
}
}
})

return true
}

return false
}
// func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool {
//
// // Check if this is coming from the Spotify login flow
// if spotifyAuth.canHandle(url) {
// spotifyAuth.handleAuthCallback(withTriggeredAuthURL: url, callback: {
// (error, session) in
//
// if let error = error {
// print(error.localizedDescription)
// } else if let session = session {
// if session.isValid() {
// spotifyAuth.session = session
// }
// }
// })
//
// return true
// }
//
// return false
// }
}

Loading