Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call AuthorizeAndPlayURI on main thread #221

Merged
merged 3 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions ios/Classes/SwiftSpotifySdkPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -366,13 +366,13 @@ public class SwiftSpotifySdkPlugin: NSObject, FlutterPlugin {
if accessToken != nil {
appRemote?.connect()
} else {
let appRemote = self.appRemote
Task {
// Note: A blank string will play the user's last song or pick a random one.
if await appRemote?.authorizeAndPlayURI(spotifyUri, asRadio: asRadio ?? false, additionalScopes: scopes) == false {
throw SpotifyError.spotifyNotInstalledError
// Note: A blank string will play the user's last song or pick a random one.
self.appRemote?.authorizeAndPlayURI(spotifyUri, asRadio: asRadio ?? false, additionalScopes: scopes) { success in
if (!success) {
self.connectionStatusHandler?.connectionResult?(FlutterError(code: "spotifyNotInstalled", message: "Spotify app is not installed", details: nil))
}
}
}
}
}

Expand Down
4 changes: 2 additions & 2 deletions ios/spotify_sdk.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ Unofficial Spotify Flutter SDK.
s.source = { :path => '.' }
s.source_files = 'Classes/**/*'
s.dependency 'Flutter'
s.platform = :ios, '9.0'
s.ios.deployment_target = '9.0'
s.platform = :ios, '12.0'
s.ios.deployment_target = '12.0'
# Flutter.framework does not contain a i386 slice. Only x86_64 simulators are supported.
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'VALID_ARCHS[sdk=iphonesimulator*]' => 'x86_64' }
s.swift_version = '5.0'
Expand Down