Skip to content

Commit

Permalink
Merge pull request #421 from jalopezcar/release_v2.0.0
Browse files Browse the repository at this point in the history
Spotify iOS SDK v2.0.0
  • Loading branch information
jalopezcar authored May 8, 2024
2 parents abb7052 + a46bbe1 commit c7757b8
Show file tree
Hide file tree
Showing 76 changed files with 336 additions and 485 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

## Spotify iOS SDK v2.0.0

What's New:
- Added a completionHandler to authorizeAndPlayURI API
- Support for pinned items in Your Library
- Fix crash NSRangeException -[NSConcreteMutableData replaceBytesInRange:withBytes:length:]:
- Fix umbrela header warnings in SpotifyiOS.xcframework
- Bumped the min deployment target version to iOS 12.0

## Spotify iOS SDK v1.2.5

What's New:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
F4F973F51CAD60320036411D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F4F973F31CAD60320036411D /* Main.storyboard */; };
F4F973F71CAD60320036411D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F4F973F61CAD60320036411D /* Assets.xcassets */; };
F4F973FA1CAD60320036411D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F4F973F81CAD60320036411D /* LaunchScreen.storyboard */; };
F4F974051CAD60C60036411D /* host.entitlements in Resources */ = {isa = PBXBuildFile; fileRef = F4F974041CAD60C60036411D /* host.entitlements */; };
F6EB42E11D2BB01100F57322 /* ContentItemCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = F6EB42E01D2BB01100F57322 /* ContentItemCell.swift */; };
F6EB42E31D2BB0D800F57322 /* ContentCollectionViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F6EB42E21D2BB0D800F57322 /* ContentCollectionViewController.swift */; };
/* End PBXBuildFile section */
Expand Down Expand Up @@ -52,7 +51,6 @@
F4F973F61CAD60320036411D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
F4F973F91CAD60320036411D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
F4F973FB1CAD60320036411D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
F4F974041CAD60C60036411D /* host.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = host.entitlements; sourceTree = "<group>"; };
F4F974081CAD62D40036411D /* NowPlayingView-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NowPlayingView-Bridging-Header.h"; sourceTree = "<group>"; };
F6EB42E01D2BB01100F57322 /* ContentItemCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContentItemCell.swift; sourceTree = "<group>"; };
F6EB42E21D2BB0D800F57322 /* ContentCollectionViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContentCollectionViewController.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -100,7 +98,6 @@
F4F973F31CAD60320036411D /* Main.storyboard */,
F4F973F81CAD60320036411D /* LaunchScreen.storyboard */,
F4F973FB1CAD60320036411D /* Info.plist */,
F4F974041CAD60C60036411D /* host.entitlements */,
F4F974081CAD62D40036411D /* NowPlayingView-Bridging-Header.h */,
99A0FFE31D38F9B600A90453 /* PlaybackButtonGraphics.swift */,
998FF9BD1D3E54AC003E339B /* ConnectionStatusIndicatorView.swift */,
Expand Down Expand Up @@ -144,8 +141,9 @@
F4F973E41CAD60320036411D /* Project object */ = {
isa = PBXProject;
attributes = {
BuildIndependentTargetsInParallel = YES;
LastSwiftUpdateCheck = 0720;
LastUpgradeCheck = 1020;
LastUpgradeCheck = 1510;
ORGANIZATIONNAME = Spotify;
TargetAttributes = {
F4F973EB1CAD60320036411D = {
Expand Down Expand Up @@ -187,7 +185,6 @@
buildActionMask = 2147483647;
files = (
F4F973FA1CAD60320036411D /* LaunchScreen.storyboard in Resources */,
F4F974051CAD60C60036411D /* host.entitlements in Resources */,
F4F973F71CAD60320036411D /* Assets.xcassets in Resources */,
F4F973F51CAD60320036411D /* Main.storyboard in Resources */,
);
Expand Down Expand Up @@ -238,6 +235,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
Expand All @@ -257,6 +255,7 @@
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
Expand All @@ -269,6 +268,7 @@
ENABLE_BITCODE = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
ENABLE_USER_SCRIPT_SANDBOXING = YES;
FRAMEWORK_SEARCH_PATHS = ../..;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
Expand Down Expand Up @@ -297,6 +297,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
Expand All @@ -316,6 +317,7 @@
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
Expand All @@ -328,6 +330,7 @@
ENABLE_BITCODE = NO;
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_USER_SCRIPT_SANDBOXING = YES;
FRAMEWORK_SEARCH_PATHS = ../..;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
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 = "1020"
LastUpgradeVersion = "1510"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand All @@ -27,8 +27,6 @@
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
Expand All @@ -38,8 +36,8 @@
ReferencedContainer = "container:NowPlayingView.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
Expand All @@ -61,8 +59,6 @@
ReferencedContainer = "container:NowPlayingView.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,7 @@ class ConnectionStatusIndicatorView : UIView {
}

let size = self.bounds.size
let path = CGMutablePath()

path.__addRoundedRect(transform: nil, rect: self.bounds, cornerWidth: size.width/2, cornerHeight: size.height/2)
let path = CGPath(roundedRect: self.bounds, cornerWidth: size.width/2, cornerHeight: size.height/2, transform: nil)
context.addPath(path)

context.setFillColor(fillColor())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,11 @@ class ContentCollectionViewController : UICollectionViewController, UICollection

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

return cell
Expand Down
40 changes: 22 additions & 18 deletions DemoProjects/NowPlayingView/NowPlayingView/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class ViewController: UIViewController {
self.navigationItem.rightBarButtonItem = UIBarButtonItem(customView: connectionIndicatorView)
connectionIndicatorView.frame = CGRect(origin: CGPoint(), size: CGSize(width: 20,height: 20))

playPauseButton.setTitle("", for: UIControl.State.normal);
playPauseButton.setTitle("", for: UIControl.State.normal)
playPauseButton.setImage(PlaybackButtonGraphics.playButtonImage(), for: UIControl.State.normal)
playPauseButton.setImage(PlaybackButtonGraphics.playButtonImage(), for: UIControl.State.highlighted)

Expand Down Expand Up @@ -104,7 +104,7 @@ class ViewController: UIViewController {

if (!enabled) {
albumArtImageView.image = nil
updatePlayPauseButtonState(true);
updatePlayPauseButtonState(true)
}
}

Expand All @@ -120,19 +120,19 @@ class ViewController: UIViewController {

private func updatePodcastSpeed(speed: SPTAppRemotePodcastPlaybackSpeed) {
currentPodcastSpeed = speed
podcastSpeedButton.setTitle(String(format: "%0.1fx", speed.value.floatValue), for: .normal);
podcastSpeedButton.setTitle(String(format: "%0.1fx", speed.value.floatValue), for: .normal)
}

// MARK: Player State
private func updatePlayPauseButtonState(_ paused: Bool) {
let playPauseButtonImage = paused ? PlaybackButtonGraphics.playButtonImage() : PlaybackButtonGraphics.pauseButtonImage()
playPauseButton.setImage(playPauseButtonImage, for: UIControl.State())
playPauseButton.setImage(playPauseButtonImage, for: .normal)
playPauseButton.setImage(playPauseButtonImage, for: .highlighted)
}

private func updatePlayerStateSubscriptionButtonState() {
let playerStateSubscriptionButtonTitle = subscribedToPlayerState ? "Unsubscribe" : "Subscribe"
playerStateSubscriptionButton.setTitle(playerStateSubscriptionButtonTitle, for: UIControl.State())
playerStateSubscriptionButton.setTitle(playerStateSubscriptionButtonTitle, for: .normal)
}

// MARK: Capabilities
Expand All @@ -142,7 +142,7 @@ class ViewController: UIViewController {

private func updateCapabilitiesSubscriptionButtonState() {
let capabilitiesSubscriptionButtonTitle = subscribedToCapabilities ? "Unsubscribe" : "Subscribe"
capabilitiesSubscriptionButton.setTitle(capabilitiesSubscriptionButtonTitle, for: UIControl.State())
capabilitiesSubscriptionButton.setTitle(capabilitiesSubscriptionButtonTitle, for: .normal)
}

// MARK: Shuffle
Expand All @@ -159,7 +159,7 @@ class ViewController: UIViewController {
case .context: return "Context"
default: return "Off"
}
}()
}()
}

// MARK: Album Art
Expand Down Expand Up @@ -206,7 +206,7 @@ class ViewController: UIViewController {
private func pausePlayback() {
appRemote?.playerAPI?.pause(defaultCallback)
}

private func playTrack() {
appRemote?.playerAPI?.play(trackIdentifier, callback: defaultCallback)
}
Expand Down Expand Up @@ -357,9 +357,11 @@ class ViewController: UIViewController {
// MARK: - IBActions
@IBAction func didPressPlayPauseButton(_ sender: AnyObject) {
if appRemote?.isConnected == false {
if appRemote?.authorizeAndPlayURI(playURI) == false {
// The Spotify app is not installed, present the user with an App Store page
showAppStoreInstall()
appRemote?.authorizeAndPlayURI(playURI) { success in
if !success {
// The Spotify app is not installed, present the user with an App Store page
self.showAppStoreInstall()
}
}
} else if playerState == nil || playerState!.isPaused {
startPlayback()
Expand Down Expand Up @@ -430,9 +432,11 @@ class ViewController: UIViewController {

@IBAction func playRadioTapped(_ sender: Any) {
if appRemote?.isConnected == false && appRemote?.playerAPI != nil {
if appRemote?.authorizeAndPlayURI(trackIdentifier, asRadio: true) == false {
// The Spotify app is not installed, present the user with an App Store page
showAppStoreInstall()
appRemote?.authorizeAndPlayURI(trackIdentifier, asRadio: true) { success in
if !success {
// The Spotify app is not installed, present the user with an App Store page
self.showAppStoreInstall()
}
}
} else {
var trackUri = trackIdentifier
Expand Down Expand Up @@ -467,10 +471,10 @@ extension ViewController: SpeedPickerViewControllerDelegate {

// MARK: - SPTAppRemotePlayerStateDelegate
extension ViewController: SPTAppRemotePlayerStateDelegate {
func playerStateDidChange(_ playerState: SPTAppRemotePlayerState) {
self.playerState = playerState
updateViewWithPlayerState(playerState)
}
func playerStateDidChange(_ playerState: SPTAppRemotePlayerState) {
self.playerState = playerState
updateViewWithPlayerState(playerState)
}
}
// MARK: - SPTAppRemoteUserAPIDelegate
extension ViewController: SPTAppRemoteUserAPIDelegate {
Expand Down
Loading

0 comments on commit c7757b8

Please sign in to comment.