mirror of
https://github.com/bitwarden/android.git
synced 2026-03-12 05:04:17 -05:00
PM-10286: VerificationCodeScreen should not show MP reprompt if there is no master password (#5336)
This commit is contained in:
@@ -57,6 +57,11 @@ class VerificationCodeViewModel @Inject constructor(
|
||||
viewState = VerificationCodeState.ViewState.Loading,
|
||||
dialogState = null,
|
||||
isRefreshing = false,
|
||||
hasMasterPassword = authRepository
|
||||
.userStateFlow
|
||||
.value
|
||||
?.activeAccount
|
||||
?.hasMasterPassword == true,
|
||||
)
|
||||
},
|
||||
) {
|
||||
@@ -83,11 +88,8 @@ class VerificationCodeViewModel @Inject constructor(
|
||||
listDataState
|
||||
}
|
||||
}
|
||||
.onEach {
|
||||
sendAction(
|
||||
VerificationCodeAction.Internal.AuthCodesReceive(it),
|
||||
)
|
||||
}
|
||||
.map { VerificationCodeAction.Internal.AuthCodesReceive(it) }
|
||||
.onEach(::sendAction)
|
||||
.launchIn(viewModelScope)
|
||||
}
|
||||
|
||||
@@ -363,7 +365,7 @@ class VerificationCodeViewModel @Inject constructor(
|
||||
VerificationCodeDisplayItem(
|
||||
id = item.id,
|
||||
authCode = item.code,
|
||||
hideAuthCode = item.hasPasswordReprompt,
|
||||
hideAuthCode = item.hasPasswordReprompt && state.hasMasterPassword,
|
||||
label = item.name,
|
||||
supportingLabel = item.username,
|
||||
periodSeconds = item.periodSeconds,
|
||||
@@ -412,6 +414,7 @@ data class VerificationCodeState(
|
||||
val dialogState: DialogState?,
|
||||
val isPullToRefreshSettingEnabled: Boolean,
|
||||
val isRefreshing: Boolean,
|
||||
val hasMasterPassword: Boolean,
|
||||
) : Parcelable {
|
||||
|
||||
/**
|
||||
|
||||
@@ -518,4 +518,5 @@ private val DEFAULT_STATE = VerificationCodeState(
|
||||
isPullToRefreshSettingEnabled = false,
|
||||
dialogState = null,
|
||||
isRefreshing = false,
|
||||
hasMasterPassword = false,
|
||||
)
|
||||
|
||||
@@ -64,6 +64,7 @@ class VerificationCodeViewModelTest : BaseViewModelTest() {
|
||||
|
||||
private val mockUserAccount: UserState.Account = mockk {
|
||||
every { isPremium } returns true
|
||||
every { hasMasterPassword } returns true
|
||||
}
|
||||
|
||||
private val mockUserState: UserState = mockk {
|
||||
@@ -602,7 +603,6 @@ class VerificationCodeViewModelTest : BaseViewModelTest() {
|
||||
authRepository = authRepository,
|
||||
)
|
||||
|
||||
@Suppress("MaxLineLength")
|
||||
private fun createVerificationCodeState(
|
||||
viewState: VerificationCodeState.ViewState = VerificationCodeState.ViewState.Loading,
|
||||
) = VerificationCodeState(
|
||||
@@ -613,6 +613,7 @@ class VerificationCodeViewModelTest : BaseViewModelTest() {
|
||||
dialogState = null,
|
||||
isPullToRefreshSettingEnabled = settingsRepository.getPullToRefreshEnabledFlow().value,
|
||||
isRefreshing = false,
|
||||
hasMasterPassword = true,
|
||||
)
|
||||
|
||||
private fun createDisplayItemList() = listOf(
|
||||
|
||||
Reference in New Issue
Block a user