Loading data/src/main/java/foundation/e/apps/data/login/core/StoreAuthenticator.kt +5 −0 Original line number Diff line number Diff line Loading @@ -29,5 +29,10 @@ interface StoreAuthenticator { suspend fun logout() suspend fun refreshAfterReset(): StoreAuthResult { logout() return login() } suspend fun isStoreActive(): Boolean } data/src/main/java/foundation/e/apps/data/login/playstore/PlayStoreAuthenticator.kt +4 −0 Original line number Diff line number Diff line Loading @@ -138,6 +138,10 @@ class PlayStoreAuthenticator @Inject constructor( playStoreStoredAuthPolicy.clearPersistedAuth() } override suspend fun refreshAfterReset(): StoreAuthResult { return refreshLogin() } /** * Bootstrap new Play auth explicitly from a login mode instead of reading persisted user state. */ Loading data/src/main/java/foundation/e/apps/data/login/playstore/PlayStoreStoredAuthPolicy.kt +3 −4 Original line number Diff line number Diff line Loading @@ -69,7 +69,7 @@ class PlayStoreStoredAuthPolicy { } is PlayStoreAuthValidationResult.InvalidAuth -> { clearRejectedAuthAndBootstrapState() clearRejectedBootstrapState() Resolution.RefreshRequired } Loading Loading @@ -114,11 +114,10 @@ class PlayStoreStoredAuthPolicy { suspend fun clearPersistedAuth() { playStoreAuthStore.saveAuthData(null) clearCachedValidation() clearRejectedBootstrapState() } suspend fun clearRejectedAuthAndBootstrapState() { playStoreAuthStore.saveAuthData(null) suspend fun clearRejectedBootstrapState() { playStoreAuthStore.saveAasToken("") clearCachedValidation() } Loading data/src/main/java/foundation/e/apps/data/login/playstore/PlayStoreTokenRefreshHandler.kt +3 −3 Original line number Diff line number Diff line Loading @@ -109,8 +109,8 @@ class PlayStoreTokenRefreshHandler : TokenRefreshHandler { } val failure = authResult.toAuthError(AuthStore.PLAY_STORE) if (shouldEvictPersistedAuth(failure)) { playStoreStoredAuthPolicy.clearRejectedAuthAndBootstrapState() if (shouldInvalidateBootstrapState(failure)) { playStoreStoredAuthPolicy.clearRejectedBootstrapState() } Timber.e("Play Store token refresh failed: %s", failure.describe()) AuthResult.Failure(failure) Loading @@ -129,7 +129,7 @@ class PlayStoreTokenRefreshHandler : TokenRefreshHandler { lastSuccessfulRefreshTimestamp = monotonicClockMs() } private fun shouldEvictPersistedAuth(error: AuthError): Boolean { private fun shouldInvalidateBootstrapState(error: AuthError): Boolean { return error is AuthError.InvalidToken } Loading data/src/main/java/foundation/e/apps/data/login/repository/AuthSessionRepositoryImpl.kt +1 −5 Original line number Diff line number Diff line Loading @@ -154,11 +154,7 @@ class AuthSessionRepositoryImpl @Inject constructor( PersistedLoginIntent.NONE -> AuthSession.Unauthenticated PersistedLoginIntent.OPEN_SOURCE -> AuthSession.OpenSourceSession PersistedLoginIntent.PLAY_ANONYMOUS -> if (authData == null) { AuthSession.Unauthenticated } else { AuthSession.PlayStoreSession(PlayStoreLoginMode.ANONYMOUS) } PersistedLoginIntent.PLAY_GOOGLE -> if (authData == null) { Loading Loading
data/src/main/java/foundation/e/apps/data/login/core/StoreAuthenticator.kt +5 −0 Original line number Diff line number Diff line Loading @@ -29,5 +29,10 @@ interface StoreAuthenticator { suspend fun logout() suspend fun refreshAfterReset(): StoreAuthResult { logout() return login() } suspend fun isStoreActive(): Boolean }
data/src/main/java/foundation/e/apps/data/login/playstore/PlayStoreAuthenticator.kt +4 −0 Original line number Diff line number Diff line Loading @@ -138,6 +138,10 @@ class PlayStoreAuthenticator @Inject constructor( playStoreStoredAuthPolicy.clearPersistedAuth() } override suspend fun refreshAfterReset(): StoreAuthResult { return refreshLogin() } /** * Bootstrap new Play auth explicitly from a login mode instead of reading persisted user state. */ Loading
data/src/main/java/foundation/e/apps/data/login/playstore/PlayStoreStoredAuthPolicy.kt +3 −4 Original line number Diff line number Diff line Loading @@ -69,7 +69,7 @@ class PlayStoreStoredAuthPolicy { } is PlayStoreAuthValidationResult.InvalidAuth -> { clearRejectedAuthAndBootstrapState() clearRejectedBootstrapState() Resolution.RefreshRequired } Loading Loading @@ -114,11 +114,10 @@ class PlayStoreStoredAuthPolicy { suspend fun clearPersistedAuth() { playStoreAuthStore.saveAuthData(null) clearCachedValidation() clearRejectedBootstrapState() } suspend fun clearRejectedAuthAndBootstrapState() { playStoreAuthStore.saveAuthData(null) suspend fun clearRejectedBootstrapState() { playStoreAuthStore.saveAasToken("") clearCachedValidation() } Loading
data/src/main/java/foundation/e/apps/data/login/playstore/PlayStoreTokenRefreshHandler.kt +3 −3 Original line number Diff line number Diff line Loading @@ -109,8 +109,8 @@ class PlayStoreTokenRefreshHandler : TokenRefreshHandler { } val failure = authResult.toAuthError(AuthStore.PLAY_STORE) if (shouldEvictPersistedAuth(failure)) { playStoreStoredAuthPolicy.clearRejectedAuthAndBootstrapState() if (shouldInvalidateBootstrapState(failure)) { playStoreStoredAuthPolicy.clearRejectedBootstrapState() } Timber.e("Play Store token refresh failed: %s", failure.describe()) AuthResult.Failure(failure) Loading @@ -129,7 +129,7 @@ class PlayStoreTokenRefreshHandler : TokenRefreshHandler { lastSuccessfulRefreshTimestamp = monotonicClockMs() } private fun shouldEvictPersistedAuth(error: AuthError): Boolean { private fun shouldInvalidateBootstrapState(error: AuthError): Boolean { return error is AuthError.InvalidToken } Loading
data/src/main/java/foundation/e/apps/data/login/repository/AuthSessionRepositoryImpl.kt +1 −5 Original line number Diff line number Diff line Loading @@ -154,11 +154,7 @@ class AuthSessionRepositoryImpl @Inject constructor( PersistedLoginIntent.NONE -> AuthSession.Unauthenticated PersistedLoginIntent.OPEN_SOURCE -> AuthSession.OpenSourceSession PersistedLoginIntent.PLAY_ANONYMOUS -> if (authData == null) { AuthSession.Unauthenticated } else { AuthSession.PlayStoreSession(PlayStoreLoginMode.ANONYMOUS) } PersistedLoginIntent.PLAY_GOOGLE -> if (authData == null) { Loading