Skip to content

Commit 0316973

Browse files
committed
Version 1.0.0
0 parents  commit 0316973

File tree

88 files changed

+12650
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+12650
-0
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Changelog
2+
3+
## Initial Beta Release 1.0.0 (2018-03-07)
4+
5+
** What's New **
6+
7+
Initial beta release

DemoProjects/NowPlayingView/NowPlayingView.xcodeproj/project.pbxproj

Lines changed: 376 additions & 0 deletions
Large diffs are not rendered by default.

DemoProjects/NowPlayingView/NowPlayingView.xcodeproj/project.xcworkspace/contents.xcworkspacedata

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "0920"
4+
version = "1.3">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES">
8+
<BuildActionEntries>
9+
<BuildActionEntry
10+
buildForTesting = "YES"
11+
buildForRunning = "YES"
12+
buildForProfiling = "YES"
13+
buildForArchiving = "YES"
14+
buildForAnalyzing = "YES">
15+
<BuildableReference
16+
BuildableIdentifier = "primary"
17+
BlueprintIdentifier = "F4F973EB1CAD60320036411D"
18+
BuildableName = "NowPlayingView.app"
19+
BlueprintName = "NowPlayingView"
20+
ReferencedContainer = "container:NowPlayingView.xcodeproj">
21+
</BuildableReference>
22+
</BuildActionEntry>
23+
</BuildActionEntries>
24+
</BuildAction>
25+
<TestAction
26+
buildConfiguration = "Debug"
27+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29+
language = ""
30+
shouldUseLaunchSchemeArgsEnv = "YES">
31+
<Testables>
32+
</Testables>
33+
<MacroExpansion>
34+
<BuildableReference
35+
BuildableIdentifier = "primary"
36+
BlueprintIdentifier = "F4F973EB1CAD60320036411D"
37+
BuildableName = "NowPlayingView.app"
38+
BlueprintName = "NowPlayingView"
39+
ReferencedContainer = "container:NowPlayingView.xcodeproj">
40+
</BuildableReference>
41+
</MacroExpansion>
42+
<AdditionalOptions>
43+
</AdditionalOptions>
44+
</TestAction>
45+
<LaunchAction
46+
buildConfiguration = "Debug"
47+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
48+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
49+
language = ""
50+
launchStyle = "0"
51+
useCustomWorkingDirectory = "NO"
52+
ignoresPersistentStateOnLaunch = "NO"
53+
debugDocumentVersioning = "YES"
54+
debugServiceExtension = "internal"
55+
allowLocationSimulation = "YES">
56+
<BuildableProductRunnable
57+
runnableDebuggingMode = "0">
58+
<BuildableReference
59+
BuildableIdentifier = "primary"
60+
BlueprintIdentifier = "F4F973EB1CAD60320036411D"
61+
BuildableName = "NowPlayingView.app"
62+
BlueprintName = "NowPlayingView"
63+
ReferencedContainer = "container:NowPlayingView.xcodeproj">
64+
</BuildableReference>
65+
</BuildableProductRunnable>
66+
<AdditionalOptions>
67+
</AdditionalOptions>
68+
</LaunchAction>
69+
<ProfileAction
70+
buildConfiguration = "Release"
71+
shouldUseLaunchSchemeArgsEnv = "YES"
72+
savedToolIdentifier = ""
73+
useCustomWorkingDirectory = "NO"
74+
debugDocumentVersioning = "YES">
75+
<BuildableProductRunnable
76+
runnableDebuggingMode = "0">
77+
<BuildableReference
78+
BuildableIdentifier = "primary"
79+
BlueprintIdentifier = "F4F973EB1CAD60320036411D"
80+
BuildableName = "NowPlayingView.app"
81+
BlueprintName = "NowPlayingView"
82+
ReferencedContainer = "container:NowPlayingView.xcodeproj">
83+
</BuildableReference>
84+
</BuildableProductRunnable>
85+
</ProfileAction>
86+
<AnalyzeAction
87+
buildConfiguration = "Debug">
88+
</AnalyzeAction>
89+
<ArchiveAction
90+
buildConfiguration = "Release"
91+
revealArchiveInOrganizer = "YES">
92+
</ArchiveAction>
93+
</Scheme>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>SchemeUserState</key>
6+
<dict>
7+
<key>Demo Projects - NowPlayingView.xcscheme_^#shared#^_</key>
8+
<dict>
9+
<key>orderHint</key>
10+
<integer>0</integer>
11+
</dict>
12+
</dict>
13+
</dict>
14+
</plist>
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
import UIKit
2+
3+
@UIApplicationMain
4+
class AppDelegate: UIResponder,
5+
UIApplicationDelegate, SPTAppRemoteDelegate {
6+
7+
fileprivate let redirectUri = "comspotifytestsdk://"
8+
fileprivate let clientIdentifier = "089d841ccc194c10a77afad9e1c11d54"
9+
fileprivate let name = "Now Playing View"
10+
11+
// keys
12+
static fileprivate let kAccessTokenKey = "access-token-key"
13+
14+
// output parameter!
15+
var accessToken = UserDefaults.standard.string(forKey: kAccessTokenKey) {
16+
didSet {
17+
let defaults = UserDefaults.standard
18+
defaults.set(accessToken, forKey: AppDelegate.kAccessTokenKey)
19+
defaults.synchronize()
20+
}
21+
}
22+
23+
24+
var playerViewController: ViewController {
25+
get {
26+
let navController = self.window?.rootViewController?.childViewControllers[0] as! UINavigationController
27+
return navController.topViewController as! ViewController
28+
}
29+
}
30+
31+
var window: UIWindow?
32+
33+
lazy var appRemote: SPTAppRemote = {
34+
let connectionParams = SPTAppRemoteConnectionParams(clientIdentifier: self.clientIdentifier,
35+
redirectURI: self.redirectUri,
36+
name: self.name,
37+
accessToken: self.accessToken,
38+
defaultImageSize: CGSize(width: 0, height: 0),
39+
imageFormat: .any);
40+
let appRemote = SPTAppRemote(connectionParameters: connectionParams, logLevel: .debug)
41+
appRemote.delegate = self
42+
return appRemote
43+
}()
44+
45+
class var sharedInstance: AppDelegate {
46+
get {
47+
return UIApplication.shared.delegate as! AppDelegate
48+
}
49+
}
50+
51+
func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any]) -> Bool {
52+
let parameters = appRemote.authorizationParameters(from: url);
53+
54+
if let access_token = parameters?[SPTAppRemoteAccessTokenKey] {
55+
appRemote.connectionParameters.accessToken = access_token
56+
self.accessToken = access_token
57+
} else if let error_description = parameters?[SPTAppRemoteErrorDescriptionKey] {
58+
playerViewController.showError(error_description);
59+
}
60+
61+
return true
62+
}
63+
64+
func applicationWillResignActive(_ application: UIApplication) {
65+
print("I'm out of focus!")
66+
playerViewController.appRemoteDisconnect()
67+
appRemote.disconnect()
68+
}
69+
70+
func applicationDidBecomeActive(_ application: UIApplication) {
71+
self.connect();
72+
}
73+
74+
func connect() {
75+
playerViewController.appRemoteConnecting()
76+
appRemote.connect()
77+
}
78+
79+
// MARK: AppRemoteDelegate
80+
81+
func appRemoteDidEstablishConnection(_ appRemote: SPTAppRemote) {
82+
self.appRemote = appRemote
83+
playerViewController.appRemoteConnected()
84+
}
85+
86+
func appRemote(_ appRemote: SPTAppRemote, didFailConnectionAttemptWithError error: Error?) {
87+
print("didFailConnectionAttemptWithError")
88+
playerViewController.appRemoteDisconnect()
89+
}
90+
91+
func appRemote(_ appRemote: SPTAppRemote, didDisconnectWithError error: Error?) {
92+
print("didDisconnectWithError")
93+
playerViewController.appRemoteDisconnect()
94+
}
95+
96+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{
2+
"images" : [
3+
{
4+
"idiom" : "iphone",
5+
"size" : "20x20",
6+
"scale" : "2x"
7+
},
8+
{
9+
"idiom" : "iphone",
10+
"size" : "20x20",
11+
"scale" : "3x"
12+
},
13+
{
14+
"idiom" : "iphone",
15+
"size" : "29x29",
16+
"scale" : "2x"
17+
},
18+
{
19+
"idiom" : "iphone",
20+
"size" : "29x29",
21+
"scale" : "3x"
22+
},
23+
{
24+
"idiom" : "iphone",
25+
"size" : "40x40",
26+
"scale" : "2x"
27+
},
28+
{
29+
"idiom" : "iphone",
30+
"size" : "40x40",
31+
"scale" : "3x"
32+
},
33+
{
34+
"idiom" : "iphone",
35+
"size" : "60x60",
36+
"scale" : "2x"
37+
},
38+
{
39+
"idiom" : "iphone",
40+
"size" : "60x60",
41+
"scale" : "3x"
42+
}
43+
],
44+
"info" : {
45+
"version" : 1,
46+
"author" : "xcode"
47+
}
48+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
<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">
3+
<dependencies>
4+
<deployment identifier="iOS"/>
5+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
6+
</dependencies>
7+
<scenes>
8+
<!--View Controller-->
9+
<scene sceneID="EHf-IW-A2E">
10+
<objects>
11+
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
12+
<layoutGuides>
13+
<viewControllerLayoutGuide type="top" id="Llm-lL-Icb"/>
14+
<viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok"/>
15+
</layoutGuides>
16+
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
17+
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
18+
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
19+
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
20+
</view>
21+
</viewController>
22+
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
23+
</objects>
24+
<point key="canvasLocation" x="53" y="375"/>
25+
</scene>
26+
</scenes>
27+
</document>

0 commit comments

Comments
 (0)