@wwdrew/expo-spotify-sdk 0.4.3 → 0.6.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/LICENSE +21 -3
- package/README.md +345 -96
- package/android/build.gradle +28 -22
- package/android/consumer-rules.pro +8 -0
- package/android/src/main/AndroidManifest.xml +3 -0
- package/android/src/main/java/expo/modules/spotifysdk/ExpoSpotifySDKModule.kt +130 -145
- package/android/src/main/java/expo/modules/spotifysdk/SpotifyAuthCoordinator.kt +36 -0
- package/android/src/main/java/expo/modules/spotifysdk/SpotifyAuthorizationContract.kt +45 -0
- package/android/src/main/java/expo/modules/spotifysdk/SpotifyConfig.kt +80 -0
- package/android/src/main/java/expo/modules/spotifysdk/SpotifyErrors.kt +34 -0
- package/android/src/main/java/expo/modules/spotifysdk/SpotifyTokenSwapClient.kt +154 -0
- package/build/ExpoSpotifySDK.types.d.ts +76 -1
- package/build/ExpoSpotifySDK.types.d.ts.map +1 -1
- package/build/ExpoSpotifySDK.types.js +12 -1
- package/build/ExpoSpotifySDK.types.js.map +1 -1
- package/build/ExpoSpotifySDKModule.web.d.ts +7 -3
- package/build/ExpoSpotifySDKModule.web.d.ts.map +1 -1
- package/build/ExpoSpotifySDKModule.web.js +17 -7
- package/build/ExpoSpotifySDKModule.web.js.map +1 -1
- package/build/index.d.ts +39 -2
- package/build/index.d.ts.map +1 -1
- package/build/index.js +117 -4
- package/build/index.js.map +1 -1
- package/expo-module.config.json +1 -1
- package/ios/ExpoSpotifyAppDelegate.swift +14 -0
- package/ios/ExpoSpotifyConfiguration.swift +33 -15
- package/ios/ExpoSpotifySDK.podspec +2 -4
- package/ios/ExpoSpotifySDKModule.swift +96 -26
- package/ios/SPTScopeSerializer.swift +40 -39
- package/ios/SpotifyAuthCoordinator.swift +133 -0
- package/ios/SpotifySDK/SpotifyiOS.xcframework/Info.plist +5 -9
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTAppRemote.h +43 -41
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTAppRemoteCommon.h +9 -8
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTAppRemoteConnectivityAPI.h +4 -3
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTAppRemoteContentAPI.h +8 -6
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTAppRemoteContentItem.h +3 -3
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTAppRemoteImageAPI.h +3 -3
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTAppRemotePlayerAPI.h +12 -7
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTAppRemoteUserAPI.h +4 -5
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTConfiguration.h +5 -5
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTError.h +7 -9
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTMacros.h +59 -23
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTScope.h +67 -63
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTSession.h +2 -1
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTSessionManager.h +59 -19
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SpotifyAppRemote.h +11 -15
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SpotifyiOS.h +1 -1
- 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 -1
- 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 +43 -41
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemoteCommon.h +9 -8
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemoteConnectivityAPI.h +4 -3
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemoteContentAPI.h +8 -6
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemoteContentItem.h +3 -3
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemoteImageAPI.h +3 -3
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemotePlayerAPI.h +12 -7
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemoteUserAPI.h +4 -5
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SPTConfiguration.h +5 -5
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SPTError.h +7 -9
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SPTMacros.h +59 -23
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SPTScope.h +67 -63
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SPTSession.h +2 -1
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SPTSessionManager.h +59 -19
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SpotifyAppRemote.h +11 -15
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SpotifyiOS.h +1 -1
- 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 -1
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/SpotifyiOS +0 -0
- package/ios/SpotifyTokenRefreshClient.swift +118 -0
- package/package.json +12 -11
- package/plugin/build/android/withSpotifyAndroidAppBuildGradle.js +15 -10
- package/plugin/build/ios/withSpotifyConfigValues.js +12 -7
- package/plugin/build/ios/withSpotifyURLScheme.d.ts +1 -1
- package/plugin/build/ios/withSpotifyURLScheme.js +9 -8
- package/plugin/build/types.d.ts +35 -0
- package/plugin/build/types.js +0 -19
- package/ios/ExpoSpotifyAuthDelegate.swift +0 -13
- package/ios/ExpoSpotifySessionManager+SessionManagerDelegate.swift +0 -16
- package/ios/ExpoSpotifySessionManager.swift +0 -90
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/_CodeSignature/CodeResources +0 -454
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
#import <Foundation/Foundation.h>
|
|
2
|
-
|
|
3
2
|
#import "SPTAppRemoteCommon.h"
|
|
4
3
|
|
|
5
4
|
@protocol SPTAppRemoteUserAPI;
|
|
@@ -80,8 +79,8 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
80
79
|
*
|
|
81
80
|
* @param URI The URI of the item to save
|
|
82
81
|
* @param callback A callback block that will be invoked when the fetch request has completed.
|
|
83
|
-
* On success `result` will be an instance of `id<SPTAppRemoteLibraryState>` that indicates the
|
|
84
|
-
*
|
|
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.
|
|
85
84
|
*/
|
|
86
85
|
- (void)addItemToLibraryWithURI:(NSString *)URI callback:(nullable SPTAppRemoteCallback)callback;
|
|
87
86
|
|
|
@@ -93,8 +92,8 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
93
92
|
*
|
|
94
93
|
* @param URI The URI of the item to remove
|
|
95
94
|
* @param callback A callback block that will be invoked when the fetch request has completed.
|
|
96
|
-
* On success `result` will be an instance of `id<SPTAppRemoteLibraryState>` that indicates the
|
|
97
|
-
*
|
|
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.
|
|
98
97
|
*/
|
|
99
98
|
- (void)removeItemFromLibraryWithURI:(NSString *)URI callback:(nullable SPTAppRemoteCallback)callback;
|
|
100
99
|
|
|
@@ -33,8 +33,9 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
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
|
-
is not requested no audio will play. If Spotify is already playing it will continue playing
|
|
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.
|
|
38
39
|
*/
|
|
39
40
|
@property (nonatomic, nullable, copy) NSString *playURI;
|
|
40
41
|
|
|
@@ -47,11 +48,10 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
47
48
|
@param redirectURL Your redirect URL for Spotify to open your app again after authorization
|
|
48
49
|
@return A newly initialized `SPTConfiguration`
|
|
49
50
|
*/
|
|
50
|
-
- (instancetype)initWithClientID:(NSString *)clientID
|
|
51
|
-
redirectURL:(NSURL *)redirectURL NS_DESIGNATED_INITIALIZER;
|
|
51
|
+
- (instancetype)initWithClientID:(NSString *)clientID redirectURL:(NSURL *)redirectURL NS_DESIGNATED_INITIALIZER;
|
|
52
52
|
|
|
53
53
|
/**
|
|
54
|
-
Convenience
|
|
54
|
+
Convenience initializer for `SPTConfiguration`
|
|
55
55
|
|
|
56
56
|
@param clientID Your client ID obtained from developer.spotify.com
|
|
57
57
|
@param redirectURL Your redirect URL for Spotify to open your app again after authorization
|
package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTError.h
CHANGED
|
@@ -7,17 +7,15 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
7
7
|
SPT_EXPORT NSErrorDomain const SPTLoginErrorDomain;
|
|
8
8
|
|
|
9
9
|
/// Spotify error codes, use NSUnderlyingErrorKey to see the underlying error
|
|
10
|
-
typedef NS_ENUM(NSUInteger, SPTErrorCode)
|
|
11
|
-
{
|
|
10
|
+
typedef NS_ENUM(NSUInteger, SPTErrorCode) {
|
|
12
11
|
/// Unknown error code
|
|
13
12
|
SPTUnknownErrorCode NS_SWIFT_NAME(unknown) = 0,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
};
|
|
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) };
|
|
21
19
|
|
|
22
20
|
/// Spotify-specific errors. Use NSUnderlyingErrorKey to see the underlying error
|
|
23
21
|
@interface SPTError : NSError
|
package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTMacros.h
CHANGED
|
@@ -48,42 +48,78 @@
|
|
|
48
48
|
} while (0);
|
|
49
49
|
\endcode
|
|
50
50
|
*/
|
|
51
|
-
#define SPT_OPTIONAL_MESSAGE_SEND(RECEIVER, RESULT, ...)
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
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)
|
|
55
56
|
|
|
56
57
|
/**
|
|
57
58
|
Like SPT_OPTIONAL_MESSAGE_SEND but ignores the return value.
|
|
58
59
|
@param RECEIVER The object to which the message will be sent.
|
|
59
60
|
@param ... 0-4 arguments.
|
|
60
61
|
*/
|
|
61
|
-
#define SPT_OPTIONAL_MESSAGE_SEND_(RECEIVER, ...)
|
|
62
|
-
|
|
63
|
-
[RECEIVER
|
|
64
|
-
|
|
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)
|
|
65
67
|
|
|
66
68
|
// Some boilerplate for SPT_OPTIONAL_MESSAGE_SEND[_]
|
|
67
|
-
#define SPT_CONCAT_METHOD8(A, _1, B, _2, C, _3, D, _4)
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
#define
|
|
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
|
|
71
81
|
#define SPT_CONCAT_METHOD1(A) A
|
|
72
82
|
|
|
73
|
-
#define SPT_CONCAT_SELECTOR8(A, _1, B, _2, C, _3, D, _4)
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
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:
|
|
77
97
|
#define SPT_CONCAT_SELECTOR1(A) A
|
|
78
98
|
|
|
79
99
|
#define SPT_PICK_CONCAT_MACRO(_1, _2, _3, _4, _5, _6, _7, _8, NAME, ...) NAME
|
|
80
100
|
|
|
81
|
-
#define SPT_CONCAT_METHOD(...)
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
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__)
|
|
88
124
|
|
|
89
125
|
#endif // SPT_MACROS
|
package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTScope.h
CHANGED
|
@@ -1,71 +1,75 @@
|
|
|
1
|
+
#import <Foundation/Foundation.h>
|
|
2
|
+
|
|
1
3
|
// (Objective-C identifier, Swift name, string value, bit flag)
|
|
2
|
-
#define SPT_SCOPE_LIST
|
|
3
|
-
SPT_SCOPE(SPTPlaylistReadPrivateScope, playlistReadPrivate, "playlist-read-private", (1 << 0))
|
|
4
|
-
SPT_SCOPE(SPTPlaylistReadCollaborativeScope, playlistReadCollaborative, "playlist-read-collaborative", (1 << 1)) \
|
|
5
|
-
SPT_SCOPE(SPTPlaylistModifyPublicScope, playlistModifyPublic, "playlist-modify-public", (1 << 2))
|
|
6
|
-
SPT_SCOPE(SPTPlaylistModifyPrivateScope, playlistModifyPrivate, "playlist-modify-private", (1 << 3))
|
|
7
|
-
SPT_SCOPE(SPTUserFollowReadScope, userFollowRead, "user-follow-read", (1 << 4))
|
|
8
|
-
SPT_SCOPE(SPTUserFollowModifyScope, userFollowModify, "user-follow-modify", (1 << 5))
|
|
9
|
-
SPT_SCOPE(SPTUserLibraryReadScope, userLibraryRead, "user-library-read", (1 << 6))
|
|
10
|
-
SPT_SCOPE(SPTUserLibraryModifyScope, userLibraryModify, "user-library-modify", (1 << 7))
|
|
11
|
-
SPT_SCOPE(SPTUserReadBirthDateScope, userReadBirthDate, "user-read-birthdate", (1 << 8))
|
|
12
|
-
SPT_SCOPE(SPTUserReadEmailScope, userReadEmail, "user-read-email", (1 << 9))
|
|
13
|
-
SPT_SCOPE(SPTUserReadPrivateScope, userReadPrivate, "user-read-private", (1 << 10))
|
|
14
|
-
SPT_SCOPE(SPTUserTopReadScope, userTopRead, "user-top-read", (1 << 11))
|
|
15
|
-
SPT_SCOPE(SPTUGCImageUploadScope, ugcImageUpload, "ugc-image-upload", (1 << 12))
|
|
16
|
-
SPT_SCOPE(SPTStreamingScope, streaming, "streaming", (1 << 13))
|
|
17
|
-
SPT_SCOPE(SPTAppRemoteControlScope, appRemoteControl, "app-remote-control", (1 << 14))
|
|
18
|
-
SPT_SCOPE(SPTUserReadPlaybackStateScope, userReadPlaybackState, "user-read-playback-state", (1 << 15))
|
|
19
|
-
SPT_SCOPE(SPTUserModifyPlaybackStateScope, userModifyPlaybackState, "user-modify-playback-state", (1 << 16))
|
|
20
|
-
SPT_SCOPE(SPTUserReadCurrentlyPlayingScope, userReadCurrentlyPlaying, "user-read-currently-playing", (1 << 17))
|
|
21
|
-
SPT_SCOPE(SPTUserReadRecentlyPlayedScope, userReadRecentlyPlayed, "user-read-recently-played", (1 << 18))
|
|
22
|
-
SPT_SCOPE(SPTOpenIdScope, openid, "openid", (1 << 19))
|
|
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))
|
|
23
25
|
|
|
24
26
|
/**
|
|
25
27
|
`SPTScope` represents the OAuth scopes that declare how your app wants to access a user's account.
|
|
26
28
|
See https://developer.spotify.com/web-api/using-scopes/ for more information.
|
|
27
29
|
*/
|
|
28
|
-
typedef NS_OPTIONS(NSUInteger, SPTScope)
|
|
29
|
-
{
|
|
30
|
+
typedef NS_OPTIONS(NSUInteger, SPTScope) {
|
|
30
31
|
/// Read access to user's private playlists.
|
|
31
32
|
SPTPlaylistReadPrivateScope NS_SWIFT_NAME(playlistReadPrivate) = (1 << 0),
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
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
|
+
};
|
package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTSession.h
CHANGED
|
@@ -20,7 +20,8 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
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
|
|
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.
|
|
24
25
|
*/
|
|
25
26
|
@property (nonatomic, readonly, getter=isExpired) BOOL expired;
|
|
26
27
|
|
|
@@ -7,15 +7,18 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
7
7
|
@protocol SPTSessionManagerDelegate;
|
|
8
8
|
|
|
9
9
|
/// Options for determining the most suitable method for authorization
|
|
10
|
-
typedef NS_OPTIONS(NSUInteger, SPTAuthorizationOptions)
|
|
11
|
-
|
|
12
|
-
/// Authorize using a suitable method. If Spotify is installed the app will be used instead of a web view
|
|
10
|
+
typedef NS_OPTIONS(NSUInteger, SPTAuthorizationOptions) {
|
|
11
|
+
/// Authorize using a suitable method. If Spotify is installed the app will be used instead of ASWebAuthentication.
|
|
13
12
|
SPTDefaultAuthorizationOption NS_SWIFT_NAME(default) = (0),
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
/// Authorize using only the Spotify client. If Spotify is not installed authorization will fail.
|
|
14
|
+
SPTClientAuthorizationOption NS_SWIFT_NAME(clientOnly) = (1 << 0),
|
|
15
|
+
/// Use this option if you have reached the limit of `LSApplicationQueriesSchemes` in your Info.plist
|
|
16
|
+
/// Attempt to open Spotify app directly without using `canOpenURL`. Falls back to ASWebAuthentication if
|
|
17
|
+
/// opening fails.
|
|
18
|
+
SPTSpotifySchemeNotRegisteredAuthorizationOption NS_SWIFT_NAME(spotifySchemeNotRegistered) = (1 << 1),
|
|
19
|
+
} NS_SWIFT_NAME(AuthorizationOptions);
|
|
17
20
|
|
|
18
|
-
typedef NSString *
|
|
21
|
+
typedef NSString *const SPTAuthorizationCode;
|
|
19
22
|
|
|
20
23
|
|
|
21
24
|
/// This class manages a Spotify user session, in the form of `SPTSession`.
|
|
@@ -24,14 +27,16 @@ typedef NSString * const SPTAuthorizationCode;
|
|
|
24
27
|
/// The `SPTSession` for the `SPTSessionManager` to manage. If no user has been authenticated this will be nil
|
|
25
28
|
@property (nullable, nonatomic, strong) SPTSession *session;
|
|
26
29
|
|
|
27
|
-
/// The `SPTSessionManagerDelegate` to notify of initiating a session, renewing a session, and/or errors related to a
|
|
28
|
-
|
|
30
|
+
/// The `SPTSessionManagerDelegate` to notify of initiating a session, renewing a session, and/or errors related to a
|
|
31
|
+
/// session
|
|
32
|
+
@property (nullable, nonatomic, weak) id<SPTSessionManagerDelegate> delegate;
|
|
29
33
|
|
|
30
34
|
/**
|
|
31
35
|
Determine if the Spotify app is installed.
|
|
32
36
|
|
|
33
37
|
Will be `YES` if the Spotify app is installed (and the URL scheme is whitelisted), otherwise is `NO`.
|
|
34
|
-
Note: You must whitelist the "spotify" URL scheme in your info.plist LSApplicationQueriesSchemes or this will always be
|
|
38
|
+
Note: You must whitelist the "spotify" URL scheme in your info.plist LSApplicationQueriesSchemes or this will always be
|
|
39
|
+
NO
|
|
35
40
|
*/
|
|
36
41
|
@property (nonatomic, readonly, getter=isSpotifyAppInstalled) BOOL spotifyAppInstalled;
|
|
37
42
|
|
|
@@ -46,7 +51,8 @@ typedef NSString * const SPTAuthorizationCode;
|
|
|
46
51
|
/**
|
|
47
52
|
Initiate the authorization process
|
|
48
53
|
|
|
49
|
-
@param scope The scope to request, e.g. `SPTPlaylistReadPrivateScope`|`SPTUserReadEmailScope` if you wish to request
|
|
54
|
+
@param scope The scope to request, e.g. `SPTPlaylistReadPrivateScope`|`SPTUserReadEmailScope` if you wish to request
|
|
55
|
+
read access to private playlists, and read access to the user's email address.
|
|
50
56
|
@param options Options bitmask that informs authorization behavior.
|
|
51
57
|
@param campaign The campaign identifier, to help attribute where the account linking was initiated from.
|
|
52
58
|
See `SPTSessionManagerDelegate` for messages regarding changes in session state.
|
|
@@ -55,33 +61,62 @@ typedef NSString * const SPTAuthorizationCode;
|
|
|
55
61
|
options:(SPTAuthorizationOptions)options
|
|
56
62
|
campaign:(nullable NSString *)campaign;
|
|
57
63
|
|
|
64
|
+
/**
|
|
65
|
+
Initiate the authorization process
|
|
66
|
+
@note Prefer `initiateSessionWithScope:options:campaign` instead, unless you need additional scopes that aren't listed
|
|
67
|
+
in `SPTScope`
|
|
68
|
+
@param scope The scope to request, e.g. `"playlist-read-private user-read-email"` if you wish to request read access to
|
|
69
|
+
private playlists, and read access to the user's email address.
|
|
70
|
+
@param options Options bitmask that informs authorization behavior.
|
|
71
|
+
@param campaign The campaign identifier, to help attribute where the account linking was initiated from.
|
|
72
|
+
See `SPTSessionManagerDelegate` for messages regarding changes in session state.
|
|
73
|
+
*/
|
|
74
|
+
- (void)initiateSessionWithRawScope:(NSString *)scope
|
|
75
|
+
options:(SPTAuthorizationOptions)options
|
|
76
|
+
campaign:(nullable NSString *)campaign;
|
|
77
|
+
|
|
58
78
|
/// Attempt to renew the access token, using the refresh token in the current `SPTSession` which must be valid.
|
|
59
79
|
- (void)renewSession;
|
|
60
80
|
|
|
61
81
|
/**
|
|
62
82
|
Create an `SPTSessionManager` with the provided configuration.
|
|
63
|
-
|
|
83
|
+
|
|
64
84
|
@param configuration An `SPTConfiguration` object.
|
|
65
85
|
@param delegate An optional delegate conforming to `SPTSessionManagerDelegate`.
|
|
66
86
|
@return An `SPTSessionManager` with the desired configuration.
|
|
67
87
|
*/
|
|
68
88
|
- (instancetype)initWithConfiguration:(SPTConfiguration *)configuration
|
|
69
|
-
delegate:(nullable id
|
|
89
|
+
delegate:(nullable id<SPTSessionManagerDelegate>)delegate;
|
|
70
90
|
|
|
71
91
|
+ (instancetype)sessionManagerWithConfiguration:(SPTConfiguration *)configuration
|
|
72
|
-
delegate:(nullable id
|
|
92
|
+
delegate:(nullable id<SPTSessionManagerDelegate>)delegate;
|
|
73
93
|
/**
|
|
74
94
|
Handle openURL callbacks from the `AppDelegate`
|
|
75
95
|
|
|
76
96
|
@param application The `UIApplication` passed into the matching `AppDelegate` method
|
|
77
97
|
@param URL The URL to attempt to parse the access token from
|
|
78
98
|
@param options The options passed in to the matching `AppDelegate` method
|
|
79
|
-
@return Returns `YES` if `SPTSessionManager` recognizes the URL and will attempt to parse an access token, otherwise
|
|
99
|
+
@return Returns `YES` if `SPTSessionManager` recognizes the URL and will attempt to parse an access token, otherwise
|
|
100
|
+
returns `NO`.
|
|
80
101
|
*/
|
|
81
102
|
- (BOOL)application:(UIApplication *)application
|
|
82
103
|
openURL:(NSURL *)URL
|
|
83
104
|
options:(NSDictionary<UIApplicationOpenURLOptionsKey, id> *)options;
|
|
84
105
|
|
|
106
|
+
/**
|
|
107
|
+
Handle continueUserActivity callbacks from the `AppDelegate`
|
|
108
|
+
|
|
109
|
+
@param application The `UIApplication` passed into the matching `AppDelegate` method
|
|
110
|
+
@param userActivity An object encapsulating a user activity supported by this responder.
|
|
111
|
+
@param restorationHandler A block to execute if your app creates objects to perform the task the user was performing
|
|
112
|
+
@return Returns `YES` if `SPTSessionManager` recognizes the URL and will attempt to parse an access token, otherwise
|
|
113
|
+
returns `NO`.
|
|
114
|
+
*/
|
|
115
|
+
- (BOOL)application:(UIApplication *)application
|
|
116
|
+
continueUserActivity:(NSUserActivity *)userActivity
|
|
117
|
+
restorationHandler:
|
|
118
|
+
(void (^)(NSArray<id<UIUserActivityRestoring>> *__nullable restorableObjects))restorationHandler;
|
|
119
|
+
|
|
85
120
|
@end
|
|
86
121
|
|
|
87
122
|
/// The `SPTSessionManagerDelegate` to use for monitoring state changes of a `SPTSessionManager`
|
|
@@ -93,7 +128,8 @@ typedef NSString * const SPTAuthorizationCode;
|
|
|
93
128
|
@param manager The `SPTSessionManager` that initiated the session.
|
|
94
129
|
@param session The initiated `SPTSession` object.
|
|
95
130
|
*/
|
|
96
|
-
- (void)sessionManager:(SPTSessionManager *)manager
|
|
131
|
+
- (void)sessionManager:(SPTSessionManager *)manager
|
|
132
|
+
didInitiateSession:(SPTSession *)session NS_SWIFT_NAME(sessionManager(manager:didInitiate:));
|
|
97
133
|
|
|
98
134
|
/**
|
|
99
135
|
This message is sent when the manager failed to initiate or renew a session.
|
|
@@ -101,7 +137,8 @@ typedef NSString * const SPTAuthorizationCode;
|
|
|
101
137
|
@param manager The `SPTSessionManager` instance.
|
|
102
138
|
@param error The `NSError` that occured.
|
|
103
139
|
*/
|
|
104
|
-
- (void)sessionManager:(SPTSessionManager *)manager
|
|
140
|
+
- (void)sessionManager:(SPTSessionManager *)manager
|
|
141
|
+
didFailWithError:(NSError *)error NS_SWIFT_NAME(sessionManager(manager:didFailWith:));
|
|
105
142
|
|
|
106
143
|
@optional
|
|
107
144
|
|
|
@@ -111,7 +148,8 @@ typedef NSString * const SPTAuthorizationCode;
|
|
|
111
148
|
@param manager The `SPTSessionManager` instance.
|
|
112
149
|
@param session The renewed `SPTSession` object.
|
|
113
150
|
*/
|
|
114
|
-
- (void)sessionManager:(SPTSessionManager *)manager
|
|
151
|
+
- (void)sessionManager:(SPTSessionManager *)manager
|
|
152
|
+
didRenewSession:(SPTSession *)session NS_SWIFT_NAME(sessionManager(manager:didRenew:));
|
|
115
153
|
|
|
116
154
|
/**
|
|
117
155
|
Sent when the `SPTSessionManager` has obtained an authorization code,
|
|
@@ -122,7 +160,9 @@ typedef NSString * const SPTAuthorizationCode;
|
|
|
122
160
|
@param code An OAuth authorization code.
|
|
123
161
|
@return `NO` to request the access token yourself; `YES` to let `SPTSessionManager` handle it.
|
|
124
162
|
*/
|
|
125
|
-
- (BOOL)sessionManager:(SPTSessionManager *)manager
|
|
163
|
+
- (BOOL)sessionManager:(SPTSessionManager *)manager
|
|
164
|
+
shouldRequestAccessTokenWithAuthorizationCode:(SPTAuthorizationCode)code
|
|
165
|
+
NS_SWIFT_NAME(sessionManager(manager:shouldRequestAccessTokenWith:));
|
|
126
166
|
|
|
127
167
|
@end
|
|
128
168
|
|
|
@@ -4,29 +4,25 @@
|
|
|
4
4
|
#define _SPOTIFYAPPREMOTE_
|
|
5
5
|
|
|
6
6
|
#import "SPTAppRemote.h"
|
|
7
|
+
#import "SPTAppRemoteAlbum.h"
|
|
8
|
+
#import "SPTAppRemoteArtist.h"
|
|
7
9
|
#import "SPTAppRemoteCommon.h"
|
|
8
|
-
|
|
9
10
|
#import "SPTAppRemoteConnectionParams.h"
|
|
10
|
-
|
|
11
|
-
#import "
|
|
12
|
-
#import "SPTAppRemotePlayerAPI.h"
|
|
13
|
-
#import "SPTAppRemoteUserAPI.h"
|
|
11
|
+
#import "SPTAppRemoteConnectivityAPI.h"
|
|
12
|
+
#import "SPTAppRemoteConnectivityState.h"
|
|
14
13
|
#import "SPTAppRemoteContentAPI.h"
|
|
15
|
-
|
|
16
|
-
#import "
|
|
17
|
-
#import "
|
|
14
|
+
#import "SPTAppRemoteContentItem.h"
|
|
15
|
+
#import "SPTAppRemoteCrossfadeState.h"
|
|
16
|
+
#import "SPTAppRemoteImageAPI.h"
|
|
17
|
+
#import "SPTAppRemoteLibraryState.h"
|
|
18
18
|
#import "SPTAppRemotePlaybackOptions.h"
|
|
19
19
|
#import "SPTAppRemotePlaybackRestrictions.h"
|
|
20
|
+
#import "SPTAppRemotePlayerAPI.h"
|
|
20
21
|
#import "SPTAppRemotePlayerState.h"
|
|
21
|
-
#import "
|
|
22
|
+
#import "SPTAppRemotePodcastPlaybackSpeed.h"
|
|
22
23
|
#import "SPTAppRemoteTrack.h"
|
|
24
|
+
#import "SPTAppRemoteUserAPI.h"
|
|
23
25
|
#import "SPTAppRemoteUserCapabilities.h"
|
|
24
|
-
#import "SPTAppRemoteLibraryState.h"
|
|
25
|
-
#import "SPTAppRemoteContentItem.h"
|
|
26
|
-
#import "SPTAppRemotePodcastPlaybackSpeed.h"
|
|
27
|
-
#import "SPTAppRemoteConnectivityAPI.h"
|
|
28
|
-
#import "SPTAppRemoteConnectivityState.h"
|
|
29
|
-
|
|
30
26
|
#import "SPTConfiguration.h"
|
|
31
27
|
|
|
32
28
|
#endif /* _SPOTIFYAPPREMOTE_ */
|
|
Binary file
|