@wwdrew/expo-spotify-sdk 0.3.0 → 0.4.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 +36 -3
- package/build/ExpoSpotifySDK.types.d.ts +0 -2
- package/build/ExpoSpotifySDK.types.d.ts.map +1 -1
- package/build/ExpoSpotifySDK.types.js.map +1 -1
- package/external/android/SpotifySDK/auth-lib/spotify-auth-release-2.1.0.aar +0 -0
- package/ios/ExpoSpotifySDKModule.swift +14 -22
- package/ios/ExpoSpotifySessionManager+SessionManagerDelegate.swift +2 -12
- package/ios/ExpoSpotifySessionManager.swift +24 -32
- package/ios/SpotifySDK/SpotifyiOS.xcframework/Info.plist +9 -5
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTAppRemote.h +14 -10
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTAppRemoteContentItem.h +3 -0
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTSessionManager.h +3 -13
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SpotifyAppRemote.h +2 -0
- 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 +1 -1
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/PrivacyInfo.xcprivacy +14 -0
- 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 +14 -10
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemoteContentItem.h +3 -0
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SPTSessionManager.h +3 -13
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SpotifyAppRemote.h +2 -0
- 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 +1 -1
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/PrivacyInfo.xcprivacy +14 -0
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/SpotifyiOS +0 -0
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/_CodeSignature/CodeResources +20 -133
- package/package.json +4 -3
- package/plugin/build/android/withSpotifyAndroidAppBuildGradle.js +18 -2
- package/plugin/build/index.js +2 -2
- package/plugin/build/ios/{withSpotifyConfigIOS.d.ts → withSpotifyConfigValues.d.ts} +1 -1
- package/plugin/build/ios/{withSpotifyConfigIOS.js → withSpotifyConfigValues.js} +3 -3
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_armv7/SpotifyiOS.framework/Headers/SPTAppRemote.h +0 -240
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_armv7/SpotifyiOS.framework/Headers/SPTAppRemoteAlbum.h +0 -18
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_armv7/SpotifyiOS.framework/Headers/SPTAppRemoteArtist.h +0 -18
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_armv7/SpotifyiOS.framework/Headers/SPTAppRemoteCommon.h +0 -36
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_armv7/SpotifyiOS.framework/Headers/SPTAppRemoteConnectionParams.h +0 -65
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_armv7/SpotifyiOS.framework/Headers/SPTAppRemoteContentAPI.h +0 -75
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_armv7/SpotifyiOS.framework/Headers/SPTAppRemoteContentItem.h +0 -43
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_armv7/SpotifyiOS.framework/Headers/SPTAppRemoteCrossfadeState.h +0 -18
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_armv7/SpotifyiOS.framework/Headers/SPTAppRemoteImageAPI.h +0 -25
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_armv7/SpotifyiOS.framework/Headers/SPTAppRemoteImageRepresentable.h +0 -16
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_armv7/SpotifyiOS.framework/Headers/SPTAppRemoteLibraryState.h +0 -19
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_armv7/SpotifyiOS.framework/Headers/SPTAppRemotePlaybackOptions.h +0 -32
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_armv7/SpotifyiOS.framework/Headers/SPTAppRemotePlaybackRestrictions.h +0 -32
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_armv7/SpotifyiOS.framework/Headers/SPTAppRemotePlayerAPI.h +0 -262
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_armv7/SpotifyiOS.framework/Headers/SPTAppRemotePlayerState.h +0 -40
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_armv7/SpotifyiOS.framework/Headers/SPTAppRemotePodcastPlaybackSpeed.h +0 -15
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_armv7/SpotifyiOS.framework/Headers/SPTAppRemoteTrack.h +0 -47
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_armv7/SpotifyiOS.framework/Headers/SPTAppRemoteUserAPI.h +0 -103
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_armv7/SpotifyiOS.framework/Headers/SPTAppRemoteUserCapabilities.h +0 -15
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_armv7/SpotifyiOS.framework/Headers/SPTConfiguration.h +0 -63
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_armv7/SpotifyiOS.framework/Headers/SPTError.h +0 -33
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_armv7/SpotifyiOS.framework/Headers/SPTLogin.h +0 -10
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_armv7/SpotifyiOS.framework/Headers/SPTMacros.h +0 -89
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_armv7/SpotifyiOS.framework/Headers/SPTScope.h +0 -68
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_armv7/SpotifyiOS.framework/Headers/SPTSession.h +0 -32
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_armv7/SpotifyiOS.framework/Headers/SPTSessionManager.h +0 -140
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_armv7/SpotifyiOS.framework/Headers/SpotifyAppRemote.h +0 -30
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_armv7/SpotifyiOS.framework/Headers/SpotifyiOS.h +0 -7
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_armv7/SpotifyiOS.framework/Info.plist +0 -0
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_armv7/SpotifyiOS.framework/Modules/module.modulemap +0 -6
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_armv7/SpotifyiOS.framework/SpotifyiOS +0 -0
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_i386_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemote.h +0 -240
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_i386_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemoteAlbum.h +0 -18
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_i386_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemoteArtist.h +0 -18
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_i386_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemoteCommon.h +0 -36
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_i386_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemoteConnectionParams.h +0 -65
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_i386_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemoteContentAPI.h +0 -75
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_i386_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemoteContentItem.h +0 -43
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_i386_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemoteCrossfadeState.h +0 -18
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_i386_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemoteImageAPI.h +0 -25
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_i386_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemoteImageRepresentable.h +0 -16
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_i386_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemoteLibraryState.h +0 -19
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_i386_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemotePlaybackOptions.h +0 -32
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_i386_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemotePlaybackRestrictions.h +0 -32
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_i386_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemotePlayerAPI.h +0 -262
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_i386_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemotePlayerState.h +0 -40
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_i386_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemotePodcastPlaybackSpeed.h +0 -15
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_i386_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemoteTrack.h +0 -47
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_i386_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemoteUserAPI.h +0 -103
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_i386_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemoteUserCapabilities.h +0 -15
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_i386_x86_64-simulator/SpotifyiOS.framework/Headers/SPTConfiguration.h +0 -63
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_i386_x86_64-simulator/SpotifyiOS.framework/Headers/SPTError.h +0 -33
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_i386_x86_64-simulator/SpotifyiOS.framework/Headers/SPTLogin.h +0 -10
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_i386_x86_64-simulator/SpotifyiOS.framework/Headers/SPTMacros.h +0 -89
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_i386_x86_64-simulator/SpotifyiOS.framework/Headers/SPTScope.h +0 -68
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_i386_x86_64-simulator/SpotifyiOS.framework/Headers/SPTSession.h +0 -32
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_i386_x86_64-simulator/SpotifyiOS.framework/Headers/SPTSessionManager.h +0 -140
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_i386_x86_64-simulator/SpotifyiOS.framework/Headers/SpotifyAppRemote.h +0 -30
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_i386_x86_64-simulator/SpotifyiOS.framework/Headers/SpotifyiOS.h +0 -7
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_i386_x86_64-simulator/SpotifyiOS.framework/Info.plist +0 -0
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_i386_x86_64-simulator/SpotifyiOS.framework/Modules/module.modulemap +0 -6
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_i386_x86_64-simulator/SpotifyiOS.framework/SpotifyiOS +0 -0
- package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_i386_x86_64-simulator/SpotifyiOS.framework/_CodeSignature/CodeResources +0 -537
- package/plugin/build/android/withSpotifyConfigAndroid.d.ts +0 -3
- package/plugin/build/android/withSpotifyConfigAndroid.js +0 -16
- package/plugin/build/withSpotifyConfig.d.ts +0 -3
- package/plugin/build/withSpotifyConfig.js +0 -11
package/README.md
CHANGED
|
@@ -52,13 +52,15 @@ authenticateAsync(config: SpotifyConfig): Promise<SpotifySession>
|
|
|
52
52
|
|
|
53
53
|
Starts the authentication process. Requires an array of OAuth scopes. If the Spotify app is installed on the target device it will interact directly with it, otherwise it will open a web view to authenticate with the Spotify website.
|
|
54
54
|
|
|
55
|
+
**Note for Android:** If not providing a token swap or refresh URL, the Spotify session response access token will expire after 60 minutes and will not include a refresh token. This is due to a limitation in the Android Spotify SDK. It's generally recommended to [implement a token swap endpoint](#token-swap) for this reason.
|
|
56
|
+
|
|
55
57
|
### Parameters
|
|
56
58
|
|
|
57
59
|
- `tokenSwapURL` (optional): <string> The URL to use for attempting to swap an authorization code for an access token
|
|
58
60
|
- `tokenRefreshURL` (optional): <string> The URL to use for attempting to renew an access token with a refresh token
|
|
59
61
|
- `scopes`: An array of OAuth scopes that declare how your app wants to access a user's account. See [Spotify Scopes](https://developer.spotify.com/web-api/using-scopes/) for more information.
|
|
60
62
|
|
|
61
|
-
|
|
63
|
+
**Note:** The following scopes are not available to Expo Spotify SDK:
|
|
62
64
|
|
|
63
65
|
- user-read-playback-position
|
|
64
66
|
- user-soa-link
|
|
@@ -78,9 +80,8 @@ interface SpotifyConfig {
|
|
|
78
80
|
|
|
79
81
|
interface SpotifySession {
|
|
80
82
|
accessToken: string;
|
|
81
|
-
refreshToken: string;
|
|
83
|
+
refreshToken: string | null;
|
|
82
84
|
expirationDate: number;
|
|
83
|
-
isExpired: boolean;
|
|
84
85
|
scopes: SpotifyScopes[];
|
|
85
86
|
}
|
|
86
87
|
|
|
@@ -105,6 +106,38 @@ type SpotifyScopes =
|
|
|
105
106
|
| "user-read-private";
|
|
106
107
|
```
|
|
107
108
|
|
|
109
|
+
## Token Swap Example
|
|
110
|
+
|
|
111
|
+
An example token swap endpoint has been provided in the `example` project. For it to work it needs your Spotify client details to be included.
|
|
112
|
+
|
|
113
|
+
1. Open the `server.js` file and add your client details:
|
|
114
|
+
|
|
115
|
+
```javascript
|
|
116
|
+
const CLIENT_ID = "<your-client-id>";
|
|
117
|
+
const CLIENT_SECRET = "<your-client-secret>";
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
These values can be found in your [Spotify Developer Dashboard](https://developer.spotify.com/dashboard). You will need an existing Spotify app for this.
|
|
121
|
+
|
|
122
|
+
2. Run the server
|
|
123
|
+
|
|
124
|
+
```sh
|
|
125
|
+
node server.js
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
3. Set the `tokenSwapURL` value in your `authenticateAsync` call:
|
|
129
|
+
|
|
130
|
+
```javascript
|
|
131
|
+
const session = await authenticateAsync({
|
|
132
|
+
tokenSwapURL: "http://192.168.1.120:3000/swap",
|
|
133
|
+
scopes: [
|
|
134
|
+
...
|
|
135
|
+
]
|
|
136
|
+
});
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
All authentication requests will now be sent through the token swap server.
|
|
140
|
+
|
|
108
141
|
## Acknowledgments
|
|
109
142
|
|
|
110
143
|
This project has been heavily inspired by the following projects:
|
|
@@ -2,14 +2,12 @@ export interface SpotifySession {
|
|
|
2
2
|
accessToken: string;
|
|
3
3
|
refreshToken: string;
|
|
4
4
|
expirationDate: number;
|
|
5
|
-
isExpired: boolean;
|
|
6
5
|
scopes: SpotifyScope[];
|
|
7
6
|
}
|
|
8
7
|
export interface SpotifyConfig {
|
|
9
8
|
scopes: SpotifyScope[];
|
|
10
9
|
tokenSwapURL?: string;
|
|
11
10
|
tokenRefreshURL?: string;
|
|
12
|
-
shouldRequestAccessToken?: boolean;
|
|
13
11
|
}
|
|
14
12
|
export type SpotifyScope = "ugc-image-upload" | "user-read-playback-state" | "user-modify-playback-state" | "user-read-currently-playing" | "app-remote-control" | "streaming" | "playlist-read-private" | "playlist-read-collaborative" | "playlist-modify-private" | "playlist-modify-public" | "user-follow-modify" | "user-follow-read" | "user-top-read" | "user-read-recently-played" | "user-library-modify" | "user-library-read" | "user-read-email" | "user-read-private";
|
|
15
13
|
//# sourceMappingURL=ExpoSpotifySDK.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoSpotifySDK.types.d.ts","sourceRoot":"","sources":["../src/ExpoSpotifySDK.types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,
|
|
1
|
+
{"version":3,"file":"ExpoSpotifySDK.types.d.ts","sourceRoot":"","sources":["../src/ExpoSpotifySDK.types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,YAAY,EAAE,CAAC;CACxB;AAED,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,YAAY,EAAE,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAMD,MAAM,MAAM,YAAY,GACpB,kBAAkB,GAClB,0BAA0B,GAC1B,4BAA4B,GAC5B,6BAA6B,GAC7B,oBAAoB,GACpB,WAAW,GACX,uBAAuB,GACvB,6BAA6B,GAC7B,yBAAyB,GACzB,wBAAwB,GACxB,oBAAoB,GACpB,kBAAkB,GAClB,eAAe,GACf,2BAA2B,GAC3B,qBAAqB,GACrB,mBAAmB,GACnB,iBAAiB,GACjB,mBAAmB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoSpotifySDK.types.js","sourceRoot":"","sources":["../src/ExpoSpotifySDK.types.ts"],"names":[],"mappings":"","sourcesContent":["export interface SpotifySession {\n accessToken: string;\n refreshToken: string;\n expirationDate: number;\n
|
|
1
|
+
{"version":3,"file":"ExpoSpotifySDK.types.js","sourceRoot":"","sources":["../src/ExpoSpotifySDK.types.ts"],"names":[],"mappings":"","sourcesContent":["export interface SpotifySession {\n accessToken: string;\n refreshToken: string;\n expirationDate: number;\n scopes: SpotifyScope[];\n}\n\nexport interface SpotifyConfig {\n scopes: SpotifyScope[];\n tokenSwapURL?: string;\n tokenRefreshURL?: string;\n}\n\n// export interface AndroidSpotifyConfig extends SpotifyConfig {\n// responseType: \"token\" | \"code\";\n// }\n\nexport type SpotifyScope =\n | \"ugc-image-upload\"\n | \"user-read-playback-state\"\n | \"user-modify-playback-state\"\n | \"user-read-currently-playing\"\n | \"app-remote-control\"\n | \"streaming\"\n | \"playlist-read-private\"\n | \"playlist-read-collaborative\"\n | \"playlist-modify-private\"\n | \"playlist-modify-public\"\n | \"user-follow-modify\"\n | \"user-follow-read\"\n | \"user-top-read\"\n | \"user-read-recently-played\"\n | \"user-library-modify\"\n | \"user-library-read\"\n | \"user-read-email\"\n | \"user-read-private\";\n"]}
|
|
@@ -2,44 +2,36 @@ import ExpoModulesCore
|
|
|
2
2
|
import SpotifyiOS
|
|
3
3
|
|
|
4
4
|
public class ExpoSpotifySDKModule: Module {
|
|
5
|
-
|
|
5
|
+
|
|
6
6
|
public func definition() -> ModuleDefinition {
|
|
7
|
-
|
|
7
|
+
|
|
8
8
|
let spotifySession = ExpoSpotifySessionManager.shared
|
|
9
|
-
|
|
9
|
+
|
|
10
10
|
Name("ExpoSpotifySDK")
|
|
11
|
-
|
|
11
|
+
|
|
12
12
|
Function("isAvailable") {
|
|
13
13
|
return spotifySession.spotifyAppInstalled()
|
|
14
14
|
}
|
|
15
|
-
|
|
15
|
+
|
|
16
16
|
AsyncFunction("authenticateAsync") { (config: [String: Any], promise: Promise) in
|
|
17
17
|
guard let scopes = config["scopes"] as? [String] else {
|
|
18
18
|
promise.reject("INVALID_CONFIG", "Invalid SpotifyConfig object")
|
|
19
19
|
return
|
|
20
20
|
}
|
|
21
|
-
|
|
21
|
+
|
|
22
22
|
let tokenSwapURL = config["tokenSwapURL"] as? String
|
|
23
23
|
let tokenRefreshURL = config["tokenRefreshURL"] as? String
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
"expirationDate": Int(session.expirationDate.timeIntervalSince1970 * 1000),
|
|
33
|
-
"scopes": SPTScopeSerializer.serializeScopes(session.scope),
|
|
34
|
-
"isExpired": session.isExpired
|
|
35
|
-
])
|
|
36
|
-
case .authorizationCode(let code):
|
|
37
|
-
promise.resolve(["code": code])
|
|
38
|
-
}
|
|
24
|
+
|
|
25
|
+
spotifySession.authenticate(scopes: scopes, tokenSwapURL: tokenSwapURL, tokenRefreshURL: tokenRefreshURL).done { session in
|
|
26
|
+
promise.resolve([
|
|
27
|
+
"accessToken": session.accessToken,
|
|
28
|
+
"refreshToken": session.refreshToken,
|
|
29
|
+
"expirationDate": Int(session.expirationDate.timeIntervalSince1970 * 1000),
|
|
30
|
+
"scopes": SPTScopeSerializer.serializeScopes(session.scope)
|
|
31
|
+
])
|
|
39
32
|
}.catch { error in
|
|
40
33
|
promise.reject(error)
|
|
41
34
|
}
|
|
42
35
|
}
|
|
43
|
-
|
|
44
36
|
}
|
|
45
37
|
}
|
|
@@ -3,9 +3,7 @@ import SpotifyiOS
|
|
|
3
3
|
|
|
4
4
|
extension ExpoSpotifySessionManager: SPTSessionManagerDelegate {
|
|
5
5
|
public func sessionManager(manager _: SPTSessionManager, didInitiate session: SPTSession) {
|
|
6
|
-
|
|
7
|
-
authPromiseSeal?.fulfill(AuthenticationResult.session(session))
|
|
8
|
-
}
|
|
6
|
+
authPromiseSeal?.fulfill(session)
|
|
9
7
|
}
|
|
10
8
|
|
|
11
9
|
public func sessionManager(manager _: SPTSessionManager, didFailWith error: Error) {
|
|
@@ -13,14 +11,6 @@ extension ExpoSpotifySessionManager: SPTSessionManagerDelegate {
|
|
|
13
11
|
}
|
|
14
12
|
|
|
15
13
|
public func sessionManager(manager _: SPTSessionManager, didRenew session: SPTSession) {
|
|
16
|
-
authPromiseSeal?.fulfill(
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
public func sessionManager(manager: SPTSessionManager, shouldRequestAccessTokenWith code: String) -> Bool {
|
|
20
|
-
if !shouldRequestAccessToken {
|
|
21
|
-
authPromiseSeal?.fulfill(AuthenticationResult.authorizationCode(code))
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
return shouldRequestAccessToken
|
|
14
|
+
authPromiseSeal?.fulfill(session)
|
|
25
15
|
}
|
|
26
16
|
}
|
|
@@ -2,11 +2,6 @@ import ExpoModulesCore
|
|
|
2
2
|
import SpotifyiOS
|
|
3
3
|
import PromiseKit
|
|
4
4
|
|
|
5
|
-
enum AuthenticationResult {
|
|
6
|
-
case session(SPTSession)
|
|
7
|
-
case authorizationCode(String)
|
|
8
|
-
}
|
|
9
|
-
|
|
10
5
|
enum SessionManagerError: Error {
|
|
11
6
|
case notInitialized
|
|
12
7
|
case invalidConfiguration
|
|
@@ -14,12 +9,10 @@ enum SessionManagerError: Error {
|
|
|
14
9
|
|
|
15
10
|
final class ExpoSpotifySessionManager: NSObject {
|
|
16
11
|
weak var module: ExpoSpotifySDKModule?
|
|
17
|
-
var authPromiseSeal: Resolver<
|
|
18
|
-
|
|
19
|
-
var shouldRequestAccessToken: Bool = true
|
|
20
|
-
|
|
12
|
+
var authPromiseSeal: Resolver<SPTSession>?
|
|
13
|
+
|
|
21
14
|
static let shared = ExpoSpotifySessionManager()
|
|
22
|
-
|
|
15
|
+
|
|
23
16
|
private var expoSpotifyConfiguration: ExpoSpotifyConfiguration? {
|
|
24
17
|
guard let expoSpotifySdkDict = Bundle.main.object(forInfoDictionaryKey: "ExpoSpotifySDK") as? [String: String],
|
|
25
18
|
let clientID = expoSpotifySdkDict["clientID"],
|
|
@@ -28,71 +21,70 @@ final class ExpoSpotifySessionManager: NSObject {
|
|
|
28
21
|
{
|
|
29
22
|
return nil
|
|
30
23
|
}
|
|
31
|
-
|
|
24
|
+
|
|
32
25
|
return ExpoSpotifyConfiguration(clientID: clientID, host: host, scheme: scheme)
|
|
33
26
|
}
|
|
34
|
-
|
|
27
|
+
|
|
35
28
|
lazy var configuration: SPTConfiguration? = {
|
|
36
29
|
guard let clientID = expoSpotifyConfiguration?.clientID,
|
|
37
30
|
let redirectURL = expoSpotifyConfiguration?.redirectURL else {
|
|
38
31
|
NSLog("Invalid Spotify configuration")
|
|
39
32
|
return nil
|
|
40
33
|
}
|
|
41
|
-
|
|
34
|
+
|
|
42
35
|
return SPTConfiguration(clientID: clientID, redirectURL: redirectURL)
|
|
43
36
|
}()
|
|
44
|
-
|
|
37
|
+
|
|
45
38
|
lazy var sessionManager: SPTSessionManager? = {
|
|
46
39
|
guard let configuration = configuration else {
|
|
47
40
|
return nil
|
|
48
41
|
}
|
|
49
|
-
|
|
42
|
+
|
|
50
43
|
return SPTSessionManager(configuration: configuration, delegate: self)
|
|
51
44
|
}()
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
func authenticate(scopes: [String], tokenSwapURL: String?, tokenRefreshURL: String
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
func authenticate(scopes: [String], tokenSwapURL: String?, tokenRefreshURL: String?) -> PromiseKit.Promise<SPTSession> {
|
|
55
48
|
return Promise { seal in
|
|
56
|
-
guard let clientID = expoSpotifyConfiguration?.clientID,
|
|
57
|
-
let redirectURL = expoSpotifyConfiguration?.redirectURL else {
|
|
49
|
+
guard let clientID = self.expoSpotifyConfiguration?.clientID,
|
|
50
|
+
let redirectURL = self.expoSpotifyConfiguration?.redirectURL else {
|
|
58
51
|
NSLog("Invalid Spotify configuration")
|
|
59
52
|
seal.reject(SessionManagerError.invalidConfiguration)
|
|
60
53
|
return
|
|
61
54
|
}
|
|
62
|
-
let configuration = SPTConfiguration(clientID: clientID, redirectURL: redirectURL)
|
|
63
55
|
|
|
56
|
+
let configuration = SPTConfiguration(clientID: clientID, redirectURL: redirectURL)
|
|
57
|
+
|
|
64
58
|
if (tokenSwapURL != nil) {
|
|
65
59
|
configuration.tokenSwapURL = URL(string: tokenSwapURL ?? "")
|
|
66
60
|
}
|
|
67
|
-
|
|
61
|
+
|
|
68
62
|
if (tokenRefreshURL != nil) {
|
|
69
63
|
configuration.tokenRefreshURL = URL(string: tokenRefreshURL ?? "")
|
|
70
64
|
}
|
|
71
|
-
|
|
72
|
-
self.
|
|
65
|
+
|
|
66
|
+
self.authPromiseSeal = seal
|
|
73
67
|
self.configuration = configuration
|
|
74
68
|
self.sessionManager = SPTSessionManager(configuration: configuration, delegate: self)
|
|
75
|
-
|
|
76
|
-
self.authPromiseSeal = seal
|
|
77
|
-
|
|
69
|
+
|
|
78
70
|
DispatchQueue.main.sync {
|
|
79
|
-
sessionManager?.initiateSession(with: SPTScopeSerializer.deserializeScopes(scopes), options: .default)
|
|
71
|
+
sessionManager?.initiateSession(with: SPTScopeSerializer.deserializeScopes(scopes), options: .default, campaign: nil)
|
|
80
72
|
}
|
|
81
73
|
}
|
|
82
74
|
}
|
|
83
|
-
|
|
75
|
+
|
|
84
76
|
func spotifyAppInstalled() -> Bool {
|
|
85
77
|
guard let sessionManager = sessionManager else {
|
|
86
78
|
NSLog("SPTSessionManager not initialized")
|
|
87
79
|
return false
|
|
88
80
|
}
|
|
89
|
-
|
|
81
|
+
|
|
90
82
|
var isInstalled = false
|
|
91
|
-
|
|
83
|
+
|
|
92
84
|
DispatchQueue.main.sync {
|
|
93
85
|
isInstalled = sessionManager.isSpotifyAppInstalled
|
|
94
86
|
}
|
|
95
|
-
|
|
87
|
+
|
|
96
88
|
return isInstalled
|
|
97
89
|
}
|
|
98
90
|
}
|
|
@@ -5,31 +5,35 @@
|
|
|
5
5
|
<key>AvailableLibraries</key>
|
|
6
6
|
<array>
|
|
7
7
|
<dict>
|
|
8
|
+
<key>BinaryPath</key>
|
|
9
|
+
<string>SpotifyiOS.framework/SpotifyiOS</string>
|
|
8
10
|
<key>LibraryIdentifier</key>
|
|
9
|
-
<string>ios-
|
|
11
|
+
<string>ios-arm64_x86_64-simulator</string>
|
|
10
12
|
<key>LibraryPath</key>
|
|
11
13
|
<string>SpotifyiOS.framework</string>
|
|
12
14
|
<key>SupportedArchitectures</key>
|
|
13
15
|
<array>
|
|
14
16
|
<string>arm64</string>
|
|
17
|
+
<string>x86_64</string>
|
|
15
18
|
</array>
|
|
16
19
|
<key>SupportedPlatform</key>
|
|
17
20
|
<string>ios</string>
|
|
21
|
+
<key>SupportedPlatformVariant</key>
|
|
22
|
+
<string>simulator</string>
|
|
18
23
|
</dict>
|
|
19
24
|
<dict>
|
|
25
|
+
<key>BinaryPath</key>
|
|
26
|
+
<string>SpotifyiOS.framework/SpotifyiOS</string>
|
|
20
27
|
<key>LibraryIdentifier</key>
|
|
21
|
-
<string>ios-
|
|
28
|
+
<string>ios-arm64</string>
|
|
22
29
|
<key>LibraryPath</key>
|
|
23
30
|
<string>SpotifyiOS.framework</string>
|
|
24
31
|
<key>SupportedArchitectures</key>
|
|
25
32
|
<array>
|
|
26
33
|
<string>arm64</string>
|
|
27
|
-
<string>x86_64</string>
|
|
28
34
|
</array>
|
|
29
35
|
<key>SupportedPlatform</key>
|
|
30
36
|
<string>ios</string>
|
|
31
|
-
<key>SupportedPlatformVariant</key>
|
|
32
|
-
<string>simulator</string>
|
|
33
37
|
</dict>
|
|
34
38
|
</array>
|
|
35
39
|
<key>CFBundlePackageType</key>
|
package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTAppRemote.h
CHANGED
|
@@ -166,24 +166,26 @@ typedef NS_ENUM(NSUInteger, SPTAppRemoteLogLevel) {
|
|
|
166
166
|
* The passed URI will start playing unless Spotify is already playing.
|
|
167
167
|
*
|
|
168
168
|
* @param URI The URI to play. Use a blank string to attempt to play the user's last song
|
|
169
|
+
* @param completionHandler `YES` if the Spotify app is installed and an authorization attempt can be made, otherwise `NO`.
|
|
169
170
|
*
|
|
170
|
-
* @return `YES` if the Spotify app is installed and an authorization attempt can be made, otherwise `NO`.
|
|
171
171
|
* Note: The return `BOOL` here is not a measure of whether or not authentication succeeded, only a check if
|
|
172
172
|
* the Spotify app is installed and can attempt to handle the authorization request.
|
|
173
173
|
*/
|
|
174
|
-
- (
|
|
174
|
+
- (void)authorizeAndPlayURI:(NSString *)URI completionHandler:(void (^ __nullable)(BOOL success))completionHandler;
|
|
175
175
|
|
|
176
176
|
/**
|
|
177
177
|
* Open Spotify app to obtain access token and start playback.
|
|
178
178
|
*
|
|
179
179
|
* @param playURI The URI to play. Use a blank string to attempt to play the user's last song
|
|
180
180
|
* @param asRadio `YES` to start radio for the given URI.
|
|
181
|
+
* @param completionHandler `YES` if the Spotify app is installed and an authorization attempt can be made, otherwise `NO`.
|
|
181
182
|
*
|
|
182
|
-
* @return `YES` if the Spotify app is installed and an authorization attempt can be made, otherwise `NO`.
|
|
183
183
|
* Note: The return `BOOL` here is not a measure of whether or not authentication succeeded, only a check if
|
|
184
184
|
* the Spotify app is installed and can attempt to handle the authorization request.
|
|
185
185
|
*/
|
|
186
|
-
- (
|
|
186
|
+
- (void)authorizeAndPlayURI:(NSString *)playURI
|
|
187
|
+
asRadio:(BOOL)asRadio
|
|
188
|
+
completionHandler:(void (^ __nullable)(BOOL success))completionHandler;
|
|
187
189
|
|
|
188
190
|
/**
|
|
189
191
|
* Open Spotify app to obtain access token and start playback.
|
|
@@ -191,14 +193,15 @@ typedef NS_ENUM(NSUInteger, SPTAppRemoteLogLevel) {
|
|
|
191
193
|
* @param playURI The URI to play. Use a blank string to attempt to play the user's last song
|
|
192
194
|
* @param asRadio `YES` to start radio for the given URI.
|
|
193
195
|
* @param additionalScopes An array of scopes in addition to `app-remote-control`. Can be nil if you only need `app-remote-control`
|
|
196
|
+
* @param completionHandler `YES` if the Spotify app is installed and an authorization attempt can be made, otherwise `NO`.
|
|
194
197
|
*
|
|
195
|
-
* @return `YES` if the Spotify app is installed and an authorization attempt can be made, otherwise `NO`.
|
|
196
198
|
* Note: The return `BOOL` here is not a measure of whether or not authentication succeeded, only a check if
|
|
197
199
|
* the Spotify app is installed and can attempt to handle the authorization request.
|
|
198
200
|
*/
|
|
199
|
-
- (
|
|
201
|
+
- (void)authorizeAndPlayURI:(NSString *)playURI
|
|
200
202
|
asRadio:(BOOL)asRadio
|
|
201
|
-
additionalScopes:(nullable NSArray<NSString *> *)additionalScopes
|
|
203
|
+
additionalScopes:(nullable NSArray<NSString *> *)additionalScopes
|
|
204
|
+
completionHandler:(void (^ __nullable)(BOOL success))completionHandler;
|
|
202
205
|
|
|
203
206
|
/**
|
|
204
207
|
* Open Spotify app to obtain access token and start playback.
|
|
@@ -209,15 +212,16 @@ typedef NS_ENUM(NSUInteger, SPTAppRemoteLogLevel) {
|
|
|
209
212
|
* @param sessionIdentifier An optional unique identifier for this specific session, which is used for analytics purposes. Every new attempt to
|
|
210
213
|
* connect to the Spotify app should have a new identifier, but the identifier used here should then be reused for the accompanied call to
|
|
211
214
|
* `connectWithSessionIdentifier:`.
|
|
215
|
+
* @param completionHandler `YES` if the Spotify app is installed and an authorization attempt can be made, otherwise `NO`.
|
|
212
216
|
*
|
|
213
|
-
* @return `YES` if the Spotify app is installed and an authorization attempt can be made, otherwise `NO`.
|
|
214
217
|
* Note: The return `BOOL` here is not a measure of whether or not authentication succeeded, only a check if
|
|
215
218
|
* the Spotify app is installed and can attempt to handle the authorization request.
|
|
216
219
|
*/
|
|
217
|
-
- (
|
|
220
|
+
- (void)authorizeAndPlayURI:(NSString *)playURI
|
|
218
221
|
asRadio:(BOOL)asRadio
|
|
219
222
|
additionalScopes:(nullable NSArray<NSString *> *)additionalScopes
|
|
220
|
-
sessionIdentifier:(nullable NSUUID *)sessionIdentifier
|
|
223
|
+
sessionIdentifier:(nullable NSUUID *)sessionIdentifier
|
|
224
|
+
completionHandler:(void (^ __nullable)(BOOL success))completionHandler;
|
|
221
225
|
/**
|
|
222
226
|
* Parse out an access token or error description from a url passed to application:openURL:options:
|
|
223
227
|
*
|
|
@@ -33,6 +33,9 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
33
33
|
/// Returns `YES` if the item is expected to contain children, otherwise `NO`.
|
|
34
34
|
@property (nonatomic, assign, readonly, getter=isContainer) BOOL container;
|
|
35
35
|
|
|
36
|
+
/// Returns `YES` if the item is pinned in Your Library, otherwise `NO`.
|
|
37
|
+
@property (nonatomic, assign, readonly, getter=isPinned) BOOL pinnned;
|
|
38
|
+
|
|
36
39
|
/**
|
|
37
40
|
A list of the content item's children.
|
|
38
41
|
|
|
@@ -44,26 +44,16 @@ typedef NSString * const SPTAuthorizationCode;
|
|
|
44
44
|
- (instancetype)init NS_UNAVAILABLE;
|
|
45
45
|
|
|
46
46
|
/**
|
|
47
|
-
Initiate the authorization process
|
|
47
|
+
Initiate the authorization process
|
|
48
48
|
|
|
49
49
|
@param scope The scope to request, e.g. `SPTPlaylistReadPrivateScope`|`SPTUserReadEmailScope` if you wish to request read access to private playlists, and read access to the user's email address.
|
|
50
50
|
@param options Options bitmask that informs authorization behavior.
|
|
51
|
-
|
|
52
|
-
*/
|
|
53
|
-
- (void)initiateSessionWithScope:(SPTScope)scope
|
|
54
|
-
options:(SPTAuthorizationOptions)options NS_AVAILABLE_IOS(11_0);
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
Initiate the authorization process on iOS versions < 11.
|
|
58
|
-
|
|
59
|
-
@param scope The scope to request, e.g. `SPTPlaylistReadPrivateScope`|`SPTUserReadEmailScope` if you wish to request read access to private playlists, and read access to the user's email address.
|
|
60
|
-
@param options Options bitmask that informs authorization behavior.
|
|
61
|
-
@param presentingViewController The `UIViewController` to present the login `SFSafariViewController` on
|
|
51
|
+
@param campaign The campaign identifier, to help attribute where the account linking was initiated from.
|
|
62
52
|
See `SPTSessionManagerDelegate` for messages regarding changes in session state.
|
|
63
53
|
*/
|
|
64
54
|
- (void)initiateSessionWithScope:(SPTScope)scope
|
|
65
55
|
options:(SPTAuthorizationOptions)options
|
|
66
|
-
|
|
56
|
+
campaign:(nullable NSString *)campaign;
|
|
67
57
|
|
|
68
58
|
/// Attempt to renew the access token, using the refresh token in the current `SPTSession` which must be valid.
|
|
69
59
|
- (void)renewSession;
|
|
Binary file
|
package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/PrivacyInfo.xcprivacy
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>NSPrivacyCollectedDataTypes</key>
|
|
6
|
+
<array/>
|
|
7
|
+
<key>NSPrivacyAccessedAPITypes</key>
|
|
8
|
+
<array/>
|
|
9
|
+
<key>NSPrivacyTrackingDomains</key>
|
|
10
|
+
<array/>
|
|
11
|
+
<key>NSPrivacyTracking</key>
|
|
12
|
+
<false/>
|
|
13
|
+
</dict>
|
|
14
|
+
</plist>
|
|
Binary file
|
|
@@ -166,24 +166,26 @@ typedef NS_ENUM(NSUInteger, SPTAppRemoteLogLevel) {
|
|
|
166
166
|
* The passed URI will start playing unless Spotify is already playing.
|
|
167
167
|
*
|
|
168
168
|
* @param URI The URI to play. Use a blank string to attempt to play the user's last song
|
|
169
|
+
* @param completionHandler `YES` if the Spotify app is installed and an authorization attempt can be made, otherwise `NO`.
|
|
169
170
|
*
|
|
170
|
-
* @return `YES` if the Spotify app is installed and an authorization attempt can be made, otherwise `NO`.
|
|
171
171
|
* Note: The return `BOOL` here is not a measure of whether or not authentication succeeded, only a check if
|
|
172
172
|
* the Spotify app is installed and can attempt to handle the authorization request.
|
|
173
173
|
*/
|
|
174
|
-
- (
|
|
174
|
+
- (void)authorizeAndPlayURI:(NSString *)URI completionHandler:(void (^ __nullable)(BOOL success))completionHandler;
|
|
175
175
|
|
|
176
176
|
/**
|
|
177
177
|
* Open Spotify app to obtain access token and start playback.
|
|
178
178
|
*
|
|
179
179
|
* @param playURI The URI to play. Use a blank string to attempt to play the user's last song
|
|
180
180
|
* @param asRadio `YES` to start radio for the given URI.
|
|
181
|
+
* @param completionHandler `YES` if the Spotify app is installed and an authorization attempt can be made, otherwise `NO`.
|
|
181
182
|
*
|
|
182
|
-
* @return `YES` if the Spotify app is installed and an authorization attempt can be made, otherwise `NO`.
|
|
183
183
|
* Note: The return `BOOL` here is not a measure of whether or not authentication succeeded, only a check if
|
|
184
184
|
* the Spotify app is installed and can attempt to handle the authorization request.
|
|
185
185
|
*/
|
|
186
|
-
- (
|
|
186
|
+
- (void)authorizeAndPlayURI:(NSString *)playURI
|
|
187
|
+
asRadio:(BOOL)asRadio
|
|
188
|
+
completionHandler:(void (^ __nullable)(BOOL success))completionHandler;
|
|
187
189
|
|
|
188
190
|
/**
|
|
189
191
|
* Open Spotify app to obtain access token and start playback.
|
|
@@ -191,14 +193,15 @@ typedef NS_ENUM(NSUInteger, SPTAppRemoteLogLevel) {
|
|
|
191
193
|
* @param playURI The URI to play. Use a blank string to attempt to play the user's last song
|
|
192
194
|
* @param asRadio `YES` to start radio for the given URI.
|
|
193
195
|
* @param additionalScopes An array of scopes in addition to `app-remote-control`. Can be nil if you only need `app-remote-control`
|
|
196
|
+
* @param completionHandler `YES` if the Spotify app is installed and an authorization attempt can be made, otherwise `NO`.
|
|
194
197
|
*
|
|
195
|
-
* @return `YES` if the Spotify app is installed and an authorization attempt can be made, otherwise `NO`.
|
|
196
198
|
* Note: The return `BOOL` here is not a measure of whether or not authentication succeeded, only a check if
|
|
197
199
|
* the Spotify app is installed and can attempt to handle the authorization request.
|
|
198
200
|
*/
|
|
199
|
-
- (
|
|
201
|
+
- (void)authorizeAndPlayURI:(NSString *)playURI
|
|
200
202
|
asRadio:(BOOL)asRadio
|
|
201
|
-
additionalScopes:(nullable NSArray<NSString *> *)additionalScopes
|
|
203
|
+
additionalScopes:(nullable NSArray<NSString *> *)additionalScopes
|
|
204
|
+
completionHandler:(void (^ __nullable)(BOOL success))completionHandler;
|
|
202
205
|
|
|
203
206
|
/**
|
|
204
207
|
* Open Spotify app to obtain access token and start playback.
|
|
@@ -209,15 +212,16 @@ typedef NS_ENUM(NSUInteger, SPTAppRemoteLogLevel) {
|
|
|
209
212
|
* @param sessionIdentifier An optional unique identifier for this specific session, which is used for analytics purposes. Every new attempt to
|
|
210
213
|
* connect to the Spotify app should have a new identifier, but the identifier used here should then be reused for the accompanied call to
|
|
211
214
|
* `connectWithSessionIdentifier:`.
|
|
215
|
+
* @param completionHandler `YES` if the Spotify app is installed and an authorization attempt can be made, otherwise `NO`.
|
|
212
216
|
*
|
|
213
|
-
* @return `YES` if the Spotify app is installed and an authorization attempt can be made, otherwise `NO`.
|
|
214
217
|
* Note: The return `BOOL` here is not a measure of whether or not authentication succeeded, only a check if
|
|
215
218
|
* the Spotify app is installed and can attempt to handle the authorization request.
|
|
216
219
|
*/
|
|
217
|
-
- (
|
|
220
|
+
- (void)authorizeAndPlayURI:(NSString *)playURI
|
|
218
221
|
asRadio:(BOOL)asRadio
|
|
219
222
|
additionalScopes:(nullable NSArray<NSString *> *)additionalScopes
|
|
220
|
-
sessionIdentifier:(nullable NSUUID *)sessionIdentifier
|
|
223
|
+
sessionIdentifier:(nullable NSUUID *)sessionIdentifier
|
|
224
|
+
completionHandler:(void (^ __nullable)(BOOL success))completionHandler;
|
|
221
225
|
/**
|
|
222
226
|
* Parse out an access token or error description from a url passed to application:openURL:options:
|
|
223
227
|
*
|
|
@@ -33,6 +33,9 @@ NS_ASSUME_NONNULL_BEGIN
|
|
|
33
33
|
/// Returns `YES` if the item is expected to contain children, otherwise `NO`.
|
|
34
34
|
@property (nonatomic, assign, readonly, getter=isContainer) BOOL container;
|
|
35
35
|
|
|
36
|
+
/// Returns `YES` if the item is pinned in Your Library, otherwise `NO`.
|
|
37
|
+
@property (nonatomic, assign, readonly, getter=isPinned) BOOL pinnned;
|
|
38
|
+
|
|
36
39
|
/**
|
|
37
40
|
A list of the content item's children.
|
|
38
41
|
|
|
@@ -44,26 +44,16 @@ typedef NSString * const SPTAuthorizationCode;
|
|
|
44
44
|
- (instancetype)init NS_UNAVAILABLE;
|
|
45
45
|
|
|
46
46
|
/**
|
|
47
|
-
Initiate the authorization process
|
|
47
|
+
Initiate the authorization process
|
|
48
48
|
|
|
49
49
|
@param scope The scope to request, e.g. `SPTPlaylistReadPrivateScope`|`SPTUserReadEmailScope` if you wish to request read access to private playlists, and read access to the user's email address.
|
|
50
50
|
@param options Options bitmask that informs authorization behavior.
|
|
51
|
-
|
|
52
|
-
*/
|
|
53
|
-
- (void)initiateSessionWithScope:(SPTScope)scope
|
|
54
|
-
options:(SPTAuthorizationOptions)options NS_AVAILABLE_IOS(11_0);
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
Initiate the authorization process on iOS versions < 11.
|
|
58
|
-
|
|
59
|
-
@param scope The scope to request, e.g. `SPTPlaylistReadPrivateScope`|`SPTUserReadEmailScope` if you wish to request read access to private playlists, and read access to the user's email address.
|
|
60
|
-
@param options Options bitmask that informs authorization behavior.
|
|
61
|
-
@param presentingViewController The `UIViewController` to present the login `SFSafariViewController` on
|
|
51
|
+
@param campaign The campaign identifier, to help attribute where the account linking was initiated from.
|
|
62
52
|
See `SPTSessionManagerDelegate` for messages regarding changes in session state.
|
|
63
53
|
*/
|
|
64
54
|
- (void)initiateSessionWithScope:(SPTScope)scope
|
|
65
55
|
options:(SPTAuthorizationOptions)options
|
|
66
|
-
|
|
56
|
+
campaign:(nullable NSString *)campaign;
|
|
67
57
|
|
|
68
58
|
/// Attempt to renew the access token, using the refresh token in the current `SPTSession` which must be valid.
|
|
69
59
|
- (void)renewSession;
|
|
Binary file
|