Loading app/src/androidTest/java/foundation/e/apps/feature/auth/login/GoogleOAuthScreenTest.kt +1 −0 Original line number Diff line number Diff line Loading @@ -133,6 +133,7 @@ private fun GoogleOAuthScreenTestContent( GoogleOAuthScreen( isSubmitting = isSubmitting, errorMessage = errorMessage, retryVersion = 0, onDismissError = { recorder.dismissErrorClicks += 1 }, onNavigateUp = { recorder.navigateUpClicks += 1 }, onGoogleLoginSubmit = { email, token -> Loading app/src/main/java/foundation/e/apps/domain/install/GetAppDetailsUseCase.kt +13 −1 Original line number Diff line number Diff line Loading @@ -35,6 +35,13 @@ class GetAppDetailsUseCase @Inject constructor( private val playStoreRepository: PlayStoreRepository, private val getEnabledSearchSourcesUseCase: GetEnabledSearchSourcesUseCase, ) { companion object { private val SOURCE_PRIORITY = listOf( Source.OPEN_SOURCE, Source.PWA, Source.PLAY_STORE, ) } suspend operator fun invoke(packageName: String, source: Source? = null): Application { if (blockedAppRepository.isBlockedApp(packageName)) { Loading Loading @@ -85,7 +92,7 @@ class GetAppDetailsUseCase @Inject constructor( availableStores: List<Source> ): Application { var application: Application? = null for (store in availableStores.sorted()) { for (store in prioritizeAvailableStores(availableStores)) { try { application = getAppDetailsUnchecked(packageName, store) break Loading @@ -99,6 +106,11 @@ class GetAppDetailsUseCase @Inject constructor( ) } private fun prioritizeAvailableStores(availableStores: List<Source>): List<Source> { val availableStoreSet = availableStores.toSet() return SOURCE_PRIORITY.filter(availableStoreSet::contains) } private suspend fun getAppDetailsUnchecked(packageName: String, source: Source) = when (source) { Source.OPEN_SOURCE -> { Loading app/src/main/java/foundation/e/apps/feature/auth/login/GoogleOAuthScreen.kt +3 −0 Original line number Diff line number Diff line Loading @@ -43,6 +43,7 @@ import foundation.e.apps.ui.compose.theme.AppTheme fun GoogleOAuthScreen( isSubmitting: Boolean, errorMessage: String?, retryVersion: Int, onDismissError: () -> Unit, onNavigateUp: () -> Unit, onGoogleLoginSubmit: (String, String) -> Unit, Loading @@ -50,6 +51,7 @@ fun GoogleOAuthScreen( webContent: @Composable (Modifier) -> Unit = { webModifier -> GoogleOAuthWebView( isSubmitting = isSubmitting, retryVersion = retryVersion, onGoogleLoginSubmit = onGoogleLoginSubmit, modifier = webModifier, ) Loading Loading @@ -147,6 +149,7 @@ private fun GoogleOAuthPreview( GoogleOAuthScreen( isSubmitting = isSubmitting, errorMessage = errorMessage, retryVersion = 0, onDismissError = {}, onNavigateUp = {}, onGoogleLoginSubmit = { _, _ -> }, Loading app/src/main/java/foundation/e/apps/feature/auth/login/GoogleSignInFragment.kt +5 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,8 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableIntStateOf import androidx.compose.runtime.setValue import androidx.compose.ui.platform.ComposeView import androidx.compose.ui.platform.ViewCompositionStrategy import androidx.fragment.app.Fragment Loading @@ -36,6 +38,7 @@ import foundation.e.apps.ui.compose.theme.AppTheme class GoogleSignInFragment : Fragment() { private val viewModel: LoginViewModel by activityViewModels() private var retryVersion by mutableIntStateOf(0) override fun onCreateView( inflater: LayoutInflater, Loading @@ -51,7 +54,9 @@ class GoogleSignInFragment : Fragment() { GoogleOAuthScreen( isSubmitting = uiState.isSubmitting, errorMessage = uiState.errorMessage, retryVersion = retryVersion, onDismissError = { retryVersion += 1 viewModel.dismissError() }, onNavigateUp = { Loading app/src/main/java/foundation/e/apps/feature/auth/login/component/GoogleOAuthWebView.kt +10 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ import android.webkit.WebView import android.webkit.WebViewClient import androidx.compose.runtime.Composable import androidx.compose.runtime.DisposableEffect import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember Loading @@ -38,6 +39,7 @@ import foundation.e.apps.feature.auth.login.GoogleOAuthCredentialsExtractor @Composable fun GoogleOAuthWebView( isSubmitting: Boolean, retryVersion: Int, onGoogleLoginSubmit: (String, String) -> Unit, modifier: Modifier = Modifier, ) { Loading Loading @@ -73,6 +75,14 @@ fun GoogleOAuthWebView( }, ) LaunchedEffect(retryVersion) { if (retryVersion == 0) { return@LaunchedEffect } lastSubmissionKey = null webView?.reload() } DisposableEffect(Unit) { onDispose { webView?.apply { Loading Loading
app/src/androidTest/java/foundation/e/apps/feature/auth/login/GoogleOAuthScreenTest.kt +1 −0 Original line number Diff line number Diff line Loading @@ -133,6 +133,7 @@ private fun GoogleOAuthScreenTestContent( GoogleOAuthScreen( isSubmitting = isSubmitting, errorMessage = errorMessage, retryVersion = 0, onDismissError = { recorder.dismissErrorClicks += 1 }, onNavigateUp = { recorder.navigateUpClicks += 1 }, onGoogleLoginSubmit = { email, token -> Loading
app/src/main/java/foundation/e/apps/domain/install/GetAppDetailsUseCase.kt +13 −1 Original line number Diff line number Diff line Loading @@ -35,6 +35,13 @@ class GetAppDetailsUseCase @Inject constructor( private val playStoreRepository: PlayStoreRepository, private val getEnabledSearchSourcesUseCase: GetEnabledSearchSourcesUseCase, ) { companion object { private val SOURCE_PRIORITY = listOf( Source.OPEN_SOURCE, Source.PWA, Source.PLAY_STORE, ) } suspend operator fun invoke(packageName: String, source: Source? = null): Application { if (blockedAppRepository.isBlockedApp(packageName)) { Loading Loading @@ -85,7 +92,7 @@ class GetAppDetailsUseCase @Inject constructor( availableStores: List<Source> ): Application { var application: Application? = null for (store in availableStores.sorted()) { for (store in prioritizeAvailableStores(availableStores)) { try { application = getAppDetailsUnchecked(packageName, store) break Loading @@ -99,6 +106,11 @@ class GetAppDetailsUseCase @Inject constructor( ) } private fun prioritizeAvailableStores(availableStores: List<Source>): List<Source> { val availableStoreSet = availableStores.toSet() return SOURCE_PRIORITY.filter(availableStoreSet::contains) } private suspend fun getAppDetailsUnchecked(packageName: String, source: Source) = when (source) { Source.OPEN_SOURCE -> { Loading
app/src/main/java/foundation/e/apps/feature/auth/login/GoogleOAuthScreen.kt +3 −0 Original line number Diff line number Diff line Loading @@ -43,6 +43,7 @@ import foundation.e.apps.ui.compose.theme.AppTheme fun GoogleOAuthScreen( isSubmitting: Boolean, errorMessage: String?, retryVersion: Int, onDismissError: () -> Unit, onNavigateUp: () -> Unit, onGoogleLoginSubmit: (String, String) -> Unit, Loading @@ -50,6 +51,7 @@ fun GoogleOAuthScreen( webContent: @Composable (Modifier) -> Unit = { webModifier -> GoogleOAuthWebView( isSubmitting = isSubmitting, retryVersion = retryVersion, onGoogleLoginSubmit = onGoogleLoginSubmit, modifier = webModifier, ) Loading Loading @@ -147,6 +149,7 @@ private fun GoogleOAuthPreview( GoogleOAuthScreen( isSubmitting = isSubmitting, errorMessage = errorMessage, retryVersion = 0, onDismissError = {}, onNavigateUp = {}, onGoogleLoginSubmit = { _, _ -> }, Loading
app/src/main/java/foundation/e/apps/feature/auth/login/GoogleSignInFragment.kt +5 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,8 @@ import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableIntStateOf import androidx.compose.runtime.setValue import androidx.compose.ui.platform.ComposeView import androidx.compose.ui.platform.ViewCompositionStrategy import androidx.fragment.app.Fragment Loading @@ -36,6 +38,7 @@ import foundation.e.apps.ui.compose.theme.AppTheme class GoogleSignInFragment : Fragment() { private val viewModel: LoginViewModel by activityViewModels() private var retryVersion by mutableIntStateOf(0) override fun onCreateView( inflater: LayoutInflater, Loading @@ -51,7 +54,9 @@ class GoogleSignInFragment : Fragment() { GoogleOAuthScreen( isSubmitting = uiState.isSubmitting, errorMessage = uiState.errorMessage, retryVersion = retryVersion, onDismissError = { retryVersion += 1 viewModel.dismissError() }, onNavigateUp = { Loading
app/src/main/java/foundation/e/apps/feature/auth/login/component/GoogleOAuthWebView.kt +10 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ import android.webkit.WebView import android.webkit.WebViewClient import androidx.compose.runtime.Composable import androidx.compose.runtime.DisposableEffect import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember Loading @@ -38,6 +39,7 @@ import foundation.e.apps.feature.auth.login.GoogleOAuthCredentialsExtractor @Composable fun GoogleOAuthWebView( isSubmitting: Boolean, retryVersion: Int, onGoogleLoginSubmit: (String, String) -> Unit, modifier: Modifier = Modifier, ) { Loading Loading @@ -73,6 +75,14 @@ fun GoogleOAuthWebView( }, ) LaunchedEffect(retryVersion) { if (retryVersion == 0) { return@LaunchedEffect } lastSubmissionKey = null webView?.reload() } DisposableEffect(Unit) { onDispose { webView?.apply { Loading