@wwdrew/expo-spotify-sdk 2.1.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -2
- package/android/build.gradle +4 -5
- package/android/libs/SETUP.md +9 -24
- package/android/spotify-native-sdk.gradle +118 -0
- package/android/src/main/java/expo/modules/spotifysdk/ExpoSpotifySDKModule.kt +12 -1
- package/android/src/main/java/expo/modules/spotifysdk/SpotifyAppRemoteCoordinator.kt +32 -0
- package/build/app-remote/index.d.ts +34 -0
- package/build/app-remote/index.d.ts.map +1 -1
- package/build/app-remote/index.js +36 -0
- package/build/app-remote/index.js.map +1 -1
- package/ios/ExpoSpotifyAppDelegate.swift +8 -1
- package/ios/ExpoSpotifySDK.podspec +26 -2
- package/ios/ExpoSpotifySDKModule.swift +16 -1
- package/ios/SpotifyAppRemoteCoordinator.swift +108 -0
- package/ios/spotify-native-sdk-versions.json +12 -0
- package/package.json +10 -4
- package/ios/SpotifySDK/Licenses/MPMessagePack-LICENSE.md +0 -20
- package/ios/SpotifySDK/SpotifyiOS.xcframework/Info.plist +0 -40
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTAppRemote.h +0 -287
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTAppRemoteAlbum.h +0 -18
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTAppRemoteArtist.h +0 -18
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTAppRemoteCommon.h +0 -37
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTAppRemoteConnectionParams.h +0 -65
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTAppRemoteConnectivityAPI.h +0 -55
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTAppRemoteConnectivityState.h +0 -15
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTAppRemoteContentAPI.h +0 -78
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTAppRemoteContentItem.h +0 -49
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTAppRemoteCrossfadeState.h +0 -18
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTAppRemoteImageAPI.h +0 -25
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTAppRemoteImageRepresentable.h +0 -16
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTAppRemoteLibraryState.h +0 -19
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTAppRemotePlaybackOptions.h +0 -32
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTAppRemotePlaybackRestrictions.h +0 -32
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTAppRemotePlayerAPI.h +0 -267
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTAppRemotePlayerState.h +0 -40
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTAppRemotePodcastPlaybackSpeed.h +0 -15
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTAppRemoteTrack.h +0 -52
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTAppRemoteUserAPI.h +0 -102
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTAppRemoteUserCapabilities.h +0 -15
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTConfiguration.h +0 -66
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTError.h +0 -31
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTLogin.h +0 -10
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTMacros.h +0 -125
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTScope.h +0 -75
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTSession.h +0 -33
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTSessionManager.h +0 -170
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SpotifyAppRemote.h +0 -28
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SpotifyiOS.h +0 -7
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Info.plist +0 -0
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Modules/module.modulemap +0 -5
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/PrivacyInfo.xcprivacy +0 -14
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/SpotifyiOS +0 -0
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemote.h +0 -287
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemoteAlbum.h +0 -18
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemoteArtist.h +0 -18
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemoteCommon.h +0 -37
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemoteConnectionParams.h +0 -65
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemoteConnectivityAPI.h +0 -55
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemoteConnectivityState.h +0 -15
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemoteContentAPI.h +0 -78
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemoteContentItem.h +0 -49
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemoteCrossfadeState.h +0 -18
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemoteImageAPI.h +0 -25
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemoteImageRepresentable.h +0 -16
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemoteLibraryState.h +0 -19
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemotePlaybackOptions.h +0 -32
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemotePlaybackRestrictions.h +0 -32
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemotePlayerAPI.h +0 -267
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemotePlayerState.h +0 -40
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemotePodcastPlaybackSpeed.h +0 -15
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemoteTrack.h +0 -52
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemoteUserAPI.h +0 -102
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemoteUserCapabilities.h +0 -15
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SPTConfiguration.h +0 -66
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SPTError.h +0 -31
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SPTLogin.h +0 -10
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SPTMacros.h +0 -125
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SPTScope.h +0 -75
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SPTSession.h +0 -33
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SPTSessionManager.h +0 -170
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SpotifyAppRemote.h +0 -28
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SpotifyiOS.h +0 -7
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Info.plist +0 -0
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Modules/module.modulemap +0 -5
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/PrivacyInfo.xcprivacy +0 -14
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/SpotifyiOS +0 -0
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
#import "SPTAppRemoteImageRepresentable.h"
|
|
2
|
-
|
|
3
|
-
@protocol SPTAppRemoteAlbum;
|
|
4
|
-
@protocol SPTAppRemoteArtist;
|
|
5
|
-
|
|
6
|
-
NS_ASSUME_NONNULL_BEGIN
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* The `SPTAppRemoteTrack` represents a track.
|
|
10
|
-
*/
|
|
11
|
-
@protocol SPTAppRemoteTrack <NSObject, SPTAppRemoteImageRepresentable>
|
|
12
|
-
|
|
13
|
-
/// The name of the track.
|
|
14
|
-
@property (nonatomic, copy, readonly) NSString *name;
|
|
15
|
-
|
|
16
|
-
/// The URI of the track.
|
|
17
|
-
@property (nonatomic, copy, readonly) NSString *URI;
|
|
18
|
-
|
|
19
|
-
/// The duration of the track in miliseconds.
|
|
20
|
-
@property (nonatomic, assign, readonly) NSUInteger duration;
|
|
21
|
-
|
|
22
|
-
/// The artist of the track.
|
|
23
|
-
@property (nonatomic, strong, readonly) id<SPTAppRemoteArtist> artist;
|
|
24
|
-
|
|
25
|
-
/// The album of the track.
|
|
26
|
-
@property (nonatomic, strong, readonly) id<SPTAppRemoteAlbum> album;
|
|
27
|
-
|
|
28
|
-
/// `YES` if the user has saved the track, otherwise `NO`.
|
|
29
|
-
@property (nonatomic, assign, readonly, getter=isSaved) BOOL saved;
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* `YES` if the track is a podcast, video, or other audio episode, otherwise `NO`.
|
|
33
|
-
* If the track is an episode and `SPTAppRemotePlaybackRestrictions` `canSeek` is `YES` you should show
|
|
34
|
-
* 15 second skip buttons in your UI.
|
|
35
|
-
*/
|
|
36
|
-
@property (nonatomic, assign, readonly, getter=isEpisode) BOOL episode;
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* `YES` if the track is a podcast, otherwise `NO`.
|
|
40
|
-
* If the track is a podcast and `SPTAppRemotePlaybackRestrictions` `canSeek` is `YES` you should show
|
|
41
|
-
* 15 second skip buttons in your UI as well as a podcast speed control to change playback speed.
|
|
42
|
-
*/
|
|
43
|
-
@property (nonatomic, assign, readonly, getter=isPodcast) BOOL podcast;
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* `YES` if the track is an ad, otherwise `NO`.
|
|
47
|
-
*/
|
|
48
|
-
@property (nonatomic, assign, readonly, getter=isAdvertisement) BOOL advertisement;
|
|
49
|
-
|
|
50
|
-
@end
|
|
51
|
-
|
|
52
|
-
NS_ASSUME_NONNULL_END
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
#import <Foundation/Foundation.h>
|
|
2
|
-
#import "SPTAppRemoteCommon.h"
|
|
3
|
-
|
|
4
|
-
@protocol SPTAppRemoteUserAPI;
|
|
5
|
-
@protocol SPTAppRemoteUserCapabilities;
|
|
6
|
-
|
|
7
|
-
NS_ASSUME_NONNULL_BEGIN
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* The `SPTAppRemoteUserAPIDelegate` gets notified whenever the user API receives new data from subscription events.
|
|
11
|
-
*/
|
|
12
|
-
@protocol SPTAppRemoteUserAPIDelegate <NSObject>
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Called when the capabilities has been updated.
|
|
16
|
-
*
|
|
17
|
-
* @note This will only be called if there is an active capabilities subscription.
|
|
18
|
-
*
|
|
19
|
-
* @param userAPI The API that received updates.
|
|
20
|
-
* @param capabilities The new capabilities that was received.
|
|
21
|
-
*/
|
|
22
|
-
- (void)userAPI:(id<SPTAppRemoteUserAPI>)userAPI didReceiveCapabilities:(id<SPTAppRemoteUserCapabilities>)capabilities;
|
|
23
|
-
|
|
24
|
-
@end
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* The `SPTAppRemoteUserAPI` is used to get user data from, and interact with user features in, the Spotify app.
|
|
28
|
-
*/
|
|
29
|
-
@protocol SPTAppRemoteUserAPI <NSObject>
|
|
30
|
-
|
|
31
|
-
/// The User API delegate gets notified whenever the API receives new data from subscription events.
|
|
32
|
-
@property (nonatomic, weak, readwrite) id<SPTAppRemoteUserAPIDelegate> delegate;
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Fetches the current users capabilities from the Spotify app.
|
|
36
|
-
*
|
|
37
|
-
* @param callback A callback block that will be invoked when the fetch request has completed.
|
|
38
|
-
* On success `result` will be an instance of `id<SPTAppRemoteUserCapabilities>`.
|
|
39
|
-
* On error `result` will be `nil` and `error` will be set.
|
|
40
|
-
*/
|
|
41
|
-
- (void)fetchCapabilitiesWithCallback:(nullable SPTAppRemoteCallback)callback;
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Subscribes to capability changes from the Spotify app.
|
|
45
|
-
*
|
|
46
|
-
* @note Implement `SPTAppRemoteUserAPIDelegate` and set yourself as `delegate` in order to be notified when the
|
|
47
|
-
* the capabilities changes.
|
|
48
|
-
*
|
|
49
|
-
* @param callback A callback block that will be invoked when the subscription request has completed.
|
|
50
|
-
* On success `result` will `YES`.
|
|
51
|
-
* On error `result` will be `nil` and `error` will be set.
|
|
52
|
-
*/
|
|
53
|
-
- (void)subscribeToCapabilityChanges:(nullable SPTAppRemoteCallback)callback;
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Stops subscribing to capability changes from the Spotify app.
|
|
57
|
-
*
|
|
58
|
-
* @param callback A callback block that will be invoked when the unsubscription request has completed.
|
|
59
|
-
* On success `result` will be `YES`.
|
|
60
|
-
* On error `result` will be `nil` and `error` will be set.
|
|
61
|
-
*/
|
|
62
|
-
- (void)unsubscribeToCapabilityChanges:(nullable SPTAppRemoteCallback)callback;
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Fetches the current users library state for a given album or track uri.
|
|
66
|
-
*
|
|
67
|
-
* @param URI The URI of the album or track we are fetching the state for
|
|
68
|
-
* @param callback A callback block that will be invoked when the fetch request has completed.
|
|
69
|
-
* On success `result` will be an instance of `id<SPTAppRemoteLibraryState>`.
|
|
70
|
-
* On error `result` will be `nil` and `error` will be set.
|
|
71
|
-
*/
|
|
72
|
-
- (void)fetchLibraryStateForURI:(NSString *)URI callback:(SPTAppRemoteCallback)callback;
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Add item to the users library.
|
|
76
|
-
* Currently supported uris include:
|
|
77
|
-
* Tracks - example: spotify:track:6rqhFgbbKwnb9MLmUQDhG6
|
|
78
|
-
* Albums - example: spotify:album:2VYSDvc0ZdcfkXDcYVjHs6
|
|
79
|
-
*
|
|
80
|
-
* @param URI The URI of the item to save
|
|
81
|
-
* @param callback A callback block that will be invoked when the fetch request has completed.
|
|
82
|
-
* On success `result` will be an instance of `id<SPTAppRemoteLibraryState>` that indicates the
|
|
83
|
-
* resulting state of the entity. On error `result` will be `nil` and `error` will be set.
|
|
84
|
-
*/
|
|
85
|
-
- (void)addItemToLibraryWithURI:(NSString *)URI callback:(nullable SPTAppRemoteCallback)callback;
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* Remove item from users library.
|
|
89
|
-
* Currently supported uris include:
|
|
90
|
-
* Tracks - example: spotify:track:6rqhFgbbKwnb9MLmUQDhG6
|
|
91
|
-
* Albums - example: spotify:album:2VYSDvc0ZdcfkXDcYVjHs6
|
|
92
|
-
*
|
|
93
|
-
* @param URI The URI of the item to remove
|
|
94
|
-
* @param callback A callback block that will be invoked when the fetch request has completed.
|
|
95
|
-
* On success `result` will be an instance of `id<SPTAppRemoteLibraryState>` that indicates the
|
|
96
|
-
* resulting state of the entity. On error `result` will be `nil` and `error` will be set.
|
|
97
|
-
*/
|
|
98
|
-
- (void)removeItemFromLibraryWithURI:(NSString *)URI callback:(nullable SPTAppRemoteCallback)callback;
|
|
99
|
-
|
|
100
|
-
@end
|
|
101
|
-
|
|
102
|
-
NS_ASSUME_NONNULL_END
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
#import <Foundation/Foundation.h>
|
|
2
|
-
|
|
3
|
-
NS_ASSUME_NONNULL_BEGIN
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* The `SPTAppRemoteUserCapabilities` represents a set of capabilities the current user has in the Spotify app.
|
|
7
|
-
*/
|
|
8
|
-
@protocol SPTAppRemoteUserCapabilities <NSObject>
|
|
9
|
-
|
|
10
|
-
/// `YES` if the user can play songs on demand, otherwise `NO`. This will differ for premium and non-premium users
|
|
11
|
-
@property (nonatomic, assign, readonly) BOOL canPlayOnDemand;
|
|
12
|
-
|
|
13
|
-
@end
|
|
14
|
-
|
|
15
|
-
NS_ASSUME_NONNULL_END
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
#import <Foundation/Foundation.h>
|
|
2
|
-
|
|
3
|
-
NS_ASSUME_NONNULL_BEGIN
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
A configuration class, holding the credentials provided for your app on the Spotify Developer website.
|
|
7
|
-
See https://developer.spotify.com/my-applications/
|
|
8
|
-
*/
|
|
9
|
-
@interface SPTConfiguration : NSObject <NSSecureCoding>
|
|
10
|
-
|
|
11
|
-
/// Your app's Client ID from developer.spotify.com
|
|
12
|
-
@property (nonatomic, readonly, copy) NSString *clientID;
|
|
13
|
-
|
|
14
|
-
/// Your redirect URL. This is how the Spotify app will open your application after user authorization.
|
|
15
|
-
@property (nonatomic, readonly, copy) NSURL *redirectURL;
|
|
16
|
-
|
|
17
|
-
/// Name of the company
|
|
18
|
-
@property (nonatomic, nullable, copy) NSString *companyName;
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
The URL to use for attempting to swap an authorization code for an access token. You should only set this if your
|
|
22
|
-
clientID has a clientSecret and you have a backend service that holds the secret and can exchange the code and secret
|
|
23
|
-
for an access token.
|
|
24
|
-
*/
|
|
25
|
-
@property (nonatomic, nullable, copy) NSURL *tokenSwapURL;
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
The URL to use for attempting to renew an access token with a refresh token. You should only set this if your
|
|
29
|
-
clientID has a clientSecret and you have a backend service that holds the secret and can use a refresh token
|
|
30
|
-
to get a new access token.
|
|
31
|
-
*/
|
|
32
|
-
@property (nonatomic, nullable, copy) NSURL *tokenRefreshURL;
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
If requesting the `SPTAppRemoteControlScope` you can provide an optional uri to begin playing after a successful
|
|
36
|
-
authentication. To continue the user's last session set this to a blank string @"". If this value is `nil` or
|
|
37
|
-
`SPTAppRemoteControlScope` is not requested no audio will play. If Spotify is already playing it will continue playing
|
|
38
|
-
even though a URI is provided.
|
|
39
|
-
*/
|
|
40
|
-
@property (nonatomic, nullable, copy) NSString *playURI;
|
|
41
|
-
|
|
42
|
-
- (instancetype)init NS_UNAVAILABLE;
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
Designated initializer for `SPTConfiguration`
|
|
46
|
-
|
|
47
|
-
@param clientID Your client ID obtained from developer.spotify.com
|
|
48
|
-
@param redirectURL Your redirect URL for Spotify to open your app again after authorization
|
|
49
|
-
@return A newly initialized `SPTConfiguration`
|
|
50
|
-
*/
|
|
51
|
-
- (instancetype)initWithClientID:(NSString *)clientID redirectURL:(NSURL *)redirectURL NS_DESIGNATED_INITIALIZER;
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
Convenience initializer for `SPTConfiguration`
|
|
55
|
-
|
|
56
|
-
@param clientID Your client ID obtained from developer.spotify.com
|
|
57
|
-
@param redirectURL Your redirect URL for Spotify to open your app again after authorization
|
|
58
|
-
@return A newly initialized `SPTConfiguration`
|
|
59
|
-
*/
|
|
60
|
-
+ (instancetype)configurationWithClientID:(NSString *)clientID
|
|
61
|
-
redirectURL:(NSURL *)redirectURL NS_SWIFT_UNAVAILABLE("superfluous");
|
|
62
|
-
|
|
63
|
-
@end
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
NS_ASSUME_NONNULL_END
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
#import <Foundation/Foundation.h>
|
|
2
|
-
|
|
3
|
-
#import "SPTMacros.h"
|
|
4
|
-
|
|
5
|
-
NS_ASSUME_NONNULL_BEGIN
|
|
6
|
-
|
|
7
|
-
SPT_EXPORT NSErrorDomain const SPTLoginErrorDomain;
|
|
8
|
-
|
|
9
|
-
/// Spotify error codes, use NSUnderlyingErrorKey to see the underlying error
|
|
10
|
-
typedef NS_ENUM(NSUInteger, SPTErrorCode) {
|
|
11
|
-
/// Unknown error code
|
|
12
|
-
SPTUnknownErrorCode NS_SWIFT_NAME(unknown) = 0,
|
|
13
|
-
/// Authorization failed
|
|
14
|
-
SPTAuthorizationFailedErrorCode NS_SWIFT_NAME(authorizationFailed),
|
|
15
|
-
/// Renew session failed
|
|
16
|
-
SPTRenewSessionFailedErrorCode NS_SWIFT_NAME(renewSessionFailed),
|
|
17
|
-
/// Failed to parse the returned JSON
|
|
18
|
-
SPTJSONFailedErrorCode NS_SWIFT_NAME(jsonFailed) };
|
|
19
|
-
|
|
20
|
-
/// Spotify-specific errors. Use NSUnderlyingErrorKey to see the underlying error
|
|
21
|
-
@interface SPTError : NSError
|
|
22
|
-
|
|
23
|
-
+ (instancetype)errorWithCode:(SPTErrorCode)code;
|
|
24
|
-
|
|
25
|
-
+ (instancetype)errorWithCode:(SPTErrorCode)code description:(NSString *)description;
|
|
26
|
-
|
|
27
|
-
+ (instancetype)errorWithCode:(SPTErrorCode)code underlyingError:(NSError *)error;
|
|
28
|
-
|
|
29
|
-
@end
|
|
30
|
-
|
|
31
|
-
NS_ASSUME_NONNULL_END
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
#ifndef SPT_MACROS
|
|
2
|
-
#define SPT_MACROS
|
|
3
|
-
|
|
4
|
-
#ifdef __cplusplus
|
|
5
|
-
#define SPT_EXPORT extern "C" __attribute__((visibility("default")))
|
|
6
|
-
#else
|
|
7
|
-
#define SPT_EXPORT extern __attribute__((visibility("default")))
|
|
8
|
-
#endif // __cplusplus
|
|
9
|
-
|
|
10
|
-
#define SPT_DEPRECATED(MESSAGE) __attribute__((deprecated(MESSAGE)))
|
|
11
|
-
#define SPT_UNAVAILABLE __attribute__((unavailable))
|
|
12
|
-
#define SPT_UNUSED __attribute__((unused))
|
|
13
|
-
#define SPT_UNREACHABLE() __builtin_unreachable()
|
|
14
|
-
|
|
15
|
-
#define SPT_INLINE __attribute__((always_inline)) inline
|
|
16
|
-
#define SPT_CONST __attribute__((const))
|
|
17
|
-
#define SPT_PURE __attribute__((pure))
|
|
18
|
-
|
|
19
|
-
#define SPT_NONNULL __attribute__((nonnull))
|
|
20
|
-
#define SPT_RETURNS_NONNULL __attribute__((returns_nonnull))
|
|
21
|
-
|
|
22
|
-
#define SPT_EXPECT(EXPR, VAL) __builtin_expect(!!(EXPR), VAL)
|
|
23
|
-
#define SPT_LIKELY(EXPR) SPT_EXPECT(EXPR, 1)
|
|
24
|
-
#define SPT_UNLIKELY(EXPR) SPT_EXPECT(EXPR, 0)
|
|
25
|
-
|
|
26
|
-
#define SPT_MAX_POW2(TYPE_MAX) ((TYPE_MAX >> 1) ^ TYPE_MAX)
|
|
27
|
-
|
|
28
|
-
#define SPT_EXPR_OR_ZERO(EXPR) __builtin_choose_expr(SPT_TYPE_IS_VOID(EXPR), 0, (EXPR))
|
|
29
|
-
#define SPT_TYPE_IS_VOID(EXPR) __builtin_types_compatible_p(typeof(EXPR), void)
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
Check if the receiver responds to a selector, then send the message,
|
|
33
|
-
along with the provided parameters.
|
|
34
|
-
|
|
35
|
-
The purpose of this macro, other than to make code less cluttered, is to make
|
|
36
|
-
it impossible to accidentally check for a selector but send a different message.
|
|
37
|
-
|
|
38
|
-
@param RECEIVER The object to which the message will be sent.
|
|
39
|
-
@param RESULT[out] A pointer to which the return value will be assigned.
|
|
40
|
-
@param ... 0-4 arguments.
|
|
41
|
-
\code{.m}
|
|
42
|
-
BOOL result = NO;
|
|
43
|
-
SPT_OPTIONAL_MESSAGE_SEND(self.delegate, &result, someThingie, self, didSomethingWith, someObject);
|
|
44
|
-
// Expands to the following:
|
|
45
|
-
do {
|
|
46
|
-
if ([self.delegate respondsToSelector:@selector(someThingie:didSomethingWith:)])
|
|
47
|
-
*(result) = [self.delegate someThingie:self didSomethingWith:someObject)];
|
|
48
|
-
} while (0);
|
|
49
|
-
\endcode
|
|
50
|
-
*/
|
|
51
|
-
#define SPT_OPTIONAL_MESSAGE_SEND(RECEIVER, RESULT, ...) \
|
|
52
|
-
do { \
|
|
53
|
-
if ([RECEIVER respondsToSelector:@selector(SPT_CONCAT_SELECTOR(__VA_ARGS__))]) \
|
|
54
|
-
*(RESULT) = [RECEIVER SPT_CONCAT_METHOD(__VA_ARGS__)]; \
|
|
55
|
-
} while (0)
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
Like SPT_OPTIONAL_MESSAGE_SEND but ignores the return value.
|
|
59
|
-
@param RECEIVER The object to which the message will be sent.
|
|
60
|
-
@param ... 0-4 arguments.
|
|
61
|
-
*/
|
|
62
|
-
#define SPT_OPTIONAL_MESSAGE_SEND_(RECEIVER, ...) \
|
|
63
|
-
do { \
|
|
64
|
-
if ([RECEIVER respondsToSelector:@selector(SPT_CONCAT_SELECTOR(__VA_ARGS__))]) \
|
|
65
|
-
[RECEIVER SPT_CONCAT_METHOD(__VA_ARGS__)]; \
|
|
66
|
-
} while (0)
|
|
67
|
-
|
|
68
|
-
// Some boilerplate for SPT_OPTIONAL_MESSAGE_SEND[_]
|
|
69
|
-
#define SPT_CONCAT_METHOD8(A, _1, B, _2, C, _3, D, _4) \
|
|
70
|
-
A: \
|
|
71
|
-
_1 B : _2 C : _3 D : _4
|
|
72
|
-
#define SPT_CONCAT_METHOD6(A, _1, B, _2, C, _3) \
|
|
73
|
-
A: \
|
|
74
|
-
_1 B : _2 C : _3
|
|
75
|
-
#define SPT_CONCAT_METHOD4(A, _1, B, _2) \
|
|
76
|
-
A: \
|
|
77
|
-
_1 B : _2
|
|
78
|
-
#define SPT_CONCAT_METHOD2(A, _1) \
|
|
79
|
-
A: \
|
|
80
|
-
_1
|
|
81
|
-
#define SPT_CONCAT_METHOD1(A) A
|
|
82
|
-
|
|
83
|
-
#define SPT_CONCAT_SELECTOR8(A, _1, B, _2, C, _3, D, _4) \
|
|
84
|
-
A: \
|
|
85
|
-
B: \
|
|
86
|
-
C: \
|
|
87
|
-
D:
|
|
88
|
-
#define SPT_CONCAT_SELECTOR6(A, _1, B, _2, C, _3) \
|
|
89
|
-
A: \
|
|
90
|
-
B: \
|
|
91
|
-
C:
|
|
92
|
-
#define SPT_CONCAT_SELECTOR4(A, _1, B, _2) \
|
|
93
|
-
A: \
|
|
94
|
-
B:
|
|
95
|
-
#define SPT_CONCAT_SELECTOR2(A, _1) \
|
|
96
|
-
A:
|
|
97
|
-
#define SPT_CONCAT_SELECTOR1(A) A
|
|
98
|
-
|
|
99
|
-
#define SPT_PICK_CONCAT_MACRO(_1, _2, _3, _4, _5, _6, _7, _8, NAME, ...) NAME
|
|
100
|
-
|
|
101
|
-
#define SPT_CONCAT_METHOD(...) \
|
|
102
|
-
SPT_PICK_CONCAT_MACRO(__VA_ARGS__, \
|
|
103
|
-
SPT_CONCAT_METHOD8, \
|
|
104
|
-
SPT_CONCAT_METHOD7, \
|
|
105
|
-
SPT_CONCAT_METHOD6, \
|
|
106
|
-
SPT_CONCAT_METHOD5, \
|
|
107
|
-
SPT_CONCAT_METHOD4, \
|
|
108
|
-
SPT_CONCAT_METHOD3, \
|
|
109
|
-
SPT_CONCAT_METHOD2, \
|
|
110
|
-
SPT_CONCAT_METHOD1) \
|
|
111
|
-
(__VA_ARGS__)
|
|
112
|
-
|
|
113
|
-
#define SPT_CONCAT_SELECTOR(...) \
|
|
114
|
-
SPT_PICK_CONCAT_MACRO(__VA_ARGS__, \
|
|
115
|
-
SPT_CONCAT_SELECTOR8, \
|
|
116
|
-
SPT_CONCAT_SELECTOR7, \
|
|
117
|
-
SPT_CONCAT_SELECTOR6, \
|
|
118
|
-
SPT_CONCAT_SELECTOR5, \
|
|
119
|
-
SPT_CONCAT_SELECTOR4, \
|
|
120
|
-
SPT_CONCAT_SELECTOR3, \
|
|
121
|
-
SPT_CONCAT_SELECTOR2, \
|
|
122
|
-
SPT_CONCAT_SELECTOR1) \
|
|
123
|
-
(__VA_ARGS__)
|
|
124
|
-
|
|
125
|
-
#endif // SPT_MACROS
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
#import <Foundation/Foundation.h>
|
|
2
|
-
|
|
3
|
-
// (Objective-C identifier, Swift name, string value, bit flag)
|
|
4
|
-
#define SPT_SCOPE_LIST \
|
|
5
|
-
SPT_SCOPE(SPTPlaylistReadPrivateScope, playlistReadPrivate, "playlist-read-private", (1 << 0)) \
|
|
6
|
-
SPT_SCOPE(SPTPlaylistReadCollaborativeScope, playlistReadCollaborative, "playlist-read-collaborative", (1 << 1)) \
|
|
7
|
-
SPT_SCOPE(SPTPlaylistModifyPublicScope, playlistModifyPublic, "playlist-modify-public", (1 << 2)) \
|
|
8
|
-
SPT_SCOPE(SPTPlaylistModifyPrivateScope, playlistModifyPrivate, "playlist-modify-private", (1 << 3)) \
|
|
9
|
-
SPT_SCOPE(SPTUserFollowReadScope, userFollowRead, "user-follow-read", (1 << 4)) \
|
|
10
|
-
SPT_SCOPE(SPTUserFollowModifyScope, userFollowModify, "user-follow-modify", (1 << 5)) \
|
|
11
|
-
SPT_SCOPE(SPTUserLibraryReadScope, userLibraryRead, "user-library-read", (1 << 6)) \
|
|
12
|
-
SPT_SCOPE(SPTUserLibraryModifyScope, userLibraryModify, "user-library-modify", (1 << 7)) \
|
|
13
|
-
SPT_SCOPE(SPTUserReadBirthDateScope, userReadBirthDate, "user-read-birthdate", (1 << 8)) \
|
|
14
|
-
SPT_SCOPE(SPTUserReadEmailScope, userReadEmail, "user-read-email", (1 << 9)) \
|
|
15
|
-
SPT_SCOPE(SPTUserReadPrivateScope, userReadPrivate, "user-read-private", (1 << 10)) \
|
|
16
|
-
SPT_SCOPE(SPTUserTopReadScope, userTopRead, "user-top-read", (1 << 11)) \
|
|
17
|
-
SPT_SCOPE(SPTUGCImageUploadScope, ugcImageUpload, "ugc-image-upload", (1 << 12)) \
|
|
18
|
-
SPT_SCOPE(SPTStreamingScope, streaming, "streaming", (1 << 13)) \
|
|
19
|
-
SPT_SCOPE(SPTAppRemoteControlScope, appRemoteControl, "app-remote-control", (1 << 14)) \
|
|
20
|
-
SPT_SCOPE(SPTUserReadPlaybackStateScope, userReadPlaybackState, "user-read-playback-state", (1 << 15)) \
|
|
21
|
-
SPT_SCOPE(SPTUserModifyPlaybackStateScope, userModifyPlaybackState, "user-modify-playback-state", (1 << 16)) \
|
|
22
|
-
SPT_SCOPE(SPTUserReadCurrentlyPlayingScope, userReadCurrentlyPlaying, "user-read-currently-playing", (1 << 17)) \
|
|
23
|
-
SPT_SCOPE(SPTUserReadRecentlyPlayedScope, userReadRecentlyPlayed, "user-read-recently-played", (1 << 18)) \
|
|
24
|
-
SPT_SCOPE(SPTOpenIdScope, openid, "openid", (1 << 19))
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
`SPTScope` represents the OAuth scopes that declare how your app wants to access a user's account.
|
|
28
|
-
See https://developer.spotify.com/web-api/using-scopes/ for more information.
|
|
29
|
-
*/
|
|
30
|
-
typedef NS_OPTIONS(NSUInteger, SPTScope) {
|
|
31
|
-
/// Read access to user's private playlists.
|
|
32
|
-
SPTPlaylistReadPrivateScope NS_SWIFT_NAME(playlistReadPrivate) = (1 << 0),
|
|
33
|
-
/// Include collaborative playlists when requesting a user's playlists.
|
|
34
|
-
SPTPlaylistReadCollaborativeScope NS_SWIFT_NAME(playlistReadCollaborative) = (1 << 1),
|
|
35
|
-
/// Write access to a user's public playlists.
|
|
36
|
-
SPTPlaylistModifyPublicScope NS_SWIFT_NAME(playlistModifyPublic) = (1 << 2),
|
|
37
|
-
/// Write access to a user's private playlists.
|
|
38
|
-
SPTPlaylistModifyPrivateScope NS_SWIFT_NAME(playlistModifyPrivate) = (1 << 3),
|
|
39
|
-
/// Read access to the list of artists and other users that the user follows.
|
|
40
|
-
SPTUserFollowReadScope NS_SWIFT_NAME(userFollowRead) = (1 << 4),
|
|
41
|
-
/// Write/delete access to the list of artists and other users that the user follows.
|
|
42
|
-
SPTUserFollowModifyScope NS_SWIFT_NAME(userFollowModify) = (1 << 5),
|
|
43
|
-
/// Read access to a user's "Your Music" library.
|
|
44
|
-
SPTUserLibraryReadScope NS_SWIFT_NAME(userLibraryRead) = (1 << 6),
|
|
45
|
-
/// Write/delete access to a user's "Your Music" library.
|
|
46
|
-
SPTUserLibraryModifyScope NS_SWIFT_NAME(userLibraryModify) = (1 << 7),
|
|
47
|
-
/// Read access to the user's birthdate.
|
|
48
|
-
SPTUserReadBirthDateScope NS_SWIFT_NAME(userReadBirthDate) = (1 << 8),
|
|
49
|
-
/// Read access to user’s email address.
|
|
50
|
-
SPTUserReadEmailScope NS_SWIFT_NAME(userReadEmail) = (1 << 9),
|
|
51
|
-
/// Read access to user’s subscription details (type of user account).
|
|
52
|
-
SPTUserReadPrivateScope NS_SWIFT_NAME(userReadPrivate) = (1 << 10),
|
|
53
|
-
/// Read access to a user's top artists and tracks.
|
|
54
|
-
SPTUserTopReadScope NS_SWIFT_NAME(userTopRead) = (1 << 11),
|
|
55
|
-
/// Upload user generated content images
|
|
56
|
-
SPTUGCImageUploadScope NS_SWIFT_NAME(ugcImageUpload) = (1 << 12),
|
|
57
|
-
/// Control playback of a Spotify track.
|
|
58
|
-
SPTStreamingScope NS_SWIFT_NAME(streaming) = (1 << 13),
|
|
59
|
-
/// Use App Remote to control playback in the Spotify app
|
|
60
|
-
SPTAppRemoteControlScope NS_SWIFT_NAME(appRemoteControl) = (1 << 14),
|
|
61
|
-
/// Read access to a user’s player state.
|
|
62
|
-
SPTUserReadPlaybackStateScope NS_SWIFT_NAME(userReadPlaybackState) = (1 << 15),
|
|
63
|
-
/// Write access to a user’s playback state
|
|
64
|
-
SPTUserModifyPlaybackStateScope NS_SWIFT_NAME(userModifyPlaybackState) = (1 << 16),
|
|
65
|
-
/// Read access to a user’s currently playing
|
|
66
|
-
/// track
|
|
67
|
-
SPTUserReadCurrentlyPlayingScope NS_SWIFT_NAME(userReadCurrentlyPlaying) = (1 << 17),
|
|
68
|
-
/// Read access to a user’s currently
|
|
69
|
-
/// playing track
|
|
70
|
-
SPTUserReadRecentlyPlayedScope NS_SWIFT_NAME(userReadRecentlyPlayed) = (1 << 18),
|
|
71
|
-
/// Indicate that the application
|
|
72
|
-
/// intends to use OIDC to verify the
|
|
73
|
-
/// user's identity
|
|
74
|
-
SPTOpenIdScope NS_SWIFT_NAME(openid) = (1 << 19),
|
|
75
|
-
};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
#import "SPTScope.h"
|
|
2
|
-
|
|
3
|
-
NS_ASSUME_NONNULL_BEGIN
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
/// The `SPTSession` represents an authenticated Spotify user session.
|
|
7
|
-
@interface SPTSession : NSObject <NSSecureCoding>
|
|
8
|
-
|
|
9
|
-
/// The access token of the authenticated user.
|
|
10
|
-
@property (nonatomic, readonly, copy) NSString *accessToken;
|
|
11
|
-
|
|
12
|
-
/// The refresh token.
|
|
13
|
-
@property (nonatomic, readonly, copy) NSString *refreshToken;
|
|
14
|
-
|
|
15
|
-
/// The expiration date of the access token.
|
|
16
|
-
@property (nonatomic, readonly, copy) NSDate *expirationDate;
|
|
17
|
-
|
|
18
|
-
/// The scope granted.
|
|
19
|
-
@property (nonatomic, readonly) SPTScope scope;
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
Check whether the session has expired. `YES` if expired; `NO` otherwise.
|
|
23
|
-
Note: The session is considered expired once the current date and time is equal to or greater than the expiration date
|
|
24
|
-
and time.
|
|
25
|
-
*/
|
|
26
|
-
@property (nonatomic, readonly, getter=isExpired) BOOL expired;
|
|
27
|
-
|
|
28
|
-
- (instancetype)init NS_UNAVAILABLE;
|
|
29
|
-
|
|
30
|
-
@end
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
NS_ASSUME_NONNULL_END
|