@superfan-app/spotify-auth 0.1.72 → 0.1.73

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.
@@ -103,9 +103,16 @@ class SpotifyAuthAuth private constructor(private val appContext: AppContext) {
103
103
  private fun isSpotifyInstalled(): Boolean {
104
104
  val context = appContext.reactContext ?: return false
105
105
  return try {
106
- context.packageManager.getPackageInfo("com.spotify.music", 0)
106
+ val packageInfo = context.packageManager.getPackageInfo("com.spotify.music", 0)
107
+ Log.d(TAG, "Spotify app detected: com.spotify.music (version: ${packageInfo.versionName})")
107
108
  true
109
+ } catch (e: PackageManager.NameNotFoundException) {
110
+ Log.d(TAG, "Spotify app NOT detected: ${e.message}")
111
+ Log.d(TAG, "If Spotify IS installed, this may be a package visibility issue (Android 11+)")
112
+ Log.d(TAG, "Ensure <queries><package android:name=\"com.spotify.music\"/></queries> is in merged manifest")
113
+ false
108
114
  } catch (e: Exception) {
115
+ Log.e(TAG, "Error checking for Spotify app: ${e.message}", e)
109
116
  false
110
117
  }
111
118
  }
@@ -256,6 +263,18 @@ class SpotifyAuthAuth private constructor(private val appContext: AppContext) {
256
263
 
257
264
  secureLog("Opening Spotify authorization activity with REQUEST_CODE=$REQUEST_CODE")
258
265
 
266
+ // === ENHANCED DEBUG LOGGING ===
267
+ Log.d(TAG, "=== SPOTIFY AUTH DEBUG ===")
268
+ Log.d(TAG, "Auth flow type: ${if (spotifyInstalled) "APP_SWITCH" else "WEBVIEW"}")
269
+ Log.d(TAG, "Client ID: ${clientId.take(10)}...")
270
+ Log.d(TAG, "Redirect URI: $redirectUri")
271
+ Log.d(TAG, "Response Type: CODE")
272
+ Log.d(TAG, "Scopes: ${scopeArray.joinToString(",")}")
273
+ Log.d(TAG, "Package name: ${appContext.reactContext?.packageName}")
274
+ Log.d(TAG, "Activity: ${activity.javaClass.name}")
275
+ Log.d(TAG, "Activity launchMode: ${activity.packageManager.getActivityInfo(activity.componentName, 0).launchMode}")
276
+ Log.d(TAG, "========================")
277
+
259
278
  // Set a timeout to detect if the auth flow doesn't complete
260
279
  authTimeoutHandler = Runnable {
261
280
  if (isAuthenticating) {
@@ -300,6 +319,28 @@ class SpotifyAuthAuth private constructor(private val appContext: AppContext) {
300
319
  fun handleActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
301
320
  Log.d(TAG, "handleActivityResult called - requestCode=$requestCode, resultCode=$resultCode, hasData=${data != null}")
302
321
 
322
+ // === ENHANCED DEBUG LOGGING FOR ACTIVITY RESULT ===
323
+ if (data != null) {
324
+ Log.d(TAG, "Intent data URI: ${data.data}")
325
+ Log.d(TAG, "Intent action: ${data.action}")
326
+ Log.d(TAG, "Intent extras keys: ${data.extras?.keySet()?.joinToString() ?: "none"}")
327
+ data.extras?.let { extras ->
328
+ for (key in extras.keySet()) {
329
+ val value = extras.get(key)
330
+ if (key.contains("token", ignoreCase = true) ||
331
+ key.contains("code", ignoreCase = true) ||
332
+ key.contains("secret", ignoreCase = true)) {
333
+ Log.d(TAG, " $key: [REDACTED]")
334
+ } else {
335
+ Log.d(TAG, " $key: $value")
336
+ }
337
+ }
338
+ }
339
+ } else {
340
+ Log.w(TAG, "Intent data is NULL - callback may not have fired correctly")
341
+ Log.w(TAG, "This often indicates an intent filter configuration issue")
342
+ }
343
+
303
344
  if (requestCode != REQUEST_CODE) {
304
345
  Log.d(TAG, "Ignoring activity result - wrong request code (expected $REQUEST_CODE, got $requestCode)")
305
346
  return
@@ -64,6 +64,16 @@ class SpotifyAuthModule : Module() {
64
64
 
65
65
  OnActivityResult { _, payload ->
66
66
  secureLog("OnActivityResult received in module - requestCode=${payload.requestCode}, resultCode=${payload.resultCode}")
67
+ android.util.Log.d("SpotifyAuth", "=== MODULE ACTIVITY RESULT ===")
68
+ android.util.Log.d("SpotifyAuth", "Request code: ${payload.requestCode}")
69
+ android.util.Log.d("SpotifyAuth", "Result code: ${payload.resultCode}")
70
+ android.util.Log.d("SpotifyAuth", "Has data: ${payload.data != null}")
71
+ if (payload.data != null) {
72
+ android.util.Log.d("SpotifyAuth", "Data scheme: ${payload.data?.scheme}")
73
+ android.util.Log.d("SpotifyAuth", "Data host: ${payload.data?.data?.host}")
74
+ android.util.Log.d("SpotifyAuth", "Data path: ${payload.data?.data?.path}")
75
+ }
76
+ android.util.Log.d("SpotifyAuth", "============================")
67
77
  spotifyAuth.handleActivityResult(payload.requestCode, payload.resultCode, payload.data)
68
78
  }
69
79
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superfan-app/spotify-auth",
3
- "version": "0.1.72",
3
+ "version": "0.1.73",
4
4
  "description": "Spotify OAuth module for Expo",
5
5
  "main": "src/index.tsx",
6
6
  "types": "build/index.d.ts",