@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.
- package/README.md +37 -4
- package/android/build.gradle +49 -0
- package/android/src/main/AndroidManifest.xml +11 -0
- package/android/src/main/java/expo/modules/spotifysdk/ExpoSpotifySDKModule.kt +180 -0
- package/build/ExpoSpotifySDK.types.d.ts +0 -1
- 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 +1 -3
- package/ios/ExpoSpotifySessionManager.swift +3 -3
- 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 +3 -1
- 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
|
@@ -1,262 +0,0 @@
|
|
|
1
|
-
#import <Foundation/Foundation.h>
|
|
2
|
-
|
|
3
|
-
#import "SPTAppRemoteCommon.h"
|
|
4
|
-
#import "SPTAppRemotePlaybackOptions.h"
|
|
5
|
-
|
|
6
|
-
@protocol SPTAppRemotePlayerState, 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 changed.
|
|
12
|
-
*/
|
|
13
|
-
@protocol SPTAppRemotePlayerStateDelegate <NSObject>
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Called when the player state has been updated.
|
|
17
|
-
*
|
|
18
|
-
* @param playerState The new player state.
|
|
19
|
-
*/
|
|
20
|
-
- (void)playerStateDidChange:(id<SPTAppRemotePlayerState>)playerState;
|
|
21
|
-
|
|
22
|
-
@end
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* The `SPTAppRemotePlayerAPI` is used to interact with and control the Spotify player.
|
|
26
|
-
*/
|
|
27
|
-
@protocol SPTAppRemotePlayerAPI <NSObject>
|
|
28
|
-
|
|
29
|
-
/// The delegate receiving player state updates
|
|
30
|
-
@property (nonatomic, weak) id<SPTAppRemotePlayerStateDelegate> delegate;
|
|
31
|
-
|
|
32
|
-
#pragma mark Player Control
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Asks the Spotify player to play the entity with the given identifier.
|
|
36
|
-
*
|
|
37
|
-
* @note Implement `SPTAppRemotePlayerStateDelegate` and set yourself as delegate in order to be notified when the
|
|
38
|
-
* the track begins to play.
|
|
39
|
-
*
|
|
40
|
-
* @param entityIdentifier The unique identifier of the entity to play.
|
|
41
|
-
* @param callback On success `result` will be `YES`.
|
|
42
|
-
* On error `result` will be `nil` and `error` set
|
|
43
|
-
*/
|
|
44
|
-
- (void)play:(NSString *)entityIdentifier callback:(nullable SPTAppRemoteCallback)callback;
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Asks the Spotify player to play the entity with the given identifier.
|
|
48
|
-
*
|
|
49
|
-
* @note Implement `SPTAppRemotePlayerStateDelegate` and set yourself as delegate in order to be notified when the
|
|
50
|
-
* the track begins to play.
|
|
51
|
-
*
|
|
52
|
-
* @param trackUri The track URI to play.
|
|
53
|
-
* @param asRadio `YES` to start radio for track URI.
|
|
54
|
-
* @param callback On success `result` will be `YES`.
|
|
55
|
-
* On error `result` will be `nil` and `error` set
|
|
56
|
-
*/
|
|
57
|
-
- (void)play:(NSString *)trackUri asRadio:(BOOL)asRadio callback:(SPTAppRemoteCallback)callback;
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Asks the Spotify player to play the provided content item.
|
|
61
|
-
*
|
|
62
|
-
* @note Implement `SPTAppRemotePlayerStateDelegate` and set yourself as delegate in order to be notified when the
|
|
63
|
-
* the track begins to play.
|
|
64
|
-
* @note The `playable` property of the `SPTAppRemoteContentItem` indicates whether or not a content item is
|
|
65
|
-
* playable.
|
|
66
|
-
*
|
|
67
|
-
* @param contentItem The content item to play.
|
|
68
|
-
* @param callback On success `result` will be `YES`.
|
|
69
|
-
* On error `result` will be `nil` and error set
|
|
70
|
-
*/
|
|
71
|
-
- (void)playItem:(id<SPTAppRemoteContentItem>)contentItem callback:(nullable SPTAppRemoteCallback)callback;
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Asks the Spotify player to play the provided content item starting at the specified index.
|
|
75
|
-
*
|
|
76
|
-
* @note Implement `SPTAppRemotePlayerStateDelegate` and set yourself as delegate in order to be notified when the
|
|
77
|
-
* the track begins to play.
|
|
78
|
-
* @note The `playable` property of the `SPTAppRemoteContentItem` indicates whether or not a content item is
|
|
79
|
-
* playable.
|
|
80
|
-
* @note Sending an `index` parameter that is out of bounds is undefined.
|
|
81
|
-
*
|
|
82
|
-
* @param contentItem The content item to play.
|
|
83
|
-
* @param index The index of the track to skip to if applicable.
|
|
84
|
-
* @param callback On success `result` will be `YES`.
|
|
85
|
-
* On error `result` will be `nil` and error set
|
|
86
|
-
*/
|
|
87
|
-
- (void)playItem:(id<SPTAppRemoteContentItem>)contentItem skipToTrackIndex:(NSInteger) index callback:(nullable SPTAppRemoteCallback)callback;
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Asks the Spotify player to resume playback.
|
|
91
|
-
*
|
|
92
|
-
* @note Implement `SPTAppRemotePlayerStateDelegate` and set yourself as delegate in order to be notified when the
|
|
93
|
-
* the playback resumes.
|
|
94
|
-
*
|
|
95
|
-
* @param callback On success `result` will be `YES`.
|
|
96
|
-
* On error `result` will be nil and error set
|
|
97
|
-
*/
|
|
98
|
-
- (void)resume:(nullable SPTAppRemoteCallback)callback;
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* Asks the Spotify player to pause playback.
|
|
102
|
-
*
|
|
103
|
-
* @note Implement `SPTAppRemotePlayerStateDelegate` and set yourself as delegate in order to be notified when the
|
|
104
|
-
* the playback pauses.
|
|
105
|
-
*
|
|
106
|
-
* @param callback On success `result` will be `YES`.
|
|
107
|
-
* On error `result` will be `nil` and error set
|
|
108
|
-
*/
|
|
109
|
-
- (void)pause:(nullable SPTAppRemoteCallback)callback;
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Asks the Spotify player to skip to the next track.
|
|
113
|
-
*
|
|
114
|
-
* @note Implement `SPTAppRemotePlayerStateDelegate` and set yourself as delegate in order to be notified when the
|
|
115
|
-
* the track changes.
|
|
116
|
-
*
|
|
117
|
-
* @param callback On success `result` will be `YES`.
|
|
118
|
-
* On error `result` will be `nil` and error set
|
|
119
|
-
*/
|
|
120
|
-
- (void)skipToNext:(nullable SPTAppRemoteCallback)callback;
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* Asks the Spotify player to skip to the previous track.
|
|
124
|
-
*
|
|
125
|
-
* @note Implement `SPTAppRemotePlayerStateDelegate` and set yourself as delegate in order to be notified when the
|
|
126
|
-
* the track changes.
|
|
127
|
-
*
|
|
128
|
-
* @param callback On success `result` will be `YES`.
|
|
129
|
-
* On error `result` will be `nil` and `error` set
|
|
130
|
-
*/
|
|
131
|
-
- (void)skipToPrevious:(nullable SPTAppRemoteCallback)callback;
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* Asks the Spotify player to seek to the specified position.
|
|
135
|
-
*
|
|
136
|
-
* @param position The position to seek to in milliseconds.
|
|
137
|
-
* @param callback On success `result` will be `YES`.
|
|
138
|
-
* On error `result` will be `nil` and `error` set
|
|
139
|
-
*/
|
|
140
|
-
- (void)seekToPosition:(NSInteger)position callback:(nullable SPTAppRemoteCallback)callback;
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* Asks the Spotify player to seek forward 15 seconds.
|
|
144
|
-
* Note: You should only use this method if isEpisode = YES for the currently playing track
|
|
145
|
-
*
|
|
146
|
-
* @param callback On success `result` will be `YES`.
|
|
147
|
-
* On error `result` will be `nil` and `error` set
|
|
148
|
-
*/
|
|
149
|
-
- (void)seekForward15Seconds:(nullable SPTAppRemoteCallback)callback;
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* Asks the Spotify player to seek backward 15 seconds.
|
|
153
|
-
* Note: You should only use this method if isEpisode = YES for the currently playing track
|
|
154
|
-
*
|
|
155
|
-
* @param callback On success `result` will be `YES`.
|
|
156
|
-
* On error `result` will be `nil` and `error` set
|
|
157
|
-
*/
|
|
158
|
-
- (void)seekBackward15Seconds:(nullable SPTAppRemoteCallback)callback;
|
|
159
|
-
|
|
160
|
-
#pragma mark Playback Options
|
|
161
|
-
|
|
162
|
-
/**
|
|
163
|
-
* Asks the Spotify player to set shuffle mode.
|
|
164
|
-
*
|
|
165
|
-
* @param shuffle `YES` to enable shuffle, `NO` to disable.
|
|
166
|
-
* @param callback On success `result` will be `YES`.
|
|
167
|
-
* On error `result` will be `nil` and `error` will be set.
|
|
168
|
-
*/
|
|
169
|
-
- (void)setShuffle:(BOOL)shuffle callback:(nullable SPTAppRemoteCallback)callback;
|
|
170
|
-
|
|
171
|
-
/**
|
|
172
|
-
* Asks the Spotify player to set the repeat mode.
|
|
173
|
-
*
|
|
174
|
-
* @param repeatMode The repeat mode to set.
|
|
175
|
-
* @param callback On success `result` will be `YES`.
|
|
176
|
-
* On error `result` will be `nil` and `error` will be set.
|
|
177
|
-
*/
|
|
178
|
-
- (void)setRepeatMode:(SPTAppRemotePlaybackOptionsRepeatMode)repeatMode callback:(nullable SPTAppRemoteCallback)callback;
|
|
179
|
-
|
|
180
|
-
#pragma mark Player State
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
* Asks the Spotify player for the current player state.
|
|
184
|
-
*
|
|
185
|
-
* @param callback On success `result` will be an instance of `id<SPTAppRemotePlayerState>`
|
|
186
|
-
* On error `result` will be nil and error set
|
|
187
|
-
*/
|
|
188
|
-
- (void)getPlayerState:(nullable SPTAppRemoteCallback)callback;
|
|
189
|
-
|
|
190
|
-
/**
|
|
191
|
-
* Subscribes to player state changes from the Spotify app.
|
|
192
|
-
*
|
|
193
|
-
* @note Implement `SPTAppRemotePlayerStateDelegate` and set yourself as delegate in order to be notified when the
|
|
194
|
-
* the player state changes.
|
|
195
|
-
*
|
|
196
|
-
* @param callback On success `result` will be an instance of `id<SPTAppRemotePlayerState>`
|
|
197
|
-
* On error `result` will be nil and error set
|
|
198
|
-
*/
|
|
199
|
-
- (void)subscribeToPlayerState:(nullable SPTAppRemoteCallback)callback;
|
|
200
|
-
|
|
201
|
-
/**
|
|
202
|
-
* Stops subscribing to player state changes from the Spotify app.
|
|
203
|
-
*
|
|
204
|
-
* @param callback On success `result` will be `YES`
|
|
205
|
-
* On error `result` will be `nil` and error set
|
|
206
|
-
*/
|
|
207
|
-
- (void)unsubscribeToPlayerState:(nullable SPTAppRemoteCallback)callback;
|
|
208
|
-
|
|
209
|
-
/**
|
|
210
|
-
* Adds a track to the user's currently playing queue
|
|
211
|
-
*
|
|
212
|
-
* @param trackUri The track URI to add to the queue
|
|
213
|
-
* @param callback On success `result` will be `YES`
|
|
214
|
-
* On error `result` will be `nil` and error set
|
|
215
|
-
*/
|
|
216
|
-
- (void)enqueueTrackUri:(NSString*)trackUri callback:(nullable SPTAppRemoteCallback)callback;
|
|
217
|
-
|
|
218
|
-
/**
|
|
219
|
-
* Asks the Spotify player for available podcast playback speeds
|
|
220
|
-
*
|
|
221
|
-
* @param callback On success `result` will be an `NSArray` of `SPTAppRemotePodcastPlaybackSpeed` objects
|
|
222
|
-
* On error `result` will be `nil` and `error` set
|
|
223
|
-
*/
|
|
224
|
-
- (void)getAvailablePodcastPlaybackSpeeds:(nullable SPTAppRemoteCallback)callback;
|
|
225
|
-
|
|
226
|
-
/**
|
|
227
|
-
* Asks the Spotify player for the current podcast playback speed
|
|
228
|
-
*
|
|
229
|
-
* @note Podcast playback speed is seperate from other contents' playback speed. This value is only used for podcasts
|
|
230
|
-
*
|
|
231
|
-
* @param callback On success `result` will be a `SPTAppRemotePodcastPlaybackSpeed`
|
|
232
|
-
* On error `result` will be `nil` and `error` set
|
|
233
|
-
*/
|
|
234
|
-
- (void)getCurrentPodcastPlaybackSpeed:(nullable SPTAppRemoteCallback)callback;
|
|
235
|
-
|
|
236
|
-
/**
|
|
237
|
-
* Set the current podcast playback speed
|
|
238
|
-
*
|
|
239
|
-
* @note This playback speed will only affect podcasts and not other types of media. If you set this
|
|
240
|
-
* when a podcast is not playing this will be the default value when a podcast does begin to play. For this reason
|
|
241
|
-
* you may get a successful callback when setting this even when a podcast is not playing and the current playback
|
|
242
|
-
* speed does not change.
|
|
243
|
-
*
|
|
244
|
-
* @note You should use `getAvailablePodcastPlaybackSpeeds:` to get a list of valid speeds to pass to this method
|
|
245
|
-
*
|
|
246
|
-
* @param speed The `SPTAppRemotePodcastPlaybackSpeed` to set as the current podcast playback speed
|
|
247
|
-
* @param callback On success `result` will be `YES`.
|
|
248
|
-
* On error `result` will be `nil` and `error` set
|
|
249
|
-
*/
|
|
250
|
-
- (void)setPodcastPlaybackSpeed:(nonnull id<SPTAppRemotePodcastPlaybackSpeed>)speed callback:(nullable SPTAppRemoteCallback)callback;
|
|
251
|
-
|
|
252
|
-
/**
|
|
253
|
-
* Asks the Spotify player for the current crossfade state.
|
|
254
|
-
*
|
|
255
|
-
* @param callback On success `result` will be an instance of `id<SPTAppRemoteCrossfadeState>`
|
|
256
|
-
* On error `result` will be nil and error set
|
|
257
|
-
*/
|
|
258
|
-
- (void)getCrossfadeState:(nullable SPTAppRemoteCallback)callback;
|
|
259
|
-
|
|
260
|
-
@end
|
|
261
|
-
|
|
262
|
-
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,47 +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
|
-
@end
|
|
46
|
-
|
|
47
|
-
NS_ASSUME_NONNULL_END
|
|
@@ -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,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
|