@wwdrew/expo-spotify-sdk 2.0.0 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. package/README.md +94 -346
  2. package/android/build.gradle +4 -5
  3. package/android/libs/SETUP.md +9 -24
  4. package/android/spotify-native-sdk.gradle +118 -0
  5. package/android/src/main/java/expo/modules/spotifysdk/ExpoSpotifySDKModule.kt +14 -5
  6. package/android/src/main/java/expo/modules/spotifysdk/SpotifyAppRemoteCoordinator.kt +38 -64
  7. package/android/src/main/java/expo/modules/spotifysdk/SpotifyAppRemoteErrorMapping.kt +106 -0
  8. package/android/src/main/java/expo/modules/spotifysdk/SpotifyTokenSwapClient.kt +2 -7
  9. package/build/app-remote/index.d.ts +34 -0
  10. package/build/app-remote/index.d.ts.map +1 -1
  11. package/build/app-remote/index.js +47 -24
  12. package/build/app-remote/index.js.map +1 -1
  13. package/build/auth/index.d.ts.map +1 -1
  14. package/build/auth/index.js +17 -34
  15. package/build/auth/index.js.map +1 -1
  16. package/build/content/index.d.ts.map +1 -1
  17. package/build/content/index.js +12 -25
  18. package/build/content/index.js.map +1 -1
  19. package/build/hooks/index.d.ts +1 -1
  20. package/build/hooks/index.d.ts.map +1 -1
  21. package/build/hooks/index.js +38 -115
  22. package/build/hooks/index.js.map +1 -1
  23. package/build/images/index.d.ts +2 -2
  24. package/build/images/index.d.ts.map +1 -1
  25. package/build/images/index.js +12 -25
  26. package/build/images/index.js.map +1 -1
  27. package/build/index.d.ts +0 -18
  28. package/build/index.d.ts.map +1 -1
  29. package/build/index.js +0 -27
  30. package/build/index.js.map +1 -1
  31. package/build/internal/native-errors.d.ts +14 -0
  32. package/build/internal/native-errors.d.ts.map +1 -0
  33. package/build/internal/native-errors.js +29 -0
  34. package/build/internal/native-errors.js.map +1 -0
  35. package/build/internal/sync-external-store.d.ts +14 -0
  36. package/build/internal/sync-external-store.d.ts.map +1 -0
  37. package/build/internal/sync-external-store.js +36 -0
  38. package/build/internal/sync-external-store.js.map +1 -0
  39. package/build/player/index.d.ts.map +1 -1
  40. package/build/player/index.js +14 -27
  41. package/build/player/index.js.map +1 -1
  42. package/build/user/index.d.ts +2 -2
  43. package/build/user/index.d.ts.map +1 -1
  44. package/build/user/index.js +16 -26
  45. package/build/user/index.js.map +1 -1
  46. package/ios/ExpoSpotifyAppDelegate.swift +8 -1
  47. package/ios/ExpoSpotifySDK.podspec +26 -2
  48. package/ios/ExpoSpotifySDKModule.swift +16 -1
  49. package/ios/SpotifyAppRemoteCoordinator.swift +137 -404
  50. package/ios/SpotifyAppRemoteErrorMapping.swift +110 -0
  51. package/ios/SpotifyAppRemoteErrors.swift +221 -0
  52. package/ios/SpotifyAppRemoteMappers.swift +88 -0
  53. package/ios/spotify-native-sdk-versions.json +12 -0
  54. package/package.json +13 -5
  55. package/plugin/index.d.ts +2 -0
  56. package/plugin/index.js +1 -0
  57. package/ios/SpotifySDK/Licenses/MPMessagePack-LICENSE.md +0 -20
  58. package/ios/SpotifySDK/SpotifyiOS.xcframework/Info.plist +0 -40
  59. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTAppRemote.h +0 -287
  60. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTAppRemoteAlbum.h +0 -18
  61. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTAppRemoteArtist.h +0 -18
  62. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTAppRemoteCommon.h +0 -37
  63. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTAppRemoteConnectionParams.h +0 -65
  64. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTAppRemoteConnectivityAPI.h +0 -55
  65. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTAppRemoteConnectivityState.h +0 -15
  66. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTAppRemoteContentAPI.h +0 -78
  67. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTAppRemoteContentItem.h +0 -49
  68. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTAppRemoteCrossfadeState.h +0 -18
  69. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTAppRemoteImageAPI.h +0 -25
  70. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTAppRemoteImageRepresentable.h +0 -16
  71. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTAppRemoteLibraryState.h +0 -19
  72. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTAppRemotePlaybackOptions.h +0 -32
  73. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTAppRemotePlaybackRestrictions.h +0 -32
  74. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTAppRemotePlayerAPI.h +0 -267
  75. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTAppRemotePlayerState.h +0 -40
  76. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTAppRemotePodcastPlaybackSpeed.h +0 -15
  77. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTAppRemoteTrack.h +0 -52
  78. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTAppRemoteUserAPI.h +0 -102
  79. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTAppRemoteUserCapabilities.h +0 -15
  80. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTConfiguration.h +0 -66
  81. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTError.h +0 -31
  82. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTLogin.h +0 -10
  83. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTMacros.h +0 -125
  84. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTScope.h +0 -75
  85. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTSession.h +0 -33
  86. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SPTSessionManager.h +0 -170
  87. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SpotifyAppRemote.h +0 -28
  88. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Headers/SpotifyiOS.h +0 -7
  89. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Info.plist +0 -0
  90. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/Modules/module.modulemap +0 -5
  91. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/PrivacyInfo.xcprivacy +0 -14
  92. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64/SpotifyiOS.framework/SpotifyiOS +0 -0
  93. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemote.h +0 -287
  94. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemoteAlbum.h +0 -18
  95. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemoteArtist.h +0 -18
  96. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemoteCommon.h +0 -37
  97. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemoteConnectionParams.h +0 -65
  98. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemoteConnectivityAPI.h +0 -55
  99. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemoteConnectivityState.h +0 -15
  100. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemoteContentAPI.h +0 -78
  101. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemoteContentItem.h +0 -49
  102. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemoteCrossfadeState.h +0 -18
  103. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemoteImageAPI.h +0 -25
  104. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemoteImageRepresentable.h +0 -16
  105. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemoteLibraryState.h +0 -19
  106. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemotePlaybackOptions.h +0 -32
  107. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemotePlaybackRestrictions.h +0 -32
  108. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemotePlayerAPI.h +0 -267
  109. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemotePlayerState.h +0 -40
  110. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemotePodcastPlaybackSpeed.h +0 -15
  111. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemoteTrack.h +0 -52
  112. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemoteUserAPI.h +0 -102
  113. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SPTAppRemoteUserCapabilities.h +0 -15
  114. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SPTConfiguration.h +0 -66
  115. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SPTError.h +0 -31
  116. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SPTLogin.h +0 -10
  117. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SPTMacros.h +0 -125
  118. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SPTScope.h +0 -75
  119. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SPTSession.h +0 -33
  120. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SPTSessionManager.h +0 -170
  121. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SpotifyAppRemote.h +0 -28
  122. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Headers/SpotifyiOS.h +0 -7
  123. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Info.plist +0 -0
  124. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/Modules/module.modulemap +0 -5
  125. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/PrivacyInfo.xcprivacy +0 -14
  126. package/ios/SpotifySDK/SpotifyiOS.xcframework/ios-arm64_x86_64-simulator/SpotifyiOS.framework/SpotifyiOS +0 -0
@@ -1,16 +0,0 @@
1
- #import <Foundation/Foundation.h>
2
-
3
- NS_ASSUME_NONNULL_BEGIN
4
-
5
- /**
6
- * The `SPTImageRepresentable` protocol represents an object that may contain an image.
7
- * If something conforms to this protocol you can pass it to `SPTAppRemoteImageAPI` fetchImageForItem: method.
8
- */
9
- @protocol SPTAppRemoteImageRepresentable <NSObject>
10
-
11
- /// The identifier of the image of the entity.
12
- @property (nonatomic, strong, readonly) NSString *imageIdentifier;
13
-
14
- @end
15
-
16
- NS_ASSUME_NONNULL_END
@@ -1,19 +0,0 @@
1
- #import <Foundation/Foundation.h>
2
-
3
- NS_ASSUME_NONNULL_BEGIN
4
-
5
- /**
6
- * The `SPTAppRemoteLibraryState` represents a the state of an album or track in a users Spotify library.
7
- */
8
- @protocol SPTAppRemoteLibraryState <NSObject>
9
-
10
- /// The uri of the track or album
11
- @property (nonatomic, strong, readonly) NSString *uri;
12
- /// `YES` album or track was added to the user's library, otherwise `NO`.
13
- @property (nonatomic, assign, readonly) BOOL isAdded;
14
- /// `YES` album or track can be added to the user's library, otherwise `NO`.
15
- @property (nonatomic, assign, readonly) BOOL canAdd;
16
-
17
- @end
18
-
19
- NS_ASSUME_NONNULL_END
@@ -1,32 +0,0 @@
1
- #import <Foundation/Foundation.h>
2
-
3
- NS_ASSUME_NONNULL_BEGIN
4
-
5
- /// The available repeat modes.
6
- typedef NS_ENUM(NSUInteger, SPTAppRemotePlaybackOptionsRepeatMode) {
7
- /// Repeat is off.
8
- SPTAppRemotePlaybackOptionsRepeatModeOff = 0,
9
-
10
- /// Repeats the current track.
11
- SPTAppRemotePlaybackOptionsRepeatModeTrack = 1,
12
-
13
- /// Repeats the current context.
14
- SPTAppRemotePlaybackOptionsRepeatModeContext = 2,
15
- };
16
-
17
- /**
18
- * The `SPTAppRemotePlaybackOptions` describes a set of options used for the current playback.
19
- *
20
- * @discussion Use these to determine UI states.
21
- */
22
- @protocol SPTAppRemotePlaybackOptions <NSObject>
23
-
24
- /// `YES` if shuffle is enabled, otherwise `NO`.
25
- @property (nonatomic, readonly) BOOL isShuffling;
26
-
27
- /// The current repeat mode in effect.
28
- @property (nonatomic, readonly) SPTAppRemotePlaybackOptionsRepeatMode repeatMode;
29
-
30
- @end
31
-
32
- NS_ASSUME_NONNULL_END
@@ -1,32 +0,0 @@
1
- #import <Foundation/Foundation.h>
2
-
3
- NS_ASSUME_NONNULL_BEGIN
4
-
5
- /**
6
- * The `SPTAppRemotePlaybackRestrictions` describes a set of restrictions for playback in the Spotify client.
7
- *
8
- * @discussion Use these to determine whether to enable or disable certain actions in the UI.
9
- */
10
- @protocol SPTAppRemotePlaybackRestrictions <NSObject>
11
-
12
- /// `YES` if the user can skip to the next track, otherwise `NO`.
13
- @property (nonatomic, readonly) BOOL canSkipNext;
14
-
15
- /// `YES` if the user can skip to the previous track, otherwise `NO`.
16
- @property (nonatomic, readonly) BOOL canSkipPrevious;
17
-
18
- /// `YES` if the user can repeat the current track, otherwise `NO`.
19
- @property (nonatomic, readonly) BOOL canRepeatTrack;
20
-
21
- /// `YES` if the user can repeat the current context, otherwise `NO`.
22
- @property (nonatomic, readonly) BOOL canRepeatContext;
23
-
24
- /// `YES` if the user can toggle shuffle, otherwise `NO`.
25
- @property (nonatomic, readonly) BOOL canToggleShuffle;
26
-
27
- /// `YES` if the user can seek to specific positions, otherwise `NO`.
28
- @property (nonatomic, readonly) BOOL canSeek;
29
-
30
- @end
31
-
32
- NS_ASSUME_NONNULL_END
@@ -1,267 +0,0 @@
1
- #import <Foundation/Foundation.h>
2
- #import "SPTAppRemoteCommon.h"
3
- #import "SPTAppRemotePlaybackOptions.h"
4
-
5
- @protocol SPTAppRemotePlayerState
6
- , SPTAppRemoteContentItem, SPTAppRemotePodcastPlaybackSpeed;
7
-
8
- NS_ASSUME_NONNULL_BEGIN
9
-
10
- /**
11
- * The `SPTAppRemotePlayerStateDelegate` is used to get notifications from the Spotify app when the player state is
12
- * changed.
13
- */
14
- @protocol SPTAppRemotePlayerStateDelegate <NSObject>
15
-
16
- /**
17
- * Called when the player state has been updated.
18
- *
19
- * @param playerState The new player state.
20
- */
21
- - (void)playerStateDidChange:(id<SPTAppRemotePlayerState>)playerState;
22
-
23
- @end
24
-
25
- /**
26
- * The `SPTAppRemotePlayerAPI` is used to interact with and control the Spotify player.
27
- */
28
- @protocol SPTAppRemotePlayerAPI <NSObject>
29
-
30
- /// The delegate receiving player state updates
31
- @property (nonatomic, weak) id<SPTAppRemotePlayerStateDelegate> delegate;
32
-
33
- #pragma mark Player Control
34
-
35
- /**
36
- * Asks the Spotify player to play the entity with the given identifier.
37
- *
38
- * @note Implement `SPTAppRemotePlayerStateDelegate` and set yourself as delegate in order to be notified when the
39
- * the track begins to play.
40
- *
41
- * @param entityIdentifier The unique identifier of the entity to play.
42
- * @param callback On success `result` will be `YES`.
43
- * On error `result` will be `nil` and `error` set
44
- */
45
- - (void)play:(NSString *)entityIdentifier callback:(nullable SPTAppRemoteCallback)callback;
46
-
47
- /**
48
- * Asks the Spotify player to play the entity with the given identifier.
49
- *
50
- * @note Implement `SPTAppRemotePlayerStateDelegate` and set yourself as delegate in order to be notified when the
51
- * the track begins to play.
52
- *
53
- * @param trackUri The track URI to play.
54
- * @param asRadio `YES` to start radio for track URI.
55
- * @param callback On success `result` will be `YES`.
56
- * On error `result` will be `nil` and `error` set
57
- */
58
- - (void)play:(NSString *)trackUri asRadio:(BOOL)asRadio callback:(SPTAppRemoteCallback)callback;
59
-
60
- /**
61
- * Asks the Spotify player to play the provided content item.
62
- *
63
- * @note Implement `SPTAppRemotePlayerStateDelegate` and set yourself as delegate in order to be notified when the
64
- * the track begins to play.
65
- * @note The `playable` property of the `SPTAppRemoteContentItem` indicates whether or not a content item is
66
- * playable.
67
- *
68
- * @param contentItem The content item to play.
69
- * @param callback On success `result` will be `YES`.
70
- * On error `result` will be `nil` and error set
71
- */
72
- - (void)playItem:(id<SPTAppRemoteContentItem>)contentItem callback:(nullable SPTAppRemoteCallback)callback;
73
-
74
- /**
75
- * Asks the Spotify player to play the provided content item starting at the specified index.
76
- *
77
- * @note Implement `SPTAppRemotePlayerStateDelegate` and set yourself as delegate in order to be notified when the
78
- * the track begins to play.
79
- * @note The `playable` property of the `SPTAppRemoteContentItem` indicates whether or not a content item is
80
- * playable.
81
- * @note Sending an `index` parameter that is out of bounds is undefined.
82
- *
83
- * @param contentItem The content item to play.
84
- * @param index The index of the track to skip to if applicable.
85
- * @param callback On success `result` will be `YES`.
86
- * On error `result` will be `nil` and error set
87
- */
88
- - (void)playItem:(id<SPTAppRemoteContentItem>)contentItem
89
- skipToTrackIndex:(NSInteger)index
90
- callback:(nullable SPTAppRemoteCallback)callback;
91
-
92
- /**
93
- * Asks the Spotify player to resume playback.
94
- *
95
- * @note Implement `SPTAppRemotePlayerStateDelegate` and set yourself as delegate in order to be notified when the
96
- * the playback resumes.
97
- *
98
- * @param callback On success `result` will be `YES`.
99
- * On error `result` will be nil and error set
100
- */
101
- - (void)resume:(nullable SPTAppRemoteCallback)callback;
102
-
103
- /**
104
- * Asks the Spotify player to pause playback.
105
- *
106
- * @note Implement `SPTAppRemotePlayerStateDelegate` and set yourself as delegate in order to be notified when the
107
- * the playback pauses.
108
- *
109
- * @param callback On success `result` will be `YES`.
110
- * On error `result` will be `nil` and error set
111
- */
112
- - (void)pause:(nullable SPTAppRemoteCallback)callback;
113
-
114
- /**
115
- * Asks the Spotify player to skip to the next track.
116
- *
117
- * @note Implement `SPTAppRemotePlayerStateDelegate` and set yourself as delegate in order to be notified when the
118
- * the track changes.
119
- *
120
- * @param callback On success `result` will be `YES`.
121
- * On error `result` will be `nil` and error set
122
- */
123
- - (void)skipToNext:(nullable SPTAppRemoteCallback)callback;
124
-
125
- /**
126
- * Asks the Spotify player to skip to the previous track.
127
- *
128
- * @note Implement `SPTAppRemotePlayerStateDelegate` and set yourself as delegate in order to be notified when the
129
- * the track changes.
130
- *
131
- * @param callback On success `result` will be `YES`.
132
- * On error `result` will be `nil` and `error` set
133
- */
134
- - (void)skipToPrevious:(nullable SPTAppRemoteCallback)callback;
135
-
136
- /**
137
- * Asks the Spotify player to seek to the specified position.
138
- *
139
- * @param position The position to seek to in milliseconds.
140
- * @param callback On success `result` will be `YES`.
141
- * On error `result` will be `nil` and `error` set
142
- */
143
- - (void)seekToPosition:(NSInteger)position callback:(nullable SPTAppRemoteCallback)callback;
144
-
145
- /**
146
- * Asks the Spotify player to seek forward 15 seconds.
147
- * Note: You should only use this method if isEpisode = YES for the currently playing track
148
- *
149
- * @param callback On success `result` will be `YES`.
150
- * On error `result` will be `nil` and `error` set
151
- */
152
- - (void)seekForward15Seconds:(nullable SPTAppRemoteCallback)callback;
153
-
154
- /**
155
- * Asks the Spotify player to seek backward 15 seconds.
156
- * Note: You should only use this method if isEpisode = YES for the currently playing track
157
- *
158
- * @param callback On success `result` will be `YES`.
159
- * On error `result` will be `nil` and `error` set
160
- */
161
- - (void)seekBackward15Seconds:(nullable SPTAppRemoteCallback)callback;
162
-
163
- #pragma mark Playback Options
164
-
165
- /**
166
- * Asks the Spotify player to set shuffle mode.
167
- *
168
- * @param shuffle `YES` to enable shuffle, `NO` to disable.
169
- * @param callback On success `result` will be `YES`.
170
- * On error `result` will be `nil` and `error` will be set.
171
- */
172
- - (void)setShuffle:(BOOL)shuffle callback:(nullable SPTAppRemoteCallback)callback;
173
-
174
- /**
175
- * Asks the Spotify player to set the repeat mode.
176
- *
177
- * @param repeatMode The repeat mode to set.
178
- * @param callback On success `result` will be `YES`.
179
- * On error `result` will be `nil` and `error` will be set.
180
- */
181
- - (void)setRepeatMode:(SPTAppRemotePlaybackOptionsRepeatMode)repeatMode
182
- callback:(nullable SPTAppRemoteCallback)callback;
183
-
184
- #pragma mark Player State
185
-
186
- /**
187
- * Asks the Spotify player for the current player state.
188
- *
189
- * @param callback On success `result` will be an instance of `id<SPTAppRemotePlayerState>`
190
- * On error `result` will be nil and error set
191
- */
192
- - (void)getPlayerState:(nullable SPTAppRemoteCallback)callback;
193
-
194
- /**
195
- * Subscribes to player state changes from the Spotify app.
196
- *
197
- * @note Implement `SPTAppRemotePlayerStateDelegate` and set yourself as delegate in order to be notified when the
198
- * the player state changes.
199
- *
200
- * @param callback On success `result` will be an instance of `id<SPTAppRemotePlayerState>`
201
- * On error `result` will be nil and error set
202
- */
203
- - (void)subscribeToPlayerState:(nullable SPTAppRemoteCallback)callback;
204
-
205
- /**
206
- * Stops subscribing to player state changes from the Spotify app.
207
- *
208
- * @param callback On success `result` will be `YES`
209
- * On error `result` will be `nil` and error set
210
- */
211
- - (void)unsubscribeToPlayerState:(nullable SPTAppRemoteCallback)callback;
212
-
213
- /**
214
- * Adds a track to the user's currently playing queue
215
- *
216
- * @param trackUri The track URI to add to the queue
217
- * @param callback On success `result` will be `YES`
218
- * On error `result` will be `nil` and error set
219
- */
220
- - (void)enqueueTrackUri:(NSString *)trackUri callback:(nullable SPTAppRemoteCallback)callback;
221
-
222
- /**
223
- * Asks the Spotify player for available podcast playback speeds
224
- *
225
- * @param callback On success `result` will be an `NSArray` of `SPTAppRemotePodcastPlaybackSpeed` objects
226
- * On error `result` will be `nil` and `error` set
227
- */
228
- - (void)getAvailablePodcastPlaybackSpeeds:(nullable SPTAppRemoteCallback)callback;
229
-
230
- /**
231
- * Asks the Spotify player for the current podcast playback speed
232
- *
233
- * @note Podcast playback speed is seperate from other contents' playback speed. This value is only used for podcasts
234
- *
235
- * @param callback On success `result` will be a `SPTAppRemotePodcastPlaybackSpeed`
236
- * On error `result` will be `nil` and `error` set
237
- */
238
- - (void)getCurrentPodcastPlaybackSpeed:(nullable SPTAppRemoteCallback)callback;
239
-
240
- /**
241
- * Set the current podcast playback speed
242
- *
243
- * @note This playback speed will only affect podcasts and not other types of media. If you set this
244
- * when a podcast is not playing this will be the default value when a podcast does begin to play. For this reason
245
- * you may get a successful callback when setting this even when a podcast is not playing and the current playback
246
- * speed does not change.
247
- *
248
- * @note You should use `getAvailablePodcastPlaybackSpeeds:` to get a list of valid speeds to pass to this method
249
- *
250
- * @param speed The `SPTAppRemotePodcastPlaybackSpeed` to set as the current podcast playback speed
251
- * @param callback On success `result` will be `YES`.
252
- * On error `result` will be `nil` and `error` set
253
- */
254
- - (void)setPodcastPlaybackSpeed:(nonnull id<SPTAppRemotePodcastPlaybackSpeed>)speed
255
- callback:(nullable SPTAppRemoteCallback)callback;
256
-
257
- /**
258
- * Asks the Spotify player for the current crossfade state.
259
- *
260
- * @param callback On success `result` will be an instance of `id<SPTAppRemoteCrossfadeState>`
261
- * On error `result` will be nil and error set
262
- */
263
- - (void)getCrossfadeState:(nullable SPTAppRemoteCallback)callback;
264
-
265
- @end
266
-
267
- NS_ASSUME_NONNULL_END
@@ -1,40 +0,0 @@
1
- #import <Foundation/Foundation.h>
2
-
3
- @protocol SPTAppRemoteTrack;
4
- @protocol SPTAppRemotePlaybackOptions;
5
- @protocol SPTAppRemotePlaybackRestrictions;
6
-
7
- NS_ASSUME_NONNULL_BEGIN
8
-
9
- /**
10
- * The `SPTAppRemotePlayerState` represents the state within the Spotify player.
11
- */
12
- @protocol SPTAppRemotePlayerState <NSObject>
13
-
14
- /// The track being played in the Spotify player.
15
- @property (nonatomic, readonly) id<SPTAppRemoteTrack> track;
16
-
17
- /// The position of the playback in the Spotify player.
18
- @property (nonatomic, readonly) NSInteger playbackPosition;
19
-
20
- /// The speed of the playback in the Spotify player.
21
- @property (nonatomic, readonly) float playbackSpeed;
22
-
23
- /// `YES` if the Spotify player is paused, otherwise `NO`.
24
- @property (nonatomic, readonly, getter=isPaused) BOOL paused;
25
-
26
- /// The playback restrictions currently in effect.
27
- @property (nonatomic, readonly) id<SPTAppRemotePlaybackRestrictions> playbackRestrictions;
28
-
29
- /// The playback options currently in effect.
30
- @property (nonatomic, readonly) id<SPTAppRemotePlaybackOptions> playbackOptions;
31
-
32
- /// The title of the currently playing context (e.g. the name of the playlist).
33
- @property (nonatomic, readonly) NSString *contextTitle;
34
-
35
- /// The URI of the currently playing context (e.g. the URI of the playlist).
36
- @property (nonatomic, readonly) NSURL *contextURI;
37
-
38
- @end
39
-
40
- NS_ASSUME_NONNULL_END
@@ -1,15 +0,0 @@
1
- #import <Foundation/Foundation.h>
2
-
3
- NS_ASSUME_NONNULL_BEGIN
4
-
5
- /**
6
- * The `SPTAppRemotePodcastPlaybackSpeed` represents playback speed(s) for podcasts
7
- */
8
- @protocol SPTAppRemotePodcastPlaybackSpeed <NSObject>
9
-
10
- /// The speed multiplier representing this podcast speed. 0.5 = half speed, 2 = twice as fast, 1 = normal playback
11
- @property (nonatomic, strong, readonly) NSNumber *value;
12
-
13
- @end
14
-
15
- NS_ASSUME_NONNULL_END
@@ -1,52 +0,0 @@
1
- #import "SPTAppRemoteImageRepresentable.h"
2
-
3
- @protocol SPTAppRemoteAlbum;
4
- @protocol SPTAppRemoteArtist;
5
-
6
- NS_ASSUME_NONNULL_BEGIN
7
-
8
- /**
9
- * The `SPTAppRemoteTrack` represents a track.
10
- */
11
- @protocol SPTAppRemoteTrack <NSObject, SPTAppRemoteImageRepresentable>
12
-
13
- /// The name of the track.
14
- @property (nonatomic, copy, readonly) NSString *name;
15
-
16
- /// The URI of the track.
17
- @property (nonatomic, copy, readonly) NSString *URI;
18
-
19
- /// The duration of the track in miliseconds.
20
- @property (nonatomic, assign, readonly) NSUInteger duration;
21
-
22
- /// The artist of the track.
23
- @property (nonatomic, strong, readonly) id<SPTAppRemoteArtist> artist;
24
-
25
- /// The album of the track.
26
- @property (nonatomic, strong, readonly) id<SPTAppRemoteAlbum> album;
27
-
28
- /// `YES` if the user has saved the track, otherwise `NO`.
29
- @property (nonatomic, assign, readonly, getter=isSaved) BOOL saved;
30
-
31
- /**
32
- * `YES` if the track is a podcast, video, or other audio episode, otherwise `NO`.
33
- * If the track is an episode and `SPTAppRemotePlaybackRestrictions` `canSeek` is `YES` you should show
34
- * 15 second skip buttons in your UI.
35
- */
36
- @property (nonatomic, assign, readonly, getter=isEpisode) BOOL episode;
37
-
38
- /**
39
- * `YES` if the track is a podcast, otherwise `NO`.
40
- * If the track is a podcast and `SPTAppRemotePlaybackRestrictions` `canSeek` is `YES` you should show
41
- * 15 second skip buttons in your UI as well as a podcast speed control to change playback speed.
42
- */
43
- @property (nonatomic, assign, readonly, getter=isPodcast) BOOL podcast;
44
-
45
- /**
46
- * `YES` if the track is an ad, otherwise `NO`.
47
- */
48
- @property (nonatomic, assign, readonly, getter=isAdvertisement) BOOL advertisement;
49
-
50
- @end
51
-
52
- NS_ASSUME_NONNULL_END
@@ -1,102 +0,0 @@
1
- #import <Foundation/Foundation.h>
2
- #import "SPTAppRemoteCommon.h"
3
-
4
- @protocol SPTAppRemoteUserAPI;
5
- @protocol SPTAppRemoteUserCapabilities;
6
-
7
- NS_ASSUME_NONNULL_BEGIN
8
-
9
- /**
10
- * The `SPTAppRemoteUserAPIDelegate` gets notified whenever the user API receives new data from subscription events.
11
- */
12
- @protocol SPTAppRemoteUserAPIDelegate <NSObject>
13
-
14
- /**
15
- * Called when the capabilities has been updated.
16
- *
17
- * @note This will only be called if there is an active capabilities subscription.
18
- *
19
- * @param userAPI The API that received updates.
20
- * @param capabilities The new capabilities that was received.
21
- */
22
- - (void)userAPI:(id<SPTAppRemoteUserAPI>)userAPI didReceiveCapabilities:(id<SPTAppRemoteUserCapabilities>)capabilities;
23
-
24
- @end
25
-
26
- /**
27
- * The `SPTAppRemoteUserAPI` is used to get user data from, and interact with user features in, the Spotify app.
28
- */
29
- @protocol SPTAppRemoteUserAPI <NSObject>
30
-
31
- /// The User API delegate gets notified whenever the API receives new data from subscription events.
32
- @property (nonatomic, weak, readwrite) id<SPTAppRemoteUserAPIDelegate> delegate;
33
-
34
- /**
35
- * Fetches the current users capabilities from the Spotify app.
36
- *
37
- * @param callback A callback block that will be invoked when the fetch request has completed.
38
- * On success `result` will be an instance of `id<SPTAppRemoteUserCapabilities>`.
39
- * On error `result` will be `nil` and `error` will be set.
40
- */
41
- - (void)fetchCapabilitiesWithCallback:(nullable SPTAppRemoteCallback)callback;
42
-
43
- /**
44
- * Subscribes to capability changes from the Spotify app.
45
- *
46
- * @note Implement `SPTAppRemoteUserAPIDelegate` and set yourself as `delegate` in order to be notified when the
47
- * the capabilities changes.
48
- *
49
- * @param callback A callback block that will be invoked when the subscription request has completed.
50
- * On success `result` will `YES`.
51
- * On error `result` will be `nil` and `error` will be set.
52
- */
53
- - (void)subscribeToCapabilityChanges:(nullable SPTAppRemoteCallback)callback;
54
-
55
- /**
56
- * Stops subscribing to capability changes from the Spotify app.
57
- *
58
- * @param callback A callback block that will be invoked when the unsubscription request has completed.
59
- * On success `result` will be `YES`.
60
- * On error `result` will be `nil` and `error` will be set.
61
- */
62
- - (void)unsubscribeToCapabilityChanges:(nullable SPTAppRemoteCallback)callback;
63
-
64
- /**
65
- * Fetches the current users library state for a given album or track uri.
66
- *
67
- * @param URI The URI of the album or track we are fetching the state for
68
- * @param callback A callback block that will be invoked when the fetch request has completed.
69
- * On success `result` will be an instance of `id<SPTAppRemoteLibraryState>`.
70
- * On error `result` will be `nil` and `error` will be set.
71
- */
72
- - (void)fetchLibraryStateForURI:(NSString *)URI callback:(SPTAppRemoteCallback)callback;
73
-
74
- /**
75
- * Add item to the users library.
76
- * Currently supported uris include:
77
- * Tracks - example: spotify:track:6rqhFgbbKwnb9MLmUQDhG6
78
- * Albums - example: spotify:album:2VYSDvc0ZdcfkXDcYVjHs6
79
- *
80
- * @param URI The URI of the item to save
81
- * @param callback A callback block that will be invoked when the fetch request has completed.
82
- * On success `result` will be an instance of `id<SPTAppRemoteLibraryState>` that indicates the
83
- * resulting state of the entity. On error `result` will be `nil` and `error` will be set.
84
- */
85
- - (void)addItemToLibraryWithURI:(NSString *)URI callback:(nullable SPTAppRemoteCallback)callback;
86
-
87
- /**
88
- * Remove item from users library.
89
- * Currently supported uris include:
90
- * Tracks - example: spotify:track:6rqhFgbbKwnb9MLmUQDhG6
91
- * Albums - example: spotify:album:2VYSDvc0ZdcfkXDcYVjHs6
92
- *
93
- * @param URI The URI of the item to remove
94
- * @param callback A callback block that will be invoked when the fetch request has completed.
95
- * On success `result` will be an instance of `id<SPTAppRemoteLibraryState>` that indicates the
96
- * resulting state of the entity. On error `result` will be `nil` and `error` will be set.
97
- */
98
- - (void)removeItemFromLibraryWithURI:(NSString *)URI callback:(nullable SPTAppRemoteCallback)callback;
99
-
100
- @end
101
-
102
- NS_ASSUME_NONNULL_END
@@ -1,15 +0,0 @@
1
- #import <Foundation/Foundation.h>
2
-
3
- NS_ASSUME_NONNULL_BEGIN
4
-
5
- /**
6
- * The `SPTAppRemoteUserCapabilities` represents a set of capabilities the current user has in the Spotify app.
7
- */
8
- @protocol SPTAppRemoteUserCapabilities <NSObject>
9
-
10
- /// `YES` if the user can play songs on demand, otherwise `NO`. This will differ for premium and non-premium users
11
- @property (nonatomic, assign, readonly) BOOL canPlayOnDemand;
12
-
13
- @end
14
-
15
- NS_ASSUME_NONNULL_END
@@ -1,66 +0,0 @@
1
- #import <Foundation/Foundation.h>
2
-
3
- NS_ASSUME_NONNULL_BEGIN
4
-
5
- /**
6
- A configuration class, holding the credentials provided for your app on the Spotify Developer website.
7
- See https://developer.spotify.com/my-applications/
8
- */
9
- @interface SPTConfiguration : NSObject <NSSecureCoding>
10
-
11
- /// Your app's Client ID from developer.spotify.com
12
- @property (nonatomic, readonly, copy) NSString *clientID;
13
-
14
- /// Your redirect URL. This is how the Spotify app will open your application after user authorization.
15
- @property (nonatomic, readonly, copy) NSURL *redirectURL;
16
-
17
- /// Name of the company
18
- @property (nonatomic, nullable, copy) NSString *companyName;
19
-
20
- /**
21
- The URL to use for attempting to swap an authorization code for an access token. You should only set this if your
22
- clientID has a clientSecret and you have a backend service that holds the secret and can exchange the code and secret
23
- for an access token.
24
- */
25
- @property (nonatomic, nullable, copy) NSURL *tokenSwapURL;
26
-
27
- /**
28
- The URL to use for attempting to renew an access token with a refresh token. You should only set this if your
29
- clientID has a clientSecret and you have a backend service that holds the secret and can use a refresh token
30
- to get a new access token.
31
- */
32
- @property (nonatomic, nullable, copy) NSURL *tokenRefreshURL;
33
-
34
- /**
35
- If requesting the `SPTAppRemoteControlScope` you can provide an optional uri to begin playing after a successful
36
- authentication. To continue the user's last session set this to a blank string @"". If this value is `nil` or
37
- `SPTAppRemoteControlScope` is not requested no audio will play. If Spotify is already playing it will continue playing
38
- even though a URI is provided.
39
- */
40
- @property (nonatomic, nullable, copy) NSString *playURI;
41
-
42
- - (instancetype)init NS_UNAVAILABLE;
43
-
44
- /**
45
- Designated initializer for `SPTConfiguration`
46
-
47
- @param clientID Your client ID obtained from developer.spotify.com
48
- @param redirectURL Your redirect URL for Spotify to open your app again after authorization
49
- @return A newly initialized `SPTConfiguration`
50
- */
51
- - (instancetype)initWithClientID:(NSString *)clientID redirectURL:(NSURL *)redirectURL NS_DESIGNATED_INITIALIZER;
52
-
53
- /**
54
- Convenience initializer for `SPTConfiguration`
55
-
56
- @param clientID Your client ID obtained from developer.spotify.com
57
- @param redirectURL Your redirect URL for Spotify to open your app again after authorization
58
- @return A newly initialized `SPTConfiguration`
59
- */
60
- + (instancetype)configurationWithClientID:(NSString *)clientID
61
- redirectURL:(NSURL *)redirectURL NS_SWIFT_UNAVAILABLE("superfluous");
62
-
63
- @end
64
-
65
-
66
- NS_ASSUME_NONNULL_END