@wwdrew/expo-spotify-sdk 0.3.1 → 0.4.1

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.
Files changed (100) hide show
  1. package/README.md +37 -4
  2. package/android/build.gradle +49 -0
  3. package/android/src/main/AndroidManifest.xml +11 -0
  4. package/android/src/main/java/expo/modules/spotifysdk/ExpoSpotifySDKModule.kt +180 -0
  5. package/build/ExpoSpotifySDK.types.d.ts +0 -1
  6. package/build/ExpoSpotifySDK.types.d.ts.map +1 -1
  7. package/build/ExpoSpotifySDK.types.js.map +1 -1
  8. package/external/android/SpotifySDK/auth-lib/spotify-auth-release-2.1.0.aar +0 -0
  9. package/ios/ExpoSpotifySDKModule.swift +1 -3
  10. package/ios/ExpoSpotifySessionManager.swift +3 -3
  11. package/ios/SpotifySDK/SpotifyiOS.xcframework/Info.plist +9 -5
  12. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTAppRemote.h +14 -10
  13. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTAppRemoteContentItem.h +3 -0
  14. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTSessionManager.h +3 -13
  15. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SpotifyAppRemote.h +2 -0
  16. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Info.plist +0 -0
  17. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Modules/module.modulemap +1 -1
  18. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/PrivacyInfo.xcprivacy +14 -0
  19. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/SpotifyiOS +0 -0
  20. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemote.h +14 -10
  21. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemoteContentItem.h +3 -0
  22. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SPTSessionManager.h +3 -13
  23. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SpotifyAppRemote.h +2 -0
  24. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Info.plist +0 -0
  25. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Modules/module.modulemap +1 -1
  26. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/PrivacyInfo.xcprivacy +14 -0
  27. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/SpotifyiOS +0 -0
  28. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/_CodeSignature/CodeResources +20 -133
  29. package/package.json +3 -1
  30. package/plugin/build/android/withSpotifyAndroidAppBuildGradle.js +18 -2
  31. package/plugin/build/index.js +2 -2
  32. package/plugin/build/ios/{withSpotifyConfigIOS.d.ts → withSpotifyConfigValues.d.ts} +1 -1
  33. package/plugin/build/ios/{withSpotifyConfigIOS.js → withSpotifyConfigValues.js} +3 -3
  34. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_armv7/SpotifyiOS.framework/Headers/SPTAppRemote.h +0 -240
  35. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_armv7/SpotifyiOS.framework/Headers/SPTAppRemoteAlbum.h +0 -18
  36. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_armv7/SpotifyiOS.framework/Headers/SPTAppRemoteArtist.h +0 -18
  37. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_armv7/SpotifyiOS.framework/Headers/SPTAppRemoteCommon.h +0 -36
  38. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_armv7/SpotifyiOS.framework/Headers/SPTAppRemoteConnectionParams.h +0 -65
  39. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_armv7/SpotifyiOS.framework/Headers/SPTAppRemoteContentAPI.h +0 -75
  40. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_armv7/SpotifyiOS.framework/Headers/SPTAppRemoteContentItem.h +0 -43
  41. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_armv7/SpotifyiOS.framework/Headers/SPTAppRemoteCrossfadeState.h +0 -18
  42. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_armv7/SpotifyiOS.framework/Headers/SPTAppRemoteImageAPI.h +0 -25
  43. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_armv7/SpotifyiOS.framework/Headers/SPTAppRemoteImageRepresentable.h +0 -16
  44. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_armv7/SpotifyiOS.framework/Headers/SPTAppRemoteLibraryState.h +0 -19
  45. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_armv7/SpotifyiOS.framework/Headers/SPTAppRemotePlaybackOptions.h +0 -32
  46. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_armv7/SpotifyiOS.framework/Headers/SPTAppRemotePlaybackRestrictions.h +0 -32
  47. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_armv7/SpotifyiOS.framework/Headers/SPTAppRemotePlayerAPI.h +0 -262
  48. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_armv7/SpotifyiOS.framework/Headers/SPTAppRemotePlayerState.h +0 -40
  49. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_armv7/SpotifyiOS.framework/Headers/SPTAppRemotePodcastPlaybackSpeed.h +0 -15
  50. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_armv7/SpotifyiOS.framework/Headers/SPTAppRemoteTrack.h +0 -47
  51. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_armv7/SpotifyiOS.framework/Headers/SPTAppRemoteUserAPI.h +0 -103
  52. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_armv7/SpotifyiOS.framework/Headers/SPTAppRemoteUserCapabilities.h +0 -15
  53. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_armv7/SpotifyiOS.framework/Headers/SPTConfiguration.h +0 -63
  54. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_armv7/SpotifyiOS.framework/Headers/SPTError.h +0 -33
  55. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_armv7/SpotifyiOS.framework/Headers/SPTLogin.h +0 -10
  56. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_armv7/SpotifyiOS.framework/Headers/SPTMacros.h +0 -89
  57. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_armv7/SpotifyiOS.framework/Headers/SPTScope.h +0 -68
  58. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_armv7/SpotifyiOS.framework/Headers/SPTSession.h +0 -32
  59. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_armv7/SpotifyiOS.framework/Headers/SPTSessionManager.h +0 -140
  60. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_armv7/SpotifyiOS.framework/Headers/SpotifyAppRemote.h +0 -30
  61. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_armv7/SpotifyiOS.framework/Headers/SpotifyiOS.h +0 -7
  62. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_armv7/SpotifyiOS.framework/Info.plist +0 -0
  63. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_armv7/SpotifyiOS.framework/Modules/module.modulemap +0 -6
  64. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_armv7/SpotifyiOS.framework/SpotifyiOS +0 -0
  65. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_i386_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemote.h +0 -240
  66. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_i386_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemoteAlbum.h +0 -18
  67. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_i386_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemoteArtist.h +0 -18
  68. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_i386_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemoteCommon.h +0 -36
  69. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_i386_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemoteConnectionParams.h +0 -65
  70. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_i386_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemoteContentAPI.h +0 -75
  71. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_i386_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemoteContentItem.h +0 -43
  72. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_i386_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemoteCrossfadeState.h +0 -18
  73. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_i386_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemoteImageAPI.h +0 -25
  74. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_i386_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemoteImageRepresentable.h +0 -16
  75. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_i386_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemoteLibraryState.h +0 -19
  76. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_i386_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemotePlaybackOptions.h +0 -32
  77. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_i386_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemotePlaybackRestrictions.h +0 -32
  78. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_i386_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemotePlayerAPI.h +0 -262
  79. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_i386_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemotePlayerState.h +0 -40
  80. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_i386_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemotePodcastPlaybackSpeed.h +0 -15
  81. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_i386_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemoteTrack.h +0 -47
  82. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_i386_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemoteUserAPI.h +0 -103
  83. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_i386_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemoteUserCapabilities.h +0 -15
  84. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_i386_x86_64-simulator/SpotifyiOS.framework/Headers/SPTConfiguration.h +0 -63
  85. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_i386_x86_64-simulator/SpotifyiOS.framework/Headers/SPTError.h +0 -33
  86. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_i386_x86_64-simulator/SpotifyiOS.framework/Headers/SPTLogin.h +0 -10
  87. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_i386_x86_64-simulator/SpotifyiOS.framework/Headers/SPTMacros.h +0 -89
  88. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_i386_x86_64-simulator/SpotifyiOS.framework/Headers/SPTScope.h +0 -68
  89. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_i386_x86_64-simulator/SpotifyiOS.framework/Headers/SPTSession.h +0 -32
  90. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_i386_x86_64-simulator/SpotifyiOS.framework/Headers/SPTSessionManager.h +0 -140
  91. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_i386_x86_64-simulator/SpotifyiOS.framework/Headers/SpotifyAppRemote.h +0 -30
  92. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_i386_x86_64-simulator/SpotifyiOS.framework/Headers/SpotifyiOS.h +0 -7
  93. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_i386_x86_64-simulator/SpotifyiOS.framework/Info.plist +0 -0
  94. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_i386_x86_64-simulator/SpotifyiOS.framework/Modules/module.modulemap +0 -6
  95. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_i386_x86_64-simulator/SpotifyiOS.framework/SpotifyiOS +0 -0
  96. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_i386_x86_64-simulator/SpotifyiOS.framework/_CodeSignature/CodeResources +0 -537
  97. package/plugin/build/android/withSpotifyConfigAndroid.d.ts +0 -3
  98. package/plugin/build/android/withSpotifyConfigAndroid.js +0 -16
  99. package/plugin/build/withSpotifyConfig.d.ts +0 -3
  100. package/plugin/build/withSpotifyConfig.js +0 -11
@@ -1,103 +0,0 @@
1
- #import <Foundation/Foundation.h>
2
-
3
- #import "SPTAppRemoteCommon.h"
4
-
5
- @protocol SPTAppRemoteUserAPI;
6
- @protocol SPTAppRemoteUserCapabilities;
7
-
8
- NS_ASSUME_NONNULL_BEGIN
9
-
10
- /**
11
- * The `SPTAppRemoteUserAPIDelegate` gets notified whenever the user API receives new data from subscription events.
12
- */
13
- @protocol SPTAppRemoteUserAPIDelegate <NSObject>
14
-
15
- /**
16
- * Called when the capabilities has been updated.
17
- *
18
- * @note This will only be called if there is an active capabilities subscription.
19
- *
20
- * @param userAPI The API that received updates.
21
- * @param capabilities The new capabilities that was received.
22
- */
23
- - (void)userAPI:(id<SPTAppRemoteUserAPI>)userAPI didReceiveCapabilities:(id<SPTAppRemoteUserCapabilities>)capabilities;
24
-
25
- @end
26
-
27
- /**
28
- * The `SPTAppRemoteUserAPI` is used to get user data from, and interact with user features in, the Spotify app.
29
- */
30
- @protocol SPTAppRemoteUserAPI <NSObject>
31
-
32
- /// The User API delegate gets notified whenever the API receives new data from subscription events.
33
- @property (nonatomic, weak, readwrite) id<SPTAppRemoteUserAPIDelegate> delegate;
34
-
35
- /**
36
- * Fetches the current users capabilities from the Spotify app.
37
- *
38
- * @param callback A callback block that will be invoked when the fetch request has completed.
39
- * On success `result` will be an instance of `id<SPTAppRemoteUserCapabilities>`.
40
- * On error `result` will be `nil` and `error` will be set.
41
- */
42
- - (void)fetchCapabilitiesWithCallback:(nullable SPTAppRemoteCallback)callback;
43
-
44
- /**
45
- * Subscribes to capability changes from the Spotify app.
46
- *
47
- * @note Implement `SPTAppRemoteUserAPIDelegate` and set yourself as `delegate` in order to be notified when the
48
- * the capabilities changes.
49
- *
50
- * @param callback A callback block that will be invoked when the subscription request has completed.
51
- * On success `result` will `YES`.
52
- * On error `result` will be `nil` and `error` will be set.
53
- */
54
- - (void)subscribeToCapabilityChanges:(nullable SPTAppRemoteCallback)callback;
55
-
56
- /**
57
- * Stops subscribing to capability changes from the Spotify app.
58
- *
59
- * @param callback A callback block that will be invoked when the unsubscription request has completed.
60
- * On success `result` will be `YES`.
61
- * On error `result` will be `nil` and `error` will be set.
62
- */
63
- - (void)unsubscribeToCapabilityChanges:(nullable SPTAppRemoteCallback)callback;
64
-
65
- /**
66
- * Fetches the current users library state for a given album or track uri.
67
- *
68
- * @param URI The URI of the album or track we are fetching the state for
69
- * @param callback A callback block that will be invoked when the fetch request has completed.
70
- * On success `result` will be an instance of `id<SPTAppRemoteLibraryState>`.
71
- * On error `result` will be `nil` and `error` will be set.
72
- */
73
- - (void)fetchLibraryStateForURI:(NSString *)URI callback:(SPTAppRemoteCallback)callback;
74
-
75
- /**
76
- * Add item to the users library.
77
- * Currently supported uris include:
78
- * Tracks - example: spotify:track:6rqhFgbbKwnb9MLmUQDhG6
79
- * Albums - example: spotify:album:2VYSDvc0ZdcfkXDcYVjHs6
80
- *
81
- * @param URI The URI of the item to save
82
- * @param callback A callback block that will be invoked when the fetch request has completed.
83
- * On success `result` will be @YES.
84
- * On error `result` will be `nil` and `error` will be set.
85
- */
86
- - (void)addItemToLibraryWithURI:(NSString *)URI callback:(SPTAppRemoteCallback)callback;
87
-
88
- /**
89
- * Remove item from users library.
90
- * Currently supported uris include:
91
- * Tracks - example: spotify:track:6rqhFgbbKwnb9MLmUQDhG6
92
- * Albums - example: spotify:album:2VYSDvc0ZdcfkXDcYVjHs6
93
- *
94
- * @param URI The URI of the item to remove
95
- * @param callback A callback block that will be invoked when the fetch request has completed.
96
- * On success `result` will be @YES.
97
- * On error `result` will be `nil` and `error` will be set.
98
- */
99
- - (void)removeItemFromLibraryWithURI:(NSString *)URI callback:(SPTAppRemoteCallback)callback;
100
-
101
- @end
102
-
103
- 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,63 +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
- /**
18
- The URL to use for attempting to swap an authorization code for an access token. You should only set this if your
19
- clientID has a clientSecret and you have a backend service that holds the secret and can exchange the code and secret
20
- for an access token.
21
- */
22
- @property (nonatomic, nullable, copy) NSURL *tokenSwapURL;
23
-
24
- /**
25
- The URL to use for attempting to renew an access token with a refresh token. You should only set this if your
26
- clientID has a clientSecret and you have a backend service that holds the secret and can use a refresh token
27
- to get a new access token.
28
- */
29
- @property (nonatomic, nullable, copy) NSURL *tokenRefreshURL;
30
-
31
- /**
32
- If requesting the `SPTAppRemoteControlScope` you can provide an optional uri to begin playing after a successful
33
- authentication. To continue the user's last session set this to a blank string @"". If this value is `nil` or `SPTAppRemoteControlScope`
34
- is not requested no audio will play.
35
- */
36
- @property (nonatomic, nullable, copy) NSString *playURI;
37
-
38
- - (instancetype)init NS_UNAVAILABLE;
39
-
40
- /**
41
- Designated initializer for `SPTConfiguration`
42
-
43
- @param clientID Your client ID obtained from developer.spotify.com
44
- @param redirectURL Your redirect URL for Spotify to open your app again after authorization
45
- @return A newly initialized `SPTConfiguration`
46
- */
47
- - (instancetype)initWithClientID:(NSString *)clientID
48
- redirectURL:(NSURL *)redirectURL NS_DESIGNATED_INITIALIZER;
49
-
50
- /**
51
- Convenience intializer for `SPtConfiguration`
52
-
53
- @param clientID Your client ID obtained from developer.spotify.com
54
- @param redirectURL Your redirect URL for Spotify to open your app again after authorization
55
- @return A newly initialized `SPTConfiguration`
56
- */
57
- + (instancetype)configurationWithClientID:(NSString *)clientID
58
- redirectURL:(NSURL *)redirectURL NS_SWIFT_UNAVAILABLE("superfluous");
59
-
60
- @end
61
-
62
-
63
- NS_ASSUME_NONNULL_END
@@ -1,33 +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
- {
12
- /// Unknown error code
13
- SPTUnknownErrorCode NS_SWIFT_NAME(unknown) = 0,
14
- /// Authorization failed
15
- SPTAuthorizationFailedErrorCode NS_SWIFT_NAME(authorizationFailed),
16
- /// Renew session failed
17
- SPTRenewSessionFailedErrorCode NS_SWIFT_NAME(renewSessionFailed),
18
- /// Failed to parse the returned JSON
19
- SPTJSONFailedErrorCode NS_SWIFT_NAME(jsonFailed),
20
- };
21
-
22
- /// Spotify-specific errors. Use NSUnderlyingErrorKey to see the underlying error
23
- @interface SPTError : NSError
24
-
25
- + (instancetype)errorWithCode:(SPTErrorCode)code;
26
-
27
- + (instancetype)errorWithCode:(SPTErrorCode)code description:(NSString *)description;
28
-
29
- + (instancetype)errorWithCode:(SPTErrorCode)code underlyingError:(NSError *)error;
30
-
31
- @end
32
-
33
- NS_ASSUME_NONNULL_END
@@ -1,10 +0,0 @@
1
- #ifndef _SPOTIFYLOGIN_
2
- #define _SPOTIFYLOGIN_
3
-
4
- #import "SPTConfiguration.h"
5
- #import "SPTError.h"
6
- #import "SPTScope.h"
7
- #import "SPTSession.h"
8
- #import "SPTSessionManager.h"
9
-
10
- #endif /* _SPOTIFYLOGIN_ */
@@ -1,89 +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, ...) do { \
52
- if ([RECEIVER respondsToSelector:@selector(SPT_CONCAT_SELECTOR(__VA_ARGS__))]) \
53
- *(RESULT) = [RECEIVER SPT_CONCAT_METHOD(__VA_ARGS__)]; \
54
- } while (0)
55
-
56
- /**
57
- Like SPT_OPTIONAL_MESSAGE_SEND but ignores the return value.
58
- @param RECEIVER The object to which the message will be sent.
59
- @param ... 0-4 arguments.
60
- */
61
- #define SPT_OPTIONAL_MESSAGE_SEND_(RECEIVER, ...) do { \
62
- if ([RECEIVER respondsToSelector:@selector(SPT_CONCAT_SELECTOR(__VA_ARGS__))]) \
63
- [RECEIVER SPT_CONCAT_METHOD(__VA_ARGS__)]; \
64
- } while (0)
65
-
66
- // Some boilerplate for SPT_OPTIONAL_MESSAGE_SEND[_]
67
- #define SPT_CONCAT_METHOD8(A, _1, B, _2, C, _3, D, _4) A:_1 B:_2 C:_3 D:_4
68
- #define SPT_CONCAT_METHOD6(A, _1, B, _2, C, _3) A:_1 B:_2 C:_3
69
- #define SPT_CONCAT_METHOD4(A, _1, B, _2) A:_1 B:_2
70
- #define SPT_CONCAT_METHOD2(A, _1) A:_1
71
- #define SPT_CONCAT_METHOD1(A) A
72
-
73
- #define SPT_CONCAT_SELECTOR8(A, _1, B, _2, C, _3, D, _4) A:B:C:D:
74
- #define SPT_CONCAT_SELECTOR6(A, _1, B, _2, C, _3) A:B:C:
75
- #define SPT_CONCAT_SELECTOR4(A, _1, B, _2) A:B:
76
- #define SPT_CONCAT_SELECTOR2(A, _1) A:
77
- #define SPT_CONCAT_SELECTOR1(A) A
78
-
79
- #define SPT_PICK_CONCAT_MACRO(_1, _2, _3, _4, _5, _6, _7, _8, NAME, ...) NAME
80
-
81
- #define SPT_CONCAT_METHOD(...) SPT_PICK_CONCAT_MACRO(__VA_ARGS__, \
82
- SPT_CONCAT_METHOD8, SPT_CONCAT_METHOD7, SPT_CONCAT_METHOD6, SPT_CONCAT_METHOD5, \
83
- SPT_CONCAT_METHOD4, SPT_CONCAT_METHOD3, SPT_CONCAT_METHOD2, SPT_CONCAT_METHOD1)(__VA_ARGS__)
84
-
85
- #define SPT_CONCAT_SELECTOR(...) SPT_PICK_CONCAT_MACRO(__VA_ARGS__, \
86
- SPT_CONCAT_SELECTOR8, SPT_CONCAT_SELECTOR7, SPT_CONCAT_SELECTOR6, SPT_CONCAT_SELECTOR5, \
87
- SPT_CONCAT_SELECTOR4, SPT_CONCAT_SELECTOR3, SPT_CONCAT_SELECTOR2, SPT_CONCAT_SELECTOR1)(__VA_ARGS__)
88
-
89
- #endif // SPT_MACROS
@@ -1,68 +0,0 @@
1
- // (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
-
23
- /**
24
- `SPTScope` represents the OAuth scopes that declare how your app wants to access a user's account.
25
- See https://developer.spotify.com/web-api/using-scopes/ for more information.
26
- */
27
- typedef NS_OPTIONS(NSUInteger, SPTScope)
28
- {
29
- /// Read access to user's private playlists.
30
- SPTPlaylistReadPrivateScope NS_SWIFT_NAME(playlistReadPrivate) = (1 << 0),
31
- /// Include collaborative playlists when requesting a user's playlists.
32
- SPTPlaylistReadCollaborativeScope NS_SWIFT_NAME(playlistReadCollaborative) = (1 << 1),
33
- /// Write access to a user's public playlists.
34
- SPTPlaylistModifyPublicScope NS_SWIFT_NAME(playlistModifyPublic) = (1 << 2),
35
- /// Write access to a user's private playlists.
36
- SPTPlaylistModifyPrivateScope NS_SWIFT_NAME(playlistModifyPrivate) = (1 << 3),
37
- /// Read access to the list of artists and other users that the user follows.
38
- SPTUserFollowReadScope NS_SWIFT_NAME(userFollowRead) = (1 << 4),
39
- /// Write/delete access to the list of artists and other users that the user follows.
40
- SPTUserFollowModifyScope NS_SWIFT_NAME(userFollowModify) = (1 << 5),
41
- /// Read access to a user's "Your Music" library.
42
- SPTUserLibraryReadScope NS_SWIFT_NAME(userLibraryRead) = (1 << 6),
43
- /// Write/delete access to a user's "Your Music" library.
44
- SPTUserLibraryModifyScope NS_SWIFT_NAME(userLibraryModify) = (1 << 7),
45
- /// Read access to the user's birthdate.
46
- SPTUserReadBirthDateScope NS_SWIFT_NAME(userReadBirthDate) = (1 << 8),
47
- /// Read access to user’s email address.
48
- SPTUserReadEmailScope NS_SWIFT_NAME(userReadEmail) = (1 << 9),
49
- /// Read access to user’s subscription details (type of user account).
50
- SPTUserReadPrivateScope NS_SWIFT_NAME(userReadPrivate) = (1 << 10),
51
- /// Read access to a user's top artists and tracks.
52
- SPTUserTopReadScope NS_SWIFT_NAME(userTopRead) = (1 << 11),
53
- /// Upload user generated content images
54
- SPTUGCImageUploadScope NS_SWIFT_NAME(ugcImageUpload) = (1 << 12),
55
- /// Control playback of a Spotify track.
56
- SPTStreamingScope NS_SWIFT_NAME(streaming) = (1 << 13),
57
- /// Use App Remote to control playback in the Spotify app
58
- SPTAppRemoteControlScope NS_SWIFT_NAME(appRemoteControl) = (1 << 14),
59
- /// Read access to a user’s player state.
60
- SPTUserReadPlaybackStateScope NS_SWIFT_NAME(userReadPlaybackState) = (1 << 15),
61
- /// Write access to a user’s playback state
62
- SPTUserModifyPlaybackStateScope NS_SWIFT_NAME(userModifyPlaybackState) = (1 << 16),
63
- /// Read access to a user’s currently playing track
64
- SPTUserReadCurrentlyPlayingScope NS_SWIFT_NAME(userReadCurrentlyPlaying) = (1 << 17),
65
- /// Read access to a user’s currently playing track
66
- SPTUserReadRecentlyPlayedScope NS_SWIFT_NAME(userReadRecentlyPlayed) = (1 << 18),
67
- };
68
-
@@ -1,32 +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 and time.
24
- */
25
- @property (nonatomic, readonly, getter=isExpired) BOOL expired;
26
-
27
- - (instancetype)init NS_UNAVAILABLE;
28
-
29
- @end
30
-
31
-
32
- NS_ASSUME_NONNULL_END
@@ -1,140 +0,0 @@
1
- #import <UIKit/UIKit.h>
2
- #import "SPTScope.h"
3
-
4
- NS_ASSUME_NONNULL_BEGIN
5
-
6
- @class SPTConfiguration, SPTSession;
7
- @protocol SPTSessionManagerDelegate;
8
-
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
13
- SPTDefaultAuthorizationOption NS_SWIFT_NAME(default) = (0),
14
- /// Authorize using only the Spotify client. If Spotify is not installed authorization will fail.
15
- SPTClientAuthorizationOption NS_SWIFT_NAME(clientOnly) = (1 << 0),
16
- } NS_SWIFT_NAME(AuthorizationOptions);
17
-
18
- typedef NSString * const SPTAuthorizationCode;
19
-
20
-
21
- /// This class manages a Spotify user session, in the form of `SPTSession`.
22
- @interface SPTSessionManager : NSObject
23
-
24
- /// The `SPTSession` for the `SPTSessionManager` to manage. If no user has been authenticated this will be nil
25
- @property (nullable, nonatomic, strong) SPTSession *session;
26
-
27
- /// The `SPTSessionManagerDelegate` to notify of initiating a session, renewing a session, and/or errors related to a session
28
- @property (nullable, nonatomic, weak) id <SPTSessionManagerDelegate> delegate;
29
-
30
- /**
31
- Determine if the Spotify app is installed.
32
-
33
- 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 NO
35
- */
36
- @property (nonatomic, readonly, getter=isSpotifyAppInstalled) BOOL spotifyAppInstalled;
37
-
38
- /**
39
- Set this value to `YES` when debugging to have the Spotify app always show the authorization confirmation screen.
40
- You SHOULD NOT set this value to `YES` in production or your users will always have to confirm.
41
- */
42
- @property (nonatomic, assign) BOOL alwaysShowAuthorizationDialog;
43
-
44
- - (instancetype)init NS_UNAVAILABLE;
45
-
46
- /**
47
- Initiate the authorization process on iOS 11 and later.
48
-
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
- @param options Options bitmask that informs authorization behavior.
51
- See `SPTSessionManagerDelegate` for messages regarding changes in session state.
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
62
- See `SPTSessionManagerDelegate` for messages regarding changes in session state.
63
- */
64
- - (void)initiateSessionWithScope:(SPTScope)scope
65
- options:(SPTAuthorizationOptions)options
66
- presentingViewController: (UIViewController *)presentingViewController NS_DEPRECATED_IOS(9_0, 11_0);
67
-
68
- /// Attempt to renew the access token, using the refresh token in the current `SPTSession` which must be valid.
69
- - (void)renewSession;
70
-
71
- /**
72
- Create an `SPTSessionManager` with the provided configuration.
73
-
74
- @param configuration An `SPTConfiguration` object.
75
- @param delegate An optional delegate conforming to `SPTSessionManagerDelegate`.
76
- @return An `SPTSessionManager` with the desired configuration.
77
- */
78
- - (instancetype)initWithConfiguration:(SPTConfiguration *)configuration
79
- delegate:(nullable id <SPTSessionManagerDelegate>)delegate;
80
-
81
- + (instancetype)sessionManagerWithConfiguration:(SPTConfiguration *)configuration
82
- delegate:(nullable id <SPTSessionManagerDelegate>)delegate;
83
- /**
84
- Handle openURL callbacks from the `AppDelegate`
85
-
86
- @param application The `UIApplication` passed into the matching `AppDelegate` method
87
- @param URL The URL to attempt to parse the access token from
88
- @param options The options passed in to the matching `AppDelegate` method
89
- @return Returns `YES` if `SPTSessionManager` recognizes the URL and will attempt to parse an access token, otherwise returns `NO`.
90
- */
91
- - (BOOL)application:(UIApplication *)application
92
- openURL:(NSURL *)URL
93
- options:(NSDictionary<UIApplicationOpenURLOptionsKey, id> *)options;
94
-
95
- @end
96
-
97
- /// The `SPTSessionManagerDelegate` to use for monitoring state changes of a `SPTSessionManager`
98
- @protocol SPTSessionManagerDelegate <NSObject>
99
-
100
- /**
101
- This message is sent when a session has been initiated successfully.
102
-
103
- @param manager The `SPTSessionManager` that initiated the session.
104
- @param session The initiated `SPTSession` object.
105
- */
106
- - (void)sessionManager:(SPTSessionManager *)manager didInitiateSession:(SPTSession *)session NS_SWIFT_NAME(sessionManager(manager:didInitiate:));
107
-
108
- /**
109
- This message is sent when the manager failed to initiate or renew a session.
110
-
111
- @param manager The `SPTSessionManager` instance.
112
- @param error The `NSError` that occured.
113
- */
114
- - (void)sessionManager:(SPTSessionManager *)manager didFailWithError:(NSError *)error NS_SWIFT_NAME(sessionManager(manager:didFailWith:));
115
-
116
- @optional
117
-
118
- /**
119
- This message is sent when the manager has renewed a session.
120
-
121
- @param manager The `SPTSessionManager` instance.
122
- @param session The renewed `SPTSession` object.
123
- */
124
- - (void)sessionManager:(SPTSessionManager *)manager didRenewSession:(SPTSession *)session NS_SWIFT_NAME(sessionManager(manager:didRenew:));
125
-
126
- /**
127
- Sent when the `SPTSessionManager` has obtained an authorization code,
128
- and is about to swap it for an access token. If you wish to handle this
129
- yourself, return `NO` and use the provided authorization code.
130
-
131
- @param manager The `SPTSessionManager` instance.
132
- @param code An OAuth authorization code.
133
- @return `NO` to request the access token yourself; `YES` to let `SPTSessionManager` handle it.
134
- */
135
- - (BOOL)sessionManager:(SPTSessionManager *)manager shouldRequestAccessTokenWithAuthorizationCode:(SPTAuthorizationCode)code NS_SWIFT_NAME(sessionManager(manager:shouldRequestAccessTokenWith:));
136
-
137
- @end
138
-
139
-
140
- NS_ASSUME_NONNULL_END
@@ -1,30 +0,0 @@
1
- #import <Foundation/Foundation.h>
2
-
3
- #ifndef _SPOTIFYAPPREMOTE_
4
- #define _SPOTIFYAPPREMOTE_
5
-
6
- #import "SPTAppRemote.h"
7
- #import "SPTAppRemoteCommon.h"
8
-
9
- #import "SPTAppRemoteConnectionParams.h"
10
-
11
- #import "SPTAppRemoteImageAPI.h"
12
- #import "SPTAppRemotePlayerAPI.h"
13
- #import "SPTAppRemoteUserAPI.h"
14
- #import "SPTAppRemoteContentAPI.h"
15
-
16
- #import "SPTAppRemoteAlbum.h"
17
- #import "SPTAppRemoteArtist.h"
18
- #import "SPTAppRemotePlaybackOptions.h"
19
- #import "SPTAppRemotePlaybackRestrictions.h"
20
- #import "SPTAppRemotePlayerState.h"
21
- #import "SPTAppRemoteCrossfadeState.h"
22
- #import "SPTAppRemoteTrack.h"
23
- #import "SPTAppRemoteUserCapabilities.h"
24
- #import "SPTAppRemoteLibraryState.h"
25
- #import "SPTAppRemoteContentItem.h"
26
- #import "SPTAppRemotePodcastPlaybackSpeed.h"
27
-
28
- #import "SPTConfiguration.h"
29
-
30
- #endif /* _SPOTIFYAPPREMOTE_ */
@@ -1,7 +0,0 @@
1
- #ifndef _SPOTIFYIOS_
2
- #define _SPOTIFYIOS_
3
-
4
- #import "SpotifyAppRemote.h"
5
- #import "SPTLogin.h"
6
-
7
- #endif /* _SPOTIFYIOS_ */
@@ -1,6 +0,0 @@
1
- framework module SpotifyiOS {
2
- umbrella header "SpotifyiOS.h"
3
-
4
- export *
5
- module * { export * }
6
- }