Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 188f25f3 authored by Helen Qin's avatar Helen Qin Committed by Android (Google) Code Review
Browse files

Merge "Don't invoke resultreceiver for the empty auth entry snackbar."

parents cddf3430 21f2eab0
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -55,11 +55,20 @@ class CredentialSelectorViewModel(
    /**************************************************************************/
    /*****                       Shared Callbacks                         *****/
    /**************************************************************************/
    fun onCancel() {
    fun onUserCancel() {
        Log.d(Constants.LOG_TAG, "User cancelled, finishing the ui")
        credManRepo.onUserCancel()
        uiState = uiState.copy(dialogState = DialogState.COMPLETE)
    }

    /** Close the activity and don't report anything to the backend.
     *  Example use case is the no-auth-info snackbar where the activity should simply display the
     *  UI and then be dismissed. */
    fun silentlyFinishActivity() {
        Log.d(Constants.LOG_TAG, "Silently finishing the ui")
        uiState = uiState.copy(dialogState = DialogState.COMPLETE)
    }

    fun onNewCredentialManagerRepo(credManRepo: CredentialManagerRepo) {
        this.credManRepo = credManRepo
        uiState = credManRepo.initState()
+1 −1
Original line number Diff line number Diff line
@@ -153,7 +153,7 @@ fun CreateCredentialScreen(
                }
            }
        },
        onDismiss = viewModel::onCancel
        onDismiss = viewModel::onUserCancel
    )
}

+7 −7
Original line number Diff line number Diff line
@@ -82,15 +82,15 @@ fun GetCredentialScreen(
    if (getCredentialUiState.currentScreenState == GetScreenState.REMOTE_ONLY) {
        RemoteCredentialSnackBarScreen(
            onClick = viewModel::getFlowOnMoreOptionOnSnackBarSelected,
            onCancel = viewModel::onCancel,
            onCancel = viewModel::onUserCancel,
        )
    } else if (getCredentialUiState.currentScreenState
        == GetScreenState.UNLOCKED_AUTH_ENTRIES_ONLY) {
        EmptyAuthEntrySnackBarScreen(
            authenticationEntryList =
            getCredentialUiState.providerDisplayInfo.authenticationEntryList,
            onCancel = viewModel::onCancel,
            onLastLokcedAuthEntryNotFound = viewModel::onLastLockedAuthEntryNotFoundError,
            onCancel = viewModel::silentlyFinishActivity,
            onLastLockedAuthEntryNotFound = viewModel::onLastLockedAuthEntryNotFoundError,
        )
    } else {
        ModalBottomSheet(
@@ -118,7 +118,7 @@ fun GetCredentialScreen(
                                onEntrySelected = viewModel::getFlowOnEntrySelected,
                                onBackButtonClicked =
                                viewModel::getFlowOnBackToPrimarySelectionScreen,
                                onCancel = viewModel::onCancel,
                                onCancel = viewModel::onUserCancel,
                                isNoAccount = getCredentialUiState.isNoAccount,
                            )
                        }
@@ -135,7 +135,7 @@ fun GetCredentialScreen(
                    }
                }
            },
            onDismiss = viewModel::onCancel,
            onDismiss = viewModel::onUserCancel,
        )
    }
}
@@ -668,11 +668,11 @@ fun RemoteCredentialSnackBarScreen(
fun EmptyAuthEntrySnackBarScreen(
    authenticationEntryList: List<AuthenticationEntryInfo>,
    onCancel: () -> Unit,
    onLastLokcedAuthEntryNotFound: () -> Unit,
    onLastLockedAuthEntryNotFound: () -> Unit,
) {
    val lastLocked = authenticationEntryList.firstOrNull({it.isLastUnlocked})
    if (lastLocked == null) {
        onLastLokcedAuthEntryNotFound()
        onLastLockedAuthEntryNotFound()
        return
    }