Skip to content

Commit

Permalink
Spotify iOS SDK v1.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
kkarayannis committed Apr 11, 2019
1 parent 23644b0 commit 421973e
Show file tree
Hide file tree
Showing 56 changed files with 578 additions and 140 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.DS_Store
*.xcuserstate
xcuserdata
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Changelog

## Spotify iOS SDK v1.0.2

### What's New
- Adds a method to start playing a playlist from a given index
- Adds a method to query the crossfade state (on/off) and duration

## Spotify iOS SDK v1.0.1

**Important Note:** The api for `fetchRecommendedContentItemsForType:` on `SPTAppRemoteContentAPI` has been renamed to `fetchRootContentItemsForType:` and still functions as it did returning root items. A new method for `fetchRecommendedContentItemsForType:flattenContainers:` has been added to fetch actual recommended items.

### What's New
- Adds convenience methods for dealing with podcasts
- Adds additional convenience methods for fetching recommended items
- Adds the ability to check if Spotify is active before authorization

## Spotify iOS SDK v1.0.0

### What's New

- Initial iOS SDK release
- Includes authentication and playback control capabilities

Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
English,
en,
Base,
);
Expand Down Expand Up @@ -263,7 +264,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = "-ObjC";
Expand Down Expand Up @@ -315,7 +316,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MTL_ENABLE_DEBUG_INFO = NO;
OTHER_LDFLAGS = "-ObjC";
SDKROOT = iphoneos;
Expand All @@ -331,14 +332,13 @@
CLANG_ENABLE_MODULES = YES;
DEVELOPMENT_TEAM = 2FNC3A47ZF;
INFOPLIST_FILE = NowPlayingView/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.testappremote;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "NowPlayingView/NowPlayingView-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -349,13 +349,12 @@
CLANG_ENABLE_MODULES = YES;
DEVELOPMENT_TEAM = 2FNC3A47ZF;
INFOPLIST_FILE = NowPlayingView/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.testappremote;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "NowPlayingView/NowPlayingView-Bridging-Header.h";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0940"
LastUpgradeVersion = "1020"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
12 changes: 6 additions & 6 deletions DemoProjects/NowPlayingView/NowPlayingView/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import UIKit
class AppDelegate: UIResponder,
UIApplicationDelegate, SPTAppRemoteDelegate {

fileprivate let redirectUri = URL(string:"comspotifytestsdk://")!
fileprivate let clientIdentifier = "089d841ccc194c10a77afad9e1c11d54"
fileprivate let name = "Now Playing View"
private let redirectUri = URL(string:"comspotifytestsdk://")!
private let clientIdentifier = "089d841ccc194c10a77afad9e1c11d54"
private let name = "Now Playing View"

// keys
static fileprivate let kAccessTokenKey = "access-token-key"
static private let kAccessTokenKey = "access-token-key"

var accessToken = UserDefaults.standard.string(forKey: kAccessTokenKey) {
didSet {
Expand All @@ -22,7 +22,7 @@ class AppDelegate: UIResponder,

var playerViewController: ViewController {
get {
let navController = self.window?.rootViewController?.childViewControllers[0] as! UINavigationController
let navController = self.window?.rootViewController?.children[0] as! UINavigationController
return navController.topViewController as! ViewController
}
}
Expand All @@ -43,7 +43,7 @@ class AppDelegate: UIResponder,
}
}

func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any]) -> Bool {
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any]) -> Bool {
let parameters = appRemote.authorizationParameters(from: url);

if let access_token = parameters?[SPTAppRemoteAccessTokenKey] {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="YFO-Y1-WYf">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="YFO-Y1-WYf">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.20"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14490.49"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
Expand Down Expand Up @@ -357,7 +357,7 @@
<rect key="frame" x="0.0" y="0.0" width="200" height="200"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" alpha="0.65000000000000002" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="Wj9-jS-nnW">
<imageView clipsSubviews="YES" userInteractionEnabled="NO" alpha="0.65000000000000002" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="Wj9-jS-nnW">
<rect key="frame" x="0.0" y="0.0" width="200" height="143"/>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Title" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="P1m-aC-bhj">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ class ConnectionStatusIndicatorView : UIView {
let selector = #selector(setNeedsDisplay as () -> Void)
displayLink = CADisplayLink(target: self, selector:selector)
}
displayLink?.add(to: RunLoop.main, forMode: RunLoopMode.commonModes)
displayLink?.add(to: RunLoop.main, forMode: RunLoop.Mode.common)
} else {
displayLink?.remove(from: RunLoop.main, forMode: RunLoopMode.commonModes)
displayLink?.remove(from: RunLoop.main, forMode: RunLoop.Mode.common)
displayLink = nil;
}
}
Expand Down Expand Up @@ -48,11 +48,11 @@ class ConnectionStatusIndicatorView : UIView {
context.fillPath()
}

fileprivate func timebasedValue() -> CGFloat {
private func timebasedValue() -> CGFloat {
return CGFloat(abs(sin(Date().timeIntervalSinceReferenceDate*4)))
}

fileprivate func fillColor() -> CGColor {
private func fillColor() -> CGColor {
switch state {
case .disconnected:
return UIColor.red.cgColor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class ContentCollectionViewController : UICollectionViewController, UICollection
return cell
}

fileprivate func scaledSizeForCell(_ cell: UICollectionViewCell) -> CGSize {
private func scaledSizeForCell(_ cell: UICollectionViewCell) -> CGSize {
let scale = UIScreen.main.scale
let size = cell.frame.size
return CGSize(width: size.width * scale, height: size.height * scale)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ protocol SpeedPickerViewControllerDelegate {
class SpeedPickerViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {

var delegate: SpeedPickerViewControllerDelegate?
fileprivate let podcastSpeeds: [SPTAppRemotePodcastPlaybackSpeed]
fileprivate var selectedSpeed: SPTAppRemotePodcastPlaybackSpeed
fileprivate var selectedIndex: Int = 0
fileprivate let cellIdentifier = "SpeedCell"
private let podcastSpeeds: [SPTAppRemotePodcastPlaybackSpeed]
private var selectedSpeed: SPTAppRemotePodcastPlaybackSpeed
private var selectedIndex: Int = 0
private let cellIdentifier = "SpeedCell"

lazy var tableView: UITableView = {
let tableView = UITableView(frame: self.view.bounds)
Expand Down Expand Up @@ -39,9 +39,9 @@ class SpeedPickerViewController: UIViewController, UITableViewDelegate, UITableV
navigationItem.leftBarButtonItem = UIBarButtonItem(title: "Cancel", style: .done, target: self, action: #selector(didPressCancel))
}

fileprivate func updateSelectedindex() {
private func updateSelectedindex() {
let values = podcastSpeeds.map { $0.value }
selectedIndex = values.distance(from: values.startIndex, to:values.index(of: self.selectedSpeed.value)!)
selectedIndex = values.distance(from: values.startIndex, to:values.firstIndex(of: self.selectedSpeed.value)!)
}

@objc func didPressCancel() {
Expand Down
Loading

0 comments on commit 421973e

Please sign in to comment.