Loading app/src/main/java/foundation/e/apps/ui/parentFragment/LegacyLoadFailure.kt +1 −9 Original line number Diff line number Diff line Loading @@ -22,7 +22,6 @@ import androidx.annotation.StringRes import foundation.e.apps.R import foundation.e.apps.data.ResultSupreme import foundation.e.apps.data.enums.Source import foundation.e.apps.data.login.core.StoreType import foundation.e.apps.data.login.core.toAuthError import foundation.e.apps.data.login.exceptions.CleanApkException import foundation.e.apps.data.login.exceptions.CleanApkIOException Loading Loading @@ -100,7 +99,7 @@ fun ResultSupreme<*>.toLegacyLoadFailure( val resolvedMessage = message.ifBlank { "Data load error" } val resolvedException = exception ?: fallbackException(isTimeout(), resolvedMessage) val resolvedAuthError = when { this is ResultSupreme.Timeout || exception != null -> toAuthError(authStore.toStoreType()) this is ResultSupreme.Timeout || exception != null -> toAuthError(authStore) else -> null } Loading Loading @@ -248,13 +247,6 @@ private fun resolveExceptionKind( } } private fun AuthStore.toStoreType(): StoreType { return when (this) { AuthStore.PLAY_STORE -> StoreType.PLAY_STORE AuthStore.OPEN_SOURCE -> StoreType.CLEAN_APK } } private fun resolveDialogSpec( exception: Exception, kind: LegacyLoadFailureKind, Loading data/src/main/java/foundation/e/apps/data/login/api/StoreAuthCoordinator.kt +2 −2 Original line number Diff line number Diff line Loading @@ -18,8 +18,8 @@ package foundation.e.apps.data.login.api import foundation.e.apps.data.login.core.StoreAuthResult import foundation.e.apps.data.login.core.StoreType import foundation.e.apps.domain.auth.AuthStore interface StoreAuthCoordinator { suspend fun fetchAuthResults(storesToReset: List<StoreType> = emptyList()): List<StoreAuthResult> suspend fun fetchAuthResults(storesToReset: List<AuthStore> = emptyList()): List<StoreAuthResult> } data/src/main/java/foundation/e/apps/data/login/cleanapk/CleanApkAuthenticator.kt +2 −2 Original line number Diff line number Diff line Loading @@ -21,8 +21,8 @@ import foundation.e.apps.data.ResultSupreme import foundation.e.apps.data.login.core.StoreActivationPolicy import foundation.e.apps.data.login.core.StoreAuthResult import foundation.e.apps.data.login.core.StoreAuthenticator import foundation.e.apps.data.login.core.StoreType import foundation.e.apps.domain.auth.AuthSession import foundation.e.apps.domain.auth.AuthStore import foundation.e.apps.domain.preferences.SessionRepository import foundation.e.apps.domain.source.SourceSelectionRepository import javax.inject.Inject Loading @@ -46,7 +46,7 @@ class CleanApkAuthenticator @Inject constructor( ) ) override val storeType: StoreType = StoreType.CLEAN_APK override val storeType: AuthStore = AuthStore.OPEN_SOURCE override suspend fun isStoreActive(): Boolean { return storeActivationPolicy.shouldActivateCleanApkAuth() Loading data/src/main/java/foundation/e/apps/data/login/core/AuthErrorMapper.kt +1 −16 Original line number Diff line number Diff line Loading @@ -27,8 +27,7 @@ import foundation.e.apps.domain.auth.AuthError import foundation.e.apps.domain.auth.AuthStore import java.net.HttpURLConnection fun ResultSupreme<*>.toAuthError(storeType: StoreType): AuthError { val store = storeType.toAuthStore() fun ResultSupreme<*>.toAuthError(store: AuthStore): AuthError { val resolvedException = exception val resolvedMessage = resolveAuthMessage() val httpStatus = resolvedException.findHttpStatus() Loading Loading @@ -97,17 +96,3 @@ internal fun Throwable?.findHttpStatus(): Int? { } return null } fun StoreType.toAuthStore(): AuthStore { return when (this) { StoreType.PLAY_STORE -> AuthStore.PLAY_STORE StoreType.CLEAN_APK -> AuthStore.OPEN_SOURCE } } fun AuthStore.toStoreType(): StoreType { return when (this) { AuthStore.PLAY_STORE -> StoreType.PLAY_STORE AuthStore.OPEN_SOURCE -> StoreType.CLEAN_APK } } data/src/main/java/foundation/e/apps/data/login/core/AuthRefreshSnapshotMapper.kt +4 −4 Original line number Diff line number Diff line Loading @@ -49,13 +49,13 @@ internal fun List<StoreAuthResult>.toAuthRefreshSnapshot( } private fun List<StoreAuthResult>.toFaultyTokenReportPayload(): FaultyTokenReportPayload? { val result = firstOrNull { it.storeType == StoreType.PLAY_STORE }?.result ?: return null val result = firstOrNull { it.storeType == AuthStore.PLAY_STORE }?.result ?: return null val loginException = result.exception as? GPlayLoginException ?: return null if (loginException.loginMode != PlayStoreLoginMode.ANONYMOUS) { return null } if (result.toAuthError(StoreType.PLAY_STORE) !is AuthError.InvalidToken) { if (result.toAuthError(AuthStore.PLAY_STORE) !is AuthError.InvalidToken) { return null } Loading @@ -65,12 +65,12 @@ private fun List<StoreAuthResult>.toFaultyTokenReportPayload(): FaultyTokenRepor private fun StoreAuthResult.toAuthRefreshEntry(): AuthRefreshEntry { return AuthRefreshEntry( store = storeType.toAuthStore(), store = storeType, result = result.toAuthResult(storeType), ) } private fun ResultSupreme<AuthSession>.toAuthResult(storeType: StoreType): AuthResult<AuthSession> { private fun ResultSupreme<AuthSession>.toAuthResult(storeType: AuthStore): AuthResult<AuthSession> { return when (this) { is ResultSupreme.Success -> { val session = data Loading Loading
app/src/main/java/foundation/e/apps/ui/parentFragment/LegacyLoadFailure.kt +1 −9 Original line number Diff line number Diff line Loading @@ -22,7 +22,6 @@ import androidx.annotation.StringRes import foundation.e.apps.R import foundation.e.apps.data.ResultSupreme import foundation.e.apps.data.enums.Source import foundation.e.apps.data.login.core.StoreType import foundation.e.apps.data.login.core.toAuthError import foundation.e.apps.data.login.exceptions.CleanApkException import foundation.e.apps.data.login.exceptions.CleanApkIOException Loading Loading @@ -100,7 +99,7 @@ fun ResultSupreme<*>.toLegacyLoadFailure( val resolvedMessage = message.ifBlank { "Data load error" } val resolvedException = exception ?: fallbackException(isTimeout(), resolvedMessage) val resolvedAuthError = when { this is ResultSupreme.Timeout || exception != null -> toAuthError(authStore.toStoreType()) this is ResultSupreme.Timeout || exception != null -> toAuthError(authStore) else -> null } Loading Loading @@ -248,13 +247,6 @@ private fun resolveExceptionKind( } } private fun AuthStore.toStoreType(): StoreType { return when (this) { AuthStore.PLAY_STORE -> StoreType.PLAY_STORE AuthStore.OPEN_SOURCE -> StoreType.CLEAN_APK } } private fun resolveDialogSpec( exception: Exception, kind: LegacyLoadFailureKind, Loading
data/src/main/java/foundation/e/apps/data/login/api/StoreAuthCoordinator.kt +2 −2 Original line number Diff line number Diff line Loading @@ -18,8 +18,8 @@ package foundation.e.apps.data.login.api import foundation.e.apps.data.login.core.StoreAuthResult import foundation.e.apps.data.login.core.StoreType import foundation.e.apps.domain.auth.AuthStore interface StoreAuthCoordinator { suspend fun fetchAuthResults(storesToReset: List<StoreType> = emptyList()): List<StoreAuthResult> suspend fun fetchAuthResults(storesToReset: List<AuthStore> = emptyList()): List<StoreAuthResult> }
data/src/main/java/foundation/e/apps/data/login/cleanapk/CleanApkAuthenticator.kt +2 −2 Original line number Diff line number Diff line Loading @@ -21,8 +21,8 @@ import foundation.e.apps.data.ResultSupreme import foundation.e.apps.data.login.core.StoreActivationPolicy import foundation.e.apps.data.login.core.StoreAuthResult import foundation.e.apps.data.login.core.StoreAuthenticator import foundation.e.apps.data.login.core.StoreType import foundation.e.apps.domain.auth.AuthSession import foundation.e.apps.domain.auth.AuthStore import foundation.e.apps.domain.preferences.SessionRepository import foundation.e.apps.domain.source.SourceSelectionRepository import javax.inject.Inject Loading @@ -46,7 +46,7 @@ class CleanApkAuthenticator @Inject constructor( ) ) override val storeType: StoreType = StoreType.CLEAN_APK override val storeType: AuthStore = AuthStore.OPEN_SOURCE override suspend fun isStoreActive(): Boolean { return storeActivationPolicy.shouldActivateCleanApkAuth() Loading
data/src/main/java/foundation/e/apps/data/login/core/AuthErrorMapper.kt +1 −16 Original line number Diff line number Diff line Loading @@ -27,8 +27,7 @@ import foundation.e.apps.domain.auth.AuthError import foundation.e.apps.domain.auth.AuthStore import java.net.HttpURLConnection fun ResultSupreme<*>.toAuthError(storeType: StoreType): AuthError { val store = storeType.toAuthStore() fun ResultSupreme<*>.toAuthError(store: AuthStore): AuthError { val resolvedException = exception val resolvedMessage = resolveAuthMessage() val httpStatus = resolvedException.findHttpStatus() Loading Loading @@ -97,17 +96,3 @@ internal fun Throwable?.findHttpStatus(): Int? { } return null } fun StoreType.toAuthStore(): AuthStore { return when (this) { StoreType.PLAY_STORE -> AuthStore.PLAY_STORE StoreType.CLEAN_APK -> AuthStore.OPEN_SOURCE } } fun AuthStore.toStoreType(): StoreType { return when (this) { AuthStore.PLAY_STORE -> StoreType.PLAY_STORE AuthStore.OPEN_SOURCE -> StoreType.CLEAN_APK } }
data/src/main/java/foundation/e/apps/data/login/core/AuthRefreshSnapshotMapper.kt +4 −4 Original line number Diff line number Diff line Loading @@ -49,13 +49,13 @@ internal fun List<StoreAuthResult>.toAuthRefreshSnapshot( } private fun List<StoreAuthResult>.toFaultyTokenReportPayload(): FaultyTokenReportPayload? { val result = firstOrNull { it.storeType == StoreType.PLAY_STORE }?.result ?: return null val result = firstOrNull { it.storeType == AuthStore.PLAY_STORE }?.result ?: return null val loginException = result.exception as? GPlayLoginException ?: return null if (loginException.loginMode != PlayStoreLoginMode.ANONYMOUS) { return null } if (result.toAuthError(StoreType.PLAY_STORE) !is AuthError.InvalidToken) { if (result.toAuthError(AuthStore.PLAY_STORE) !is AuthError.InvalidToken) { return null } Loading @@ -65,12 +65,12 @@ private fun List<StoreAuthResult>.toFaultyTokenReportPayload(): FaultyTokenRepor private fun StoreAuthResult.toAuthRefreshEntry(): AuthRefreshEntry { return AuthRefreshEntry( store = storeType.toAuthStore(), store = storeType, result = result.toAuthResult(storeType), ) } private fun ResultSupreme<AuthSession>.toAuthResult(storeType: StoreType): AuthResult<AuthSession> { private fun ResultSupreme<AuthSession>.toAuthResult(storeType: AuthStore): AuthResult<AuthSession> { return when (this) { is ResultSupreme.Success -> { val session = data Loading