-
Notifications
You must be signed in to change notification settings - Fork 189
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 25971e2
Showing
141 changed files
with
18,265 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
2.5.1 |
382 changes: 382 additions & 0 deletions
382
DemoProjects/NowPlayingView/NowPlayingView.xcodeproj/project.pbxproj
Large diffs are not rendered by default.
Oops, something went wrong.
7 changes: 7 additions & 0 deletions
7
...ects/NowPlayingView/NowPlayingView.xcodeproj/project.xcworkspace/contents.xcworkspacedata
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
8 changes: 8 additions & 0 deletions
8
...ngView/NowPlayingView.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>IDEDidComputeMac32BitWarning</key> | ||
<true/> | ||
</dict> | ||
</plist> |
91 changes: 91 additions & 0 deletions
91
...w/NowPlayingView.xcodeproj/xcshareddata/xcschemes/Demo Projects - NowPlayingView.xcscheme
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<Scheme | ||
LastUpgradeVersion = "0940" | ||
version = "1.3"> | ||
<BuildAction | ||
parallelizeBuildables = "YES" | ||
buildImplicitDependencies = "YES"> | ||
<BuildActionEntries> | ||
<BuildActionEntry | ||
buildForTesting = "YES" | ||
buildForRunning = "YES" | ||
buildForProfiling = "YES" | ||
buildForArchiving = "YES" | ||
buildForAnalyzing = "YES"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "F4F973EB1CAD60320036411D" | ||
BuildableName = "NowPlayingView.app" | ||
BlueprintName = "NowPlayingView" | ||
ReferencedContainer = "container:NowPlayingView.xcodeproj"> | ||
</BuildableReference> | ||
</BuildActionEntry> | ||
</BuildActionEntries> | ||
</BuildAction> | ||
<TestAction | ||
buildConfiguration = "Debug" | ||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||
shouldUseLaunchSchemeArgsEnv = "YES"> | ||
<Testables> | ||
</Testables> | ||
<MacroExpansion> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "F4F973EB1CAD60320036411D" | ||
BuildableName = "NowPlayingView.app" | ||
BlueprintName = "NowPlayingView" | ||
ReferencedContainer = "container:NowPlayingView.xcodeproj"> | ||
</BuildableReference> | ||
</MacroExpansion> | ||
<AdditionalOptions> | ||
</AdditionalOptions> | ||
</TestAction> | ||
<LaunchAction | ||
buildConfiguration = "Debug" | ||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | ||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | ||
launchStyle = "0" | ||
useCustomWorkingDirectory = "NO" | ||
ignoresPersistentStateOnLaunch = "NO" | ||
debugDocumentVersioning = "YES" | ||
debugServiceExtension = "internal" | ||
allowLocationSimulation = "YES"> | ||
<BuildableProductRunnable | ||
runnableDebuggingMode = "0"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "F4F973EB1CAD60320036411D" | ||
BuildableName = "NowPlayingView.app" | ||
BlueprintName = "NowPlayingView" | ||
ReferencedContainer = "container:NowPlayingView.xcodeproj"> | ||
</BuildableReference> | ||
</BuildableProductRunnable> | ||
<AdditionalOptions> | ||
</AdditionalOptions> | ||
</LaunchAction> | ||
<ProfileAction | ||
buildConfiguration = "Release" | ||
shouldUseLaunchSchemeArgsEnv = "YES" | ||
savedToolIdentifier = "" | ||
useCustomWorkingDirectory = "NO" | ||
debugDocumentVersioning = "YES"> | ||
<BuildableProductRunnable | ||
runnableDebuggingMode = "0"> | ||
<BuildableReference | ||
BuildableIdentifier = "primary" | ||
BlueprintIdentifier = "F4F973EB1CAD60320036411D" | ||
BuildableName = "NowPlayingView.app" | ||
BlueprintName = "NowPlayingView" | ||
ReferencedContainer = "container:NowPlayingView.xcodeproj"> | ||
</BuildableReference> | ||
</BuildableProductRunnable> | ||
</ProfileAction> | ||
<AnalyzeAction | ||
buildConfiguration = "Debug"> | ||
</AnalyzeAction> | ||
<ArchiveAction | ||
buildConfiguration = "Release" | ||
revealArchiveInOrganizer = "YES"> | ||
</ArchiveAction> | ||
</Scheme> |
90 changes: 90 additions & 0 deletions
90
DemoProjects/NowPlayingView/NowPlayingView/AppDelegate.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
import UIKit | ||
|
||
@UIApplicationMain | ||
class AppDelegate: UIResponder, | ||
UIApplicationDelegate, SPTAppRemoteDelegate { | ||
|
||
fileprivate let redirectUri = URL(string:"comspotifytestsdk://")! | ||
fileprivate let clientIdentifier = "089d841ccc194c10a77afad9e1c11d54" | ||
fileprivate let name = "Now Playing View" | ||
|
||
// keys | ||
static fileprivate let kAccessTokenKey = "access-token-key" | ||
|
||
var accessToken = UserDefaults.standard.string(forKey: kAccessTokenKey) { | ||
didSet { | ||
let defaults = UserDefaults.standard | ||
defaults.set(accessToken, forKey: AppDelegate.kAccessTokenKey) | ||
defaults.synchronize() | ||
} | ||
} | ||
|
||
|
||
var playerViewController: ViewController { | ||
get { | ||
let navController = self.window?.rootViewController?.childViewControllers[0] as! UINavigationController | ||
return navController.topViewController as! ViewController | ||
} | ||
} | ||
|
||
var window: UIWindow? | ||
|
||
lazy var appRemote: SPTAppRemote = { | ||
let configuration = SPTConfiguration(clientID: self.clientIdentifier, redirectURL: self.redirectUri) | ||
let appRemote = SPTAppRemote(configuration: configuration, logLevel: .debug) | ||
appRemote.connectionParameters.accessToken = self.accessToken | ||
appRemote.delegate = self | ||
return appRemote | ||
}() | ||
|
||
class var sharedInstance: AppDelegate { | ||
get { | ||
return UIApplication.shared.delegate as! AppDelegate | ||
} | ||
} | ||
|
||
func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any]) -> Bool { | ||
let parameters = appRemote.authorizationParameters(from: url); | ||
|
||
if let access_token = parameters?[SPTAppRemoteAccessTokenKey] { | ||
appRemote.connectionParameters.accessToken = access_token | ||
self.accessToken = access_token | ||
} else if let error_description = parameters?[SPTAppRemoteErrorDescriptionKey] { | ||
playerViewController.showError(error_description); | ||
} | ||
|
||
return true | ||
} | ||
|
||
func applicationWillResignActive(_ application: UIApplication) { | ||
playerViewController.appRemoteDisconnect() | ||
appRemote.disconnect() | ||
} | ||
|
||
func applicationDidBecomeActive(_ application: UIApplication) { | ||
self.connect(); | ||
} | ||
|
||
func connect() { | ||
playerViewController.appRemoteConnecting() | ||
appRemote.connect() | ||
} | ||
|
||
// MARK: AppRemoteDelegate | ||
|
||
func appRemoteDidEstablishConnection(_ appRemote: SPTAppRemote) { | ||
self.appRemote = appRemote | ||
playerViewController.appRemoteConnected() | ||
} | ||
|
||
func appRemote(_ appRemote: SPTAppRemote, didFailConnectionAttemptWithError error: Error?) { | ||
print("didFailConnectionAttemptWithError") | ||
playerViewController.appRemoteDisconnect() | ||
} | ||
|
||
func appRemote(_ appRemote: SPTAppRemote, didDisconnectWithError error: Error?) { | ||
print("didDisconnectWithError") | ||
playerViewController.appRemoteDisconnect() | ||
} | ||
|
||
} |
48 changes: 48 additions & 0 deletions
48
DemoProjects/NowPlayingView/NowPlayingView/Assets.xcassets/AppIcon.appiconset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"idiom" : "iphone", | ||
"size" : "20x20", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"idiom" : "iphone", | ||
"size" : "20x20", | ||
"scale" : "3x" | ||
}, | ||
{ | ||
"idiom" : "iphone", | ||
"size" : "29x29", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"idiom" : "iphone", | ||
"size" : "29x29", | ||
"scale" : "3x" | ||
}, | ||
{ | ||
"idiom" : "iphone", | ||
"size" : "40x40", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"idiom" : "iphone", | ||
"size" : "40x40", | ||
"scale" : "3x" | ||
}, | ||
{ | ||
"idiom" : "iphone", | ||
"size" : "60x60", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"idiom" : "iphone", | ||
"size" : "60x60", | ||
"scale" : "3x" | ||
} | ||
], | ||
"info" : { | ||
"version" : 1, | ||
"author" : "xcode" | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
DemoProjects/NowPlayingView/NowPlayingView/Base.lproj/LaunchScreen.storyboard
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15E65" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM"> | ||
<dependencies> | ||
<deployment identifier="iOS"/> | ||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/> | ||
</dependencies> | ||
<scenes> | ||
<!--View Controller--> | ||
<scene sceneID="EHf-IW-A2E"> | ||
<objects> | ||
<viewController id="01J-lp-oVM" sceneMemberID="viewController"> | ||
<layoutGuides> | ||
<viewControllerLayoutGuide type="top" id="Llm-lL-Icb"/> | ||
<viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok"/> | ||
</layoutGuides> | ||
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3"> | ||
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/> | ||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> | ||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/> | ||
</view> | ||
</viewController> | ||
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/> | ||
</objects> | ||
<point key="canvasLocation" x="53" y="375"/> | ||
</scene> | ||
</scenes> | ||
</document> |
Oops, something went wrong.