Skip to content

Commit c7757b8

Browse files
authored
Merge pull request #421 from jalopezcar/release_v2.0.0
Spotify iOS SDK v2.0.0
2 parents abb7052 + a46bbe1 commit c7757b8

File tree

76 files changed

+336
-485
lines changed

Some content is hidden

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

76 files changed

+336
-485
lines changed

CHANGELOG.md

+9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# Changelog
22

3+
## Spotify iOS SDK v2.0.0
4+
5+
What's New:
6+
- Added a completionHandler to authorizeAndPlayURI API
7+
- Support for pinned items in Your Library
8+
- Fix crash NSRangeException -[NSConcreteMutableData replaceBytesInRange:withBytes:length:]:
9+
- Fix umbrela header warnings in SpotifyiOS.xcframework
10+
- Bumped the min deployment target version to iOS 12.0
11+
312
## Spotify iOS SDK v1.2.5
413

514
What's New:

DemoProjects/NowPlayingView/NowPlayingView.xcodeproj/project.pbxproj

+8-5
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
F4F973F51CAD60320036411D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F4F973F31CAD60320036411D /* Main.storyboard */; };
2020
F4F973F71CAD60320036411D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F4F973F61CAD60320036411D /* Assets.xcassets */; };
2121
F4F973FA1CAD60320036411D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F4F973F81CAD60320036411D /* LaunchScreen.storyboard */; };
22-
F4F974051CAD60C60036411D /* host.entitlements in Resources */ = {isa = PBXBuildFile; fileRef = F4F974041CAD60C60036411D /* host.entitlements */; };
2322
F6EB42E11D2BB01100F57322 /* ContentItemCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = F6EB42E01D2BB01100F57322 /* ContentItemCell.swift */; };
2423
F6EB42E31D2BB0D800F57322 /* ContentCollectionViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F6EB42E21D2BB0D800F57322 /* ContentCollectionViewController.swift */; };
2524
/* End PBXBuildFile section */
@@ -52,7 +51,6 @@
5251
F4F973F61CAD60320036411D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
5352
F4F973F91CAD60320036411D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
5453
F4F973FB1CAD60320036411D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
55-
F4F974041CAD60C60036411D /* host.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = host.entitlements; sourceTree = "<group>"; };
5654
F4F974081CAD62D40036411D /* NowPlayingView-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NowPlayingView-Bridging-Header.h"; sourceTree = "<group>"; };
5755
F6EB42E01D2BB01100F57322 /* ContentItemCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContentItemCell.swift; sourceTree = "<group>"; };
5856
F6EB42E21D2BB0D800F57322 /* ContentCollectionViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContentCollectionViewController.swift; sourceTree = "<group>"; };
@@ -100,7 +98,6 @@
10098
F4F973F31CAD60320036411D /* Main.storyboard */,
10199
F4F973F81CAD60320036411D /* LaunchScreen.storyboard */,
102100
F4F973FB1CAD60320036411D /* Info.plist */,
103-
F4F974041CAD60C60036411D /* host.entitlements */,
104101
F4F974081CAD62D40036411D /* NowPlayingView-Bridging-Header.h */,
105102
99A0FFE31D38F9B600A90453 /* PlaybackButtonGraphics.swift */,
106103
998FF9BD1D3E54AC003E339B /* ConnectionStatusIndicatorView.swift */,
@@ -144,8 +141,9 @@
144141
F4F973E41CAD60320036411D /* Project object */ = {
145142
isa = PBXProject;
146143
attributes = {
144+
BuildIndependentTargetsInParallel = YES;
147145
LastSwiftUpdateCheck = 0720;
148-
LastUpgradeCheck = 1020;
146+
LastUpgradeCheck = 1510;
149147
ORGANIZATIONNAME = Spotify;
150148
TargetAttributes = {
151149
F4F973EB1CAD60320036411D = {
@@ -187,7 +185,6 @@
187185
buildActionMask = 2147483647;
188186
files = (
189187
F4F973FA1CAD60320036411D /* LaunchScreen.storyboard in Resources */,
190-
F4F974051CAD60C60036411D /* host.entitlements in Resources */,
191188
F4F973F71CAD60320036411D /* Assets.xcassets in Resources */,
192189
F4F973F51CAD60320036411D /* Main.storyboard in Resources */,
193190
);
@@ -238,6 +235,7 @@
238235
isa = XCBuildConfiguration;
239236
buildSettings = {
240237
ALWAYS_SEARCH_USER_PATHS = NO;
238+
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
241239
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
242240
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
243241
CLANG_CXX_LIBRARY = "libc++";
@@ -257,6 +255,7 @@
257255
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
258256
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
259257
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
258+
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
260259
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
261260
CLANG_WARN_STRICT_PROTOTYPES = YES;
262261
CLANG_WARN_SUSPICIOUS_MOVE = YES;
@@ -269,6 +268,7 @@
269268
ENABLE_BITCODE = NO;
270269
ENABLE_STRICT_OBJC_MSGSEND = YES;
271270
ENABLE_TESTABILITY = YES;
271+
ENABLE_USER_SCRIPT_SANDBOXING = YES;
272272
FRAMEWORK_SEARCH_PATHS = ../..;
273273
GCC_C_LANGUAGE_STANDARD = gnu99;
274274
GCC_DYNAMIC_NO_PIC = NO;
@@ -297,6 +297,7 @@
297297
isa = XCBuildConfiguration;
298298
buildSettings = {
299299
ALWAYS_SEARCH_USER_PATHS = NO;
300+
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
300301
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
301302
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
302303
CLANG_CXX_LIBRARY = "libc++";
@@ -316,6 +317,7 @@
316317
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
317318
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
318319
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
320+
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
319321
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
320322
CLANG_WARN_STRICT_PROTOTYPES = YES;
321323
CLANG_WARN_SUSPICIOUS_MOVE = YES;
@@ -328,6 +330,7 @@
328330
ENABLE_BITCODE = NO;
329331
ENABLE_NS_ASSERTIONS = NO;
330332
ENABLE_STRICT_OBJC_MSGSEND = YES;
333+
ENABLE_USER_SCRIPT_SANDBOXING = YES;
331334
FRAMEWORK_SEARCH_PATHS = ../..;
332335
GCC_C_LANGUAGE_STANDARD = gnu99;
333336
GCC_NO_COMMON_BLOCKS = YES;

DemoProjects/NowPlayingView/NowPlayingView.xcodeproj/xcshareddata/xcschemes/Demo Projects - NowPlayingView.xcscheme

+3-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1020"
3+
LastUpgradeVersion = "1510"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"
@@ -27,8 +27,6 @@
2727
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
2828
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
2929
shouldUseLaunchSchemeArgsEnv = "YES">
30-
<Testables>
31-
</Testables>
3230
<MacroExpansion>
3331
<BuildableReference
3432
BuildableIdentifier = "primary"
@@ -38,8 +36,8 @@
3836
ReferencedContainer = "container:NowPlayingView.xcodeproj">
3937
</BuildableReference>
4038
</MacroExpansion>
41-
<AdditionalOptions>
42-
</AdditionalOptions>
39+
<Testables>
40+
</Testables>
4341
</TestAction>
4442
<LaunchAction
4543
buildConfiguration = "Debug"
@@ -61,8 +59,6 @@
6159
ReferencedContainer = "container:NowPlayingView.xcodeproj">
6260
</BuildableReference>
6361
</BuildableProductRunnable>
64-
<AdditionalOptions>
65-
</AdditionalOptions>
6662
</LaunchAction>
6763
<ProfileAction
6864
buildConfiguration = "Release"

DemoProjects/NowPlayingView/NowPlayingView/ConnectionStatusIndicatorView.swift

+1-3
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,7 @@ class ConnectionStatusIndicatorView : UIView {
3939
}
4040

4141
let size = self.bounds.size
42-
let path = CGMutablePath()
43-
44-
path.__addRoundedRect(transform: nil, rect: self.bounds, cornerWidth: size.width/2, cornerHeight: size.height/2)
42+
let path = CGPath(roundedRect: self.bounds, cornerWidth: size.width/2, cornerHeight: size.height/2, transform: nil)
4543
context.addPath(path)
4644

4745
context.setFillColor(fillColor())

DemoProjects/NowPlayingView/NowPlayingView/ContentCollectionViewController.swift

+4-3
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,11 @@ class ContentCollectionViewController : UICollectionViewController, UICollection
7171

7272
cell.imageView.image = nil
7373
appRemote?.imageAPI?.fetchImage(forItem: item, with: scaledSizeForCell(cell)) { (image, error) in
74-
// If the cell hasn't been reused
75-
if cell.titleLabel.text == item.title {
76-
cell.imageView?.image = image as? UIImage
74+
guard let image = image as? UIImage, error == nil,
75+
let cell = collectionView.cellForItem(at: indexPath) as? ContentItemCell else {
76+
return
7777
}
78+
cell.imageView?.image = image
7879
}
7980

8081
return cell

DemoProjects/NowPlayingView/NowPlayingView/ViewController.swift

+22-18
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class ViewController: UIViewController {
5959
self.navigationItem.rightBarButtonItem = UIBarButtonItem(customView: connectionIndicatorView)
6060
connectionIndicatorView.frame = CGRect(origin: CGPoint(), size: CGSize(width: 20,height: 20))
6161

62-
playPauseButton.setTitle("", for: UIControl.State.normal);
62+
playPauseButton.setTitle("", for: UIControl.State.normal)
6363
playPauseButton.setImage(PlaybackButtonGraphics.playButtonImage(), for: UIControl.State.normal)
6464
playPauseButton.setImage(PlaybackButtonGraphics.playButtonImage(), for: UIControl.State.highlighted)
6565

@@ -104,7 +104,7 @@ class ViewController: UIViewController {
104104

105105
if (!enabled) {
106106
albumArtImageView.image = nil
107-
updatePlayPauseButtonState(true);
107+
updatePlayPauseButtonState(true)
108108
}
109109
}
110110

@@ -120,19 +120,19 @@ class ViewController: UIViewController {
120120

121121
private func updatePodcastSpeed(speed: SPTAppRemotePodcastPlaybackSpeed) {
122122
currentPodcastSpeed = speed
123-
podcastSpeedButton.setTitle(String(format: "%0.1fx", speed.value.floatValue), for: .normal);
123+
podcastSpeedButton.setTitle(String(format: "%0.1fx", speed.value.floatValue), for: .normal)
124124
}
125125

126126
// MARK: Player State
127127
private func updatePlayPauseButtonState(_ paused: Bool) {
128128
let playPauseButtonImage = paused ? PlaybackButtonGraphics.playButtonImage() : PlaybackButtonGraphics.pauseButtonImage()
129-
playPauseButton.setImage(playPauseButtonImage, for: UIControl.State())
129+
playPauseButton.setImage(playPauseButtonImage, for: .normal)
130130
playPauseButton.setImage(playPauseButtonImage, for: .highlighted)
131131
}
132132

133133
private func updatePlayerStateSubscriptionButtonState() {
134134
let playerStateSubscriptionButtonTitle = subscribedToPlayerState ? "Unsubscribe" : "Subscribe"
135-
playerStateSubscriptionButton.setTitle(playerStateSubscriptionButtonTitle, for: UIControl.State())
135+
playerStateSubscriptionButton.setTitle(playerStateSubscriptionButtonTitle, for: .normal)
136136
}
137137

138138
// MARK: Capabilities
@@ -142,7 +142,7 @@ class ViewController: UIViewController {
142142

143143
private func updateCapabilitiesSubscriptionButtonState() {
144144
let capabilitiesSubscriptionButtonTitle = subscribedToCapabilities ? "Unsubscribe" : "Subscribe"
145-
capabilitiesSubscriptionButton.setTitle(capabilitiesSubscriptionButtonTitle, for: UIControl.State())
145+
capabilitiesSubscriptionButton.setTitle(capabilitiesSubscriptionButtonTitle, for: .normal)
146146
}
147147

148148
// MARK: Shuffle
@@ -159,7 +159,7 @@ class ViewController: UIViewController {
159159
case .context: return "Context"
160160
default: return "Off"
161161
}
162-
}()
162+
}()
163163
}
164164

165165
// MARK: Album Art
@@ -206,7 +206,7 @@ class ViewController: UIViewController {
206206
private func pausePlayback() {
207207
appRemote?.playerAPI?.pause(defaultCallback)
208208
}
209-
209+
210210
private func playTrack() {
211211
appRemote?.playerAPI?.play(trackIdentifier, callback: defaultCallback)
212212
}
@@ -357,9 +357,11 @@ class ViewController: UIViewController {
357357
// MARK: - IBActions
358358
@IBAction func didPressPlayPauseButton(_ sender: AnyObject) {
359359
if appRemote?.isConnected == false {
360-
if appRemote?.authorizeAndPlayURI(playURI) == false {
361-
// The Spotify app is not installed, present the user with an App Store page
362-
showAppStoreInstall()
360+
appRemote?.authorizeAndPlayURI(playURI) { success in
361+
if !success {
362+
// The Spotify app is not installed, present the user with an App Store page
363+
self.showAppStoreInstall()
364+
}
363365
}
364366
} else if playerState == nil || playerState!.isPaused {
365367
startPlayback()
@@ -430,9 +432,11 @@ class ViewController: UIViewController {
430432

431433
@IBAction func playRadioTapped(_ sender: Any) {
432434
if appRemote?.isConnected == false && appRemote?.playerAPI != nil {
433-
if appRemote?.authorizeAndPlayURI(trackIdentifier, asRadio: true) == false {
434-
// The Spotify app is not installed, present the user with an App Store page
435-
showAppStoreInstall()
435+
appRemote?.authorizeAndPlayURI(trackIdentifier, asRadio: true) { success in
436+
if !success {
437+
// The Spotify app is not installed, present the user with an App Store page
438+
self.showAppStoreInstall()
439+
}
436440
}
437441
} else {
438442
var trackUri = trackIdentifier
@@ -467,10 +471,10 @@ extension ViewController: SpeedPickerViewControllerDelegate {
467471

468472
// MARK: - SPTAppRemotePlayerStateDelegate
469473
extension ViewController: SPTAppRemotePlayerStateDelegate {
470-
func playerStateDidChange(_ playerState: SPTAppRemotePlayerState) {
471-
self.playerState = playerState
472-
updateViewWithPlayerState(playerState)
473-
}
474+
func playerStateDidChange(_ playerState: SPTAppRemotePlayerState) {
475+
self.playerState = playerState
476+
updateViewWithPlayerState(playerState)
477+
}
474478
}
475479
// MARK: - SPTAppRemoteUserAPIDelegate
476480
extension ViewController: SPTAppRemoteUserAPIDelegate {

0 commit comments

Comments
 (0)