mirror of
https://github.com/bitwarden/android.git
synced 2026-03-22 06:11:38 -05:00
@@ -50,6 +50,7 @@ private const val AUTH_CODE_SPACING_INTERVAL = 3
|
||||
fun VaultItemLoginContent(
|
||||
commonState: VaultItemState.ViewState.Content.Common,
|
||||
loginItemState: VaultItemState.ViewState.Content.ItemType.Login,
|
||||
totpCodeItemData: TotpCodeItemData?,
|
||||
vaultCommonItemTypeHandlers: VaultCommonItemTypeHandlers,
|
||||
vaultLoginItemTypeHandlers: VaultLoginItemTypeHandlers,
|
||||
modifier: Modifier = Modifier,
|
||||
@@ -136,7 +137,7 @@ fun VaultItemLoginContent(
|
||||
}
|
||||
}
|
||||
|
||||
loginItemState.totpCodeItemData?.let { totpCodeItemData ->
|
||||
totpCodeItemData?.let { totpCodeItemData ->
|
||||
item(key = "totpCode") {
|
||||
Spacer(modifier = Modifier.height(8.dp))
|
||||
TotpField(
|
||||
|
||||
@@ -45,6 +45,7 @@ import com.x8bit.bitwarden.ui.vault.feature.item.handlers.VaultCommonItemTypeHan
|
||||
import com.x8bit.bitwarden.ui.vault.feature.item.handlers.VaultIdentityItemTypeHandlers
|
||||
import com.x8bit.bitwarden.ui.vault.feature.item.handlers.VaultLoginItemTypeHandlers
|
||||
import com.x8bit.bitwarden.ui.vault.feature.item.handlers.VaultSshKeyItemTypeHandlers
|
||||
import com.x8bit.bitwarden.ui.vault.feature.item.model.TotpCodeItemData
|
||||
import com.x8bit.bitwarden.ui.vault.model.VaultAddEditType
|
||||
|
||||
/**
|
||||
@@ -260,6 +261,7 @@ fun VaultItemScreen(
|
||||
) {
|
||||
VaultItemContent(
|
||||
viewState = state.viewState,
|
||||
totpCodeItemData = state.totpCodeItemData,
|
||||
modifier = Modifier
|
||||
.fillMaxSize(),
|
||||
vaultCommonItemTypeHandlers = remember(viewModel) {
|
||||
@@ -350,6 +352,7 @@ private fun VaultItemDialogs(
|
||||
@Composable
|
||||
private fun VaultItemContent(
|
||||
viewState: VaultItemState.ViewState,
|
||||
totpCodeItemData: TotpCodeItemData?,
|
||||
vaultCommonItemTypeHandlers: VaultCommonItemTypeHandlers,
|
||||
vaultLoginItemTypeHandlers: VaultLoginItemTypeHandlers,
|
||||
vaultCardItemTypeHandlers: VaultCardItemTypeHandlers,
|
||||
@@ -370,6 +373,7 @@ private fun VaultItemContent(
|
||||
VaultItemLoginContent(
|
||||
commonState = viewState.common,
|
||||
loginItemState = viewState.type,
|
||||
totpCodeItemData = totpCodeItemData,
|
||||
vaultCommonItemTypeHandlers = vaultCommonItemTypeHandlers,
|
||||
vaultLoginItemTypeHandlers = vaultLoginItemTypeHandlers,
|
||||
modifier = modifier,
|
||||
|
||||
@@ -1210,7 +1210,6 @@ class VaultItemViewModel @Inject constructor(
|
||||
baseIconUrl = environmentRepository.environment.environmentUrlData.baseIconUrl,
|
||||
isIconLoadingDisabled = settingsRepository.isIconLoadingDisabled,
|
||||
relatedLocations = this.data?.relatedLocations.orEmpty().toImmutableList(),
|
||||
totpCodeItemData = state.totpCodeItemData
|
||||
)
|
||||
?: VaultItemState.ViewState.Error(message = errorText)
|
||||
|
||||
@@ -1362,15 +1361,7 @@ class VaultItemViewModel @Inject constructor(
|
||||
private fun handleTotpDataReceive(
|
||||
action: VaultItemAction.Internal.TotpDataReceive,
|
||||
) {
|
||||
onLoginContent { content, login ->
|
||||
mutableStateFlow.update { currentState ->
|
||||
currentState.copy(
|
||||
viewState = content.copy(
|
||||
type = login.copy(totpCodeItemData = action.totpData),
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
mutableStateFlow.update { it.copy(totpCodeItemData = action.totpData) }
|
||||
}
|
||||
|
||||
//endregion Internal Type Handlers
|
||||
@@ -1693,7 +1684,6 @@ data class VaultItemState(
|
||||
val passwordData: PasswordData?,
|
||||
val uris: List<UriData>,
|
||||
val passwordRevisionDate: String?,
|
||||
val totpCodeItemData: TotpCodeItemData?,
|
||||
val isPremiumUser: Boolean,
|
||||
val canViewTotpCode: Boolean,
|
||||
val fido2CredentialCreationDateText: Text?,
|
||||
@@ -1705,8 +1695,7 @@ data class VaultItemState(
|
||||
val hasLoginCredentials: Boolean
|
||||
get() = username != null ||
|
||||
passwordData != null ||
|
||||
fido2CredentialCreationDateText != null ||
|
||||
totpCodeItemData != null
|
||||
fido2CredentialCreationDateText != null
|
||||
|
||||
/**
|
||||
* A wrapper for the password data.
|
||||
|
||||
@@ -42,7 +42,6 @@ fun CipherView.toViewState(
|
||||
previousState: VaultItemState.ViewState.Content?,
|
||||
isPremiumUser: Boolean,
|
||||
hasMasterPassword: Boolean,
|
||||
totpCodeItemData: TotpCodeItemData?,
|
||||
clock: Clock = Clock.systemDefaultZone(),
|
||||
canDelete: Boolean,
|
||||
canAssignToCollections: Boolean,
|
||||
@@ -125,8 +124,7 @@ fun CipherView.toViewState(
|
||||
),
|
||||
isPremiumUser = isPremiumUser,
|
||||
canViewTotpCode = isPremiumUser || this.organizationUseTotp,
|
||||
totpCodeItemData = totpCodeItemData,
|
||||
fido2CredentialCreationDateText = loginValues
|
||||
fido2CredentialCreationDateText = loginValues
|
||||
.fido2Credentials
|
||||
?.firstOrNull()
|
||||
?.getCreationDateText(clock),
|
||||
|
||||
Reference in New Issue
Block a user