@superfan-app/spotify-auth 0.1.46 → 0.1.48
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.
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#import <SpotifyiOS/SpotifyiOS.h>
|
package/ios/SpotifyAuth.podspec
CHANGED
|
@@ -30,12 +30,14 @@ Pod::Spec.new do |s|
|
|
|
30
30
|
'DEFINES_MODULE' => 'YES',
|
|
31
31
|
'SWIFT_COMPILATION_MODE' => 'wholemodule',
|
|
32
32
|
'ENABLE_BITCODE' => 'NO',
|
|
33
|
-
'IPHONEOS_DEPLOYMENT_TARGET' => '13.0'
|
|
33
|
+
'IPHONEOS_DEPLOYMENT_TARGET' => '13.0',
|
|
34
|
+
'SWIFT_OBJC_BRIDGING_HEADER' => '$(PODS_TARGET_SRCROOT)/SpotifyAuth-Bridging-Header.h'
|
|
34
35
|
}
|
|
35
36
|
|
|
36
37
|
s.user_target_xcconfig = {
|
|
37
38
|
'ENABLE_BITCODE' => 'NO',
|
|
38
|
-
'IPHONEOS_DEPLOYMENT_TARGET' => '13.0'
|
|
39
|
+
'IPHONEOS_DEPLOYMENT_TARGET' => '13.0',
|
|
40
|
+
'OTHER_LDFLAGS' => '-ObjC'
|
|
39
41
|
}
|
|
40
42
|
|
|
41
43
|
# Include all Swift files in the same directory as the podspec.
|
|
@@ -639,13 +639,66 @@ final class SpotifyAuthAuth: NSObject, SPTSessionManagerDelegate, SpotifyOAuthVi
|
|
|
639
639
|
}
|
|
640
640
|
}
|
|
641
641
|
|
|
642
|
-
|
|
643
|
-
|
|
642
|
+
// MARK: - Logging
|
|
643
|
+
|
|
644
|
+
private func secureLog(_ message: String, sensitive: Bool = false) {
|
|
645
|
+
#if DEBUG
|
|
646
|
+
if sensitive {
|
|
647
|
+
print("[SpotifyAuth] ********")
|
|
648
|
+
} else {
|
|
649
|
+
print("[SpotifyAuth] \(message)")
|
|
650
|
+
}
|
|
651
|
+
#else
|
|
652
|
+
if !sensitive {
|
|
653
|
+
print("[SpotifyAuth] \(message)")
|
|
654
|
+
}
|
|
655
|
+
#endif
|
|
644
656
|
}
|
|
645
657
|
|
|
646
658
|
deinit {
|
|
647
659
|
cleanupPreviousSession()
|
|
648
660
|
}
|
|
661
|
+
|
|
662
|
+
// MARK: - URL Handling
|
|
663
|
+
|
|
664
|
+
/// Handle URL callback for UIApplicationDelegate
|
|
665
|
+
public func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool {
|
|
666
|
+
// If we're using web auth, let the web view handle it
|
|
667
|
+
if isUsingWebAuth {
|
|
668
|
+
return false
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
// Forward to session manager for app-switch flow
|
|
672
|
+
if let sessionManager = self.sessionManager {
|
|
673
|
+
let handled = sessionManager.application(app, open: url, options: options)
|
|
674
|
+
if handled {
|
|
675
|
+
secureLog("URL handled by session manager")
|
|
676
|
+
}
|
|
677
|
+
return handled
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
return false
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
/// Handle URL callback for UISceneDelegate
|
|
684
|
+
public func scene(_ scene: UIScene, openURLContexts URLContexts: Set<UIOpenURLContext>) {
|
|
685
|
+
guard let url = URLContexts.first?.url else {
|
|
686
|
+
return
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
// If we're using web auth, let the web view handle it
|
|
690
|
+
if isUsingWebAuth {
|
|
691
|
+
return
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
// Forward to session manager for app-switch flow
|
|
695
|
+
if let sessionManager = self.sessionManager {
|
|
696
|
+
let handled = sessionManager.application(UIApplication.shared, open: url, options: [:])
|
|
697
|
+
if handled {
|
|
698
|
+
secureLog("URL handled by session manager")
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
}
|
|
649
702
|
}
|
|
650
703
|
|
|
651
704
|
// MARK: - Helper Extension
|
|
@@ -83,7 +83,7 @@ class SpotifyOAuthView: ExpoView {
|
|
|
83
83
|
// Ensure cookies and data are not persisted
|
|
84
84
|
let dataStore = WKWebsiteDataStore.nonPersistent()
|
|
85
85
|
configuration.websiteDataStore = dataStore
|
|
86
|
-
secureLog("WebView configuration created with non-persistent data store")
|
|
86
|
+
self.secureLog("WebView configuration created with non-persistent data store")
|
|
87
87
|
return configuration
|
|
88
88
|
}()
|
|
89
89
|
|
|
@@ -93,7 +93,7 @@ class SpotifyOAuthView: ExpoView {
|
|
|
93
93
|
guard webView != nil else {
|
|
94
94
|
throw NSError(domain: "SpotifyAuth", code: -1, userInfo: [NSLocalizedDescriptionKey: "Failed to initialize WebView"])
|
|
95
95
|
}
|
|
96
|
-
secureLog("WebView successfully initialized")
|
|
96
|
+
self.secureLog("WebView successfully initialized")
|
|
97
97
|
|
|
98
98
|
webView.navigationDelegate = self
|
|
99
99
|
webView.allowsBackForwardNavigationGestures = true
|
|
@@ -251,7 +251,7 @@ class SpotifyOAuthView: ExpoView {
|
|
|
251
251
|
}
|
|
252
252
|
|
|
253
253
|
if webView.isLoading {
|
|
254
|
-
secureLog("Warning: WebView is already loading content, stopping previous load")
|
|
254
|
+
self.secureLog("Warning: WebView is already loading content, stopping previous load")
|
|
255
255
|
webView.stopLoading()
|
|
256
256
|
}
|
|
257
257
|
|