@superfan-app/spotify-auth 0.1.57 → 0.1.58

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.
@@ -20,7 +20,7 @@ final class SpotifyASWebAuthSession {
20
20
  completion: @escaping (Result<URL, Error>) -> Void
21
21
  ) {
22
22
  guard !isAuthenticating else {
23
- completion(.failure(SpotifyOAuthError.authorizationError("Authentication already in progress")))
23
+ completion(.failure(SpotifyAuthError.authorizationError("Authentication already in progress")))
24
24
  return
25
25
  }
26
26
 
@@ -35,15 +35,15 @@ final class SpotifyASWebAuthSession {
35
35
 
36
36
  if let error = error {
37
37
  if (error as NSError).code == ASWebAuthenticationSessionError.canceledLogin.rawValue {
38
- completion(.failure(SpotifyOAuthError.userCancelled))
38
+ completion(.failure(SpotifyAuthError.userCancelled))
39
39
  } else {
40
- completion(.failure(SpotifyOAuthError.networkError(error)))
40
+ completion(.failure(SpotifyAuthError.networkError(error.localizedDescription)))
41
41
  }
42
42
  return
43
43
  }
44
44
 
45
45
  guard let callbackURL = callbackURL else {
46
- completion(.failure(SpotifyOAuthError.authorizationError("No callback URL received")))
46
+ completion(.failure(SpotifyAuthError.authorizationError("No callback URL received")))
47
47
  return
48
48
  }
49
49
 
@@ -64,7 +64,7 @@ final class SpotifyASWebAuthSession {
64
64
  let authSession = self.authSession,
65
65
  authSession.start() else {
66
66
  self?.isAuthenticating = false
67
- completion(.failure(SpotifyOAuthError.authorizationError("Failed to start auth session")))
67
+ completion(.failure(SpotifyAuthError.authorizationError("Failed to start auth session")))
68
68
  return
69
69
  }
70
70
  self.secureLog("Auth session started successfully")
@@ -38,6 +38,9 @@ enum SpotifyAuthError: Error {
38
38
  case sessionError(String)
39
39
  case networkError(String)
40
40
  case recoverable(String, RetryStrategy)
41
+ case userCancelled
42
+ case authorizationError(String)
43
+ case invalidRedirectURL
41
44
 
42
45
  enum RetryStrategy {
43
46
  case none
@@ -74,6 +77,12 @@ enum SpotifyAuthError: Error {
74
77
  return "Network error: \(reason). Please check your internet connection."
75
78
  case .recoverable(let message, _):
76
79
  return message
80
+ case .userCancelled:
81
+ return "User cancelled the authentication process."
82
+ case .authorizationError(let reason):
83
+ return "Authorization error: \(reason). Please try logging in again."
84
+ case .invalidRedirectURL:
85
+ return "Invalid redirect URL. Please check your app.json configuration."
77
86
  }
78
87
  }
79
88
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superfan-app/spotify-auth",
3
- "version": "0.1.57",
3
+ "version": "0.1.58",
4
4
  "description": "Spotify OAuth module for Expo",
5
5
  "main": "src/index.tsx",
6
6
  "types": "build/index.d.ts",