Skip to content

Commit 20d6f85

Browse files
authored
Call AuthorizeAndPlayURI on main thread (#221)
* fix: call a`AuthorizeAndPlayURI` on main thread which internally calls `UIAppliation.openURL` * set min supported iOS version to 12.0 * fix the indentation
1 parent 555f2de commit 20d6f85

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

ios/Classes/SwiftSpotifySdkPlugin.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -366,13 +366,13 @@ public class SwiftSpotifySdkPlugin: NSObject, FlutterPlugin {
366366
if accessToken != nil {
367367
appRemote?.connect()
368368
} else {
369-
let appRemote = self.appRemote
370-
Task {
371-
// Note: A blank string will play the user's last song or pick a random one.
372-
if await appRemote?.authorizeAndPlayURI(spotifyUri, asRadio: asRadio ?? false, additionalScopes: scopes) == false {
373-
throw SpotifyError.spotifyNotInstalledError
369+
// Note: A blank string will play the user's last song or pick a random one.
370+
self.appRemote?.authorizeAndPlayURI(spotifyUri, asRadio: asRadio ?? false, additionalScopes: scopes) { success in
371+
if (!success) {
372+
self.connectionStatusHandler?.connectionResult?(FlutterError(code: "spotifyNotInstalled", message: "Spotify app is not installed", details: nil))
374373
}
375374
}
375+
}
376376
}
377377
}
378378

ios/spotify_sdk.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ Unofficial Spotify Flutter SDK.
1515
s.source = { :path => '.' }
1616
s.source_files = 'Classes/**/*'
1717
s.dependency 'Flutter'
18-
s.platform = :ios, '9.0'
19-
s.ios.deployment_target = '9.0'
18+
s.platform = :ios, '12.0'
19+
s.ios.deployment_target = '12.0'
2020
# Flutter.framework does not contain a i386 slice. Only x86_64 simulators are supported.
2121
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'VALID_ARCHS[sdk=iphonesimulator*]' => 'x86_64' }
2222
s.swift_version = '5.0'

0 commit comments

Comments
 (0)