mirror of
https://github.com/bitwarden/android.git
synced 2025-02-16 11:59:57 +03:00
Apply formatter to entire app (#4053)
This commit is contained in:
parent
2af96988ab
commit
8a30f14dea
50 changed files with 170 additions and 165 deletions
|
@ -11,7 +11,7 @@ val AuthRequestType.isSso: Boolean
|
||||||
AuthRequestType.OTHER_DEVICE -> false
|
AuthRequestType.OTHER_DEVICE -> false
|
||||||
AuthRequestType.SSO_OTHER_DEVICE,
|
AuthRequestType.SSO_OTHER_DEVICE,
|
||||||
AuthRequestType.SSO_ADMIN_APPROVAL,
|
AuthRequestType.SSO_ADMIN_APPROVAL,
|
||||||
-> true
|
-> true
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -21,7 +21,7 @@ fun AuthRequestType.toAuthRequestTypeJson(): AuthRequestTypeJson =
|
||||||
when (this) {
|
when (this) {
|
||||||
AuthRequestType.OTHER_DEVICE,
|
AuthRequestType.OTHER_DEVICE,
|
||||||
AuthRequestType.SSO_OTHER_DEVICE,
|
AuthRequestType.SSO_OTHER_DEVICE,
|
||||||
-> AuthRequestTypeJson.LOGIN_WITH_DEVICE
|
-> AuthRequestTypeJson.LOGIN_WITH_DEVICE
|
||||||
|
|
||||||
AuthRequestType.SSO_ADMIN_APPROVAL -> AuthRequestTypeJson.ADMIN_APPROVAL
|
AuthRequestType.SSO_ADMIN_APPROVAL -> AuthRequestTypeJson.ADMIN_APPROVAL
|
||||||
}
|
}
|
||||||
|
|
|
@ -998,7 +998,7 @@ class AuthRepositoryImpl(
|
||||||
ForcePasswordResetReason.ADMIN_FORCE_PASSWORD_RESET,
|
ForcePasswordResetReason.ADMIN_FORCE_PASSWORD_RESET,
|
||||||
ForcePasswordResetReason.WEAK_MASTER_PASSWORD_ON_LOGIN,
|
ForcePasswordResetReason.WEAK_MASTER_PASSWORD_ON_LOGIN,
|
||||||
null,
|
null,
|
||||||
-> {
|
-> {
|
||||||
authSdkSource
|
authSdkSource
|
||||||
.makeRegisterKeys(
|
.makeRegisterKeys(
|
||||||
email = activeAccount.profile.email,
|
email = activeAccount.profile.email,
|
||||||
|
@ -1048,7 +1048,7 @@ class AuthRepositoryImpl(
|
||||||
is VaultUnlockResult.AuthenticationError,
|
is VaultUnlockResult.AuthenticationError,
|
||||||
VaultUnlockResult.InvalidStateError,
|
VaultUnlockResult.InvalidStateError,
|
||||||
VaultUnlockResult.GenericError,
|
VaultUnlockResult.GenericError,
|
||||||
-> {
|
-> {
|
||||||
IllegalStateException("Failed to unlock vault").asFailure()
|
IllegalStateException("Failed to unlock vault").asFailure()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,5 +11,5 @@ fun VaultUnlockError.toLoginErrorResult(): LoginResult.Error = when (this) {
|
||||||
is VaultUnlockResult.AuthenticationError -> LoginResult.Error(this.message)
|
is VaultUnlockResult.AuthenticationError -> LoginResult.Error(this.message)
|
||||||
VaultUnlockResult.GenericError,
|
VaultUnlockResult.GenericError,
|
||||||
VaultUnlockResult.InvalidStateError,
|
VaultUnlockResult.InvalidStateError,
|
||||||
-> LoginResult.Error(errorMessage = null)
|
-> LoginResult.Error(errorMessage = null)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package com.x8bit.bitwarden.data.auth.repository.model
|
package com.x8bit.bitwarden.data.auth.repository.model
|
||||||
|
|
||||||
import com.x8bit.bitwarden.data.vault.datasource.network.model.SyncResponseJson
|
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
|
|
@ -176,12 +176,12 @@ val AuthDiskSource.activeUserIdChangesFlow: Flow<String?>
|
||||||
@OptIn(ExperimentalCoroutinesApi::class)
|
@OptIn(ExperimentalCoroutinesApi::class)
|
||||||
val AuthDiskSource.onboardingStatusChangesFlow: Flow<OnboardingStatus?>
|
val AuthDiskSource.onboardingStatusChangesFlow: Flow<OnboardingStatus?>
|
||||||
get() = activeUserIdChangesFlow
|
get() = activeUserIdChangesFlow
|
||||||
.flatMapLatest { activeUserId ->
|
.flatMapLatest { activeUserId ->
|
||||||
activeUserId
|
activeUserId
|
||||||
?.let { this.getOnboardingStatusFlow(userId = it) }
|
?.let { this.getOnboardingStatusFlow(userId = it) }
|
||||||
?: flowOf(null)
|
?: flowOf(null)
|
||||||
}
|
}
|
||||||
.distinctUntilChanged()
|
.distinctUntilChanged()
|
||||||
|
|
||||||
val AuthDiskSource.currentOnboardingStatus: OnboardingStatus?
|
val AuthDiskSource.currentOnboardingStatus: OnboardingStatus?
|
||||||
get() = this
|
get() = this
|
||||||
|
|
|
@ -55,9 +55,9 @@ class BiometricsEncryptionManagerImpl(
|
||||||
}
|
}
|
||||||
val cipher = try {
|
val cipher = try {
|
||||||
Cipher.getInstance(CIPHER_TRANSFORMATION)
|
Cipher.getInstance(CIPHER_TRANSFORMATION)
|
||||||
} catch (e: NoSuchAlgorithmException) {
|
} catch (_: NoSuchAlgorithmException) {
|
||||||
return null
|
return null
|
||||||
} catch (e: NoSuchPaddingException) {
|
} catch (_: NoSuchPaddingException) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
// This should never fail to initialize / return false because the cipher is newly generated
|
// This should never fail to initialize / return false because the cipher is newly generated
|
||||||
|
@ -116,20 +116,20 @@ class BiometricsEncryptionManagerImpl(
|
||||||
KeyProperties.KEY_ALGORITHM_AES,
|
KeyProperties.KEY_ALGORITHM_AES,
|
||||||
ENCRYPTION_KEYSTORE_NAME,
|
ENCRYPTION_KEYSTORE_NAME,
|
||||||
)
|
)
|
||||||
} catch (e: NoSuchAlgorithmException) {
|
} catch (_: NoSuchAlgorithmException) {
|
||||||
return null
|
return null
|
||||||
} catch (e: NoSuchProviderException) {
|
} catch (_: NoSuchProviderException) {
|
||||||
return null
|
return null
|
||||||
} catch (e: IllegalArgumentException) {
|
} catch (_: IllegalArgumentException) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
keyGen.init(keyGenParameterSpec)
|
keyGen.init(keyGenParameterSpec)
|
||||||
keyGen.generateKey()
|
keyGen.generateKey()
|
||||||
} catch (e: InvalidAlgorithmParameterException) {
|
} catch (_: InvalidAlgorithmParameterException) {
|
||||||
return null
|
return null
|
||||||
} catch (e: ProviderException) {
|
} catch (_: ProviderException) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,29 +142,29 @@ class BiometricsEncryptionManagerImpl(
|
||||||
private fun getSecretKeyOrNull(): SecretKey? {
|
private fun getSecretKeyOrNull(): SecretKey? {
|
||||||
try {
|
try {
|
||||||
keystore.load(null)
|
keystore.load(null)
|
||||||
} catch (e: IllegalArgumentException) {
|
} catch (_: IllegalArgumentException) {
|
||||||
// keystore could not be loaded because [param] is unrecognized.
|
// keystore could not be loaded because [param] is unrecognized.
|
||||||
return null
|
return null
|
||||||
} catch (e: IOException) {
|
} catch (_: IOException) {
|
||||||
// keystore data format is invalid or the password is incorrect.
|
// keystore data format is invalid or the password is incorrect.
|
||||||
return null
|
return null
|
||||||
} catch (e: NoSuchAlgorithmException) {
|
} catch (_: NoSuchAlgorithmException) {
|
||||||
// keystore integrity could not be checked due to missing algorithm.
|
// keystore integrity could not be checked due to missing algorithm.
|
||||||
return null
|
return null
|
||||||
} catch (e: CertificateException) {
|
} catch (_: CertificateException) {
|
||||||
// keystore certificates could not be loaded
|
// keystore certificates could not be loaded
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
return try {
|
return try {
|
||||||
keystore.getKey(ENCRYPTION_KEY_NAME, null) as? SecretKey
|
keystore.getKey(ENCRYPTION_KEY_NAME, null) as? SecretKey
|
||||||
} catch (e: KeyStoreException) {
|
} catch (_: KeyStoreException) {
|
||||||
// keystore was not loaded
|
// keystore was not loaded
|
||||||
null
|
null
|
||||||
} catch (e: NoSuchAlgorithmException) {
|
} catch (_: NoSuchAlgorithmException) {
|
||||||
// keystore algorithm cannot be found
|
// keystore algorithm cannot be found
|
||||||
null
|
null
|
||||||
} catch (e: UnrecoverableKeyException) {
|
} catch (_: UnrecoverableKeyException) {
|
||||||
// key could not be recovered
|
// key could not be recovered
|
||||||
null
|
null
|
||||||
}
|
}
|
||||||
|
@ -181,15 +181,15 @@ class BiometricsEncryptionManagerImpl(
|
||||||
try {
|
try {
|
||||||
cipher.init(Cipher.ENCRYPT_MODE, secretKey)
|
cipher.init(Cipher.ENCRYPT_MODE, secretKey)
|
||||||
true
|
true
|
||||||
} catch (e: KeyPermanentlyInvalidatedException) {
|
} catch (_: KeyPermanentlyInvalidatedException) {
|
||||||
// Biometric has changed
|
// Biometric has changed
|
||||||
settingsDiskSource.systemBiometricIntegritySource = null
|
settingsDiskSource.systemBiometricIntegritySource = null
|
||||||
false
|
false
|
||||||
} catch (e: UnrecoverableKeyException) {
|
} catch (_: UnrecoverableKeyException) {
|
||||||
// Biometric was disabled and re-enabled
|
// Biometric was disabled and re-enabled
|
||||||
settingsDiskSource.systemBiometricIntegritySource = null
|
settingsDiskSource.systemBiometricIntegritySource = null
|
||||||
false
|
false
|
||||||
} catch (e: InvalidKeyException) {
|
} catch (_: InvalidKeyException) {
|
||||||
// Fallback for old Bitwarden users without a key
|
// Fallback for old Bitwarden users without a key
|
||||||
createIntegrityValues(userId)
|
createIntegrityValues(userId)
|
||||||
true
|
true
|
||||||
|
|
|
@ -129,7 +129,7 @@ class PushManagerImpl @Inject constructor(
|
||||||
when (val type = notification.notificationType) {
|
when (val type = notification.notificationType) {
|
||||||
NotificationType.AUTH_REQUEST,
|
NotificationType.AUTH_REQUEST,
|
||||||
NotificationType.AUTH_REQUEST_RESPONSE,
|
NotificationType.AUTH_REQUEST_RESPONSE,
|
||||||
-> {
|
-> {
|
||||||
json
|
json
|
||||||
.decodeFromString<NotificationPayload.PasswordlessRequestNotification>(
|
.decodeFromString<NotificationPayload.PasswordlessRequestNotification>(
|
||||||
string = notification.payload,
|
string = notification.payload,
|
||||||
|
@ -156,7 +156,7 @@ class PushManagerImpl @Inject constructor(
|
||||||
|
|
||||||
NotificationType.SYNC_CIPHER_CREATE,
|
NotificationType.SYNC_CIPHER_CREATE,
|
||||||
NotificationType.SYNC_CIPHER_UPDATE,
|
NotificationType.SYNC_CIPHER_UPDATE,
|
||||||
-> {
|
-> {
|
||||||
json
|
json
|
||||||
.decodeFromString<NotificationPayload.SyncCipherNotification>(
|
.decodeFromString<NotificationPayload.SyncCipherNotification>(
|
||||||
string = notification.payload,
|
string = notification.payload,
|
||||||
|
@ -183,7 +183,7 @@ class PushManagerImpl @Inject constructor(
|
||||||
|
|
||||||
NotificationType.SYNC_CIPHER_DELETE,
|
NotificationType.SYNC_CIPHER_DELETE,
|
||||||
NotificationType.SYNC_LOGIN_DELETE,
|
NotificationType.SYNC_LOGIN_DELETE,
|
||||||
-> {
|
-> {
|
||||||
json
|
json
|
||||||
.decodeFromString<NotificationPayload.SyncCipherNotification>(
|
.decodeFromString<NotificationPayload.SyncCipherNotification>(
|
||||||
string = notification.payload,
|
string = notification.payload,
|
||||||
|
@ -196,13 +196,13 @@ class PushManagerImpl @Inject constructor(
|
||||||
NotificationType.SYNC_CIPHERS,
|
NotificationType.SYNC_CIPHERS,
|
||||||
NotificationType.SYNC_SETTINGS,
|
NotificationType.SYNC_SETTINGS,
|
||||||
NotificationType.SYNC_VAULT,
|
NotificationType.SYNC_VAULT,
|
||||||
-> {
|
-> {
|
||||||
mutableFullSyncSharedFlow.tryEmit(Unit)
|
mutableFullSyncSharedFlow.tryEmit(Unit)
|
||||||
}
|
}
|
||||||
|
|
||||||
NotificationType.SYNC_FOLDER_CREATE,
|
NotificationType.SYNC_FOLDER_CREATE,
|
||||||
NotificationType.SYNC_FOLDER_UPDATE,
|
NotificationType.SYNC_FOLDER_UPDATE,
|
||||||
-> {
|
-> {
|
||||||
json
|
json
|
||||||
.decodeFromString<NotificationPayload.SyncFolderNotification>(
|
.decodeFromString<NotificationPayload.SyncFolderNotification>(
|
||||||
string = notification.payload,
|
string = notification.payload,
|
||||||
|
@ -238,7 +238,7 @@ class PushManagerImpl @Inject constructor(
|
||||||
|
|
||||||
NotificationType.SYNC_SEND_CREATE,
|
NotificationType.SYNC_SEND_CREATE,
|
||||||
NotificationType.SYNC_SEND_UPDATE,
|
NotificationType.SYNC_SEND_UPDATE,
|
||||||
-> {
|
-> {
|
||||||
json
|
json
|
||||||
.decodeFromString<NotificationPayload.SyncSendNotification>(
|
.decodeFromString<NotificationPayload.SyncSendNotification>(
|
||||||
string = notification.payload,
|
string = notification.payload,
|
||||||
|
|
|
@ -19,6 +19,7 @@ class SpecialCircumstanceManagerImpl(
|
||||||
) : SpecialCircumstanceManager {
|
) : SpecialCircumstanceManager {
|
||||||
private val mutableSpecialCircumstanceFlow = MutableStateFlow<SpecialCircumstance?>(null)
|
private val mutableSpecialCircumstanceFlow = MutableStateFlow<SpecialCircumstance?>(null)
|
||||||
private val unconfinedScope = CoroutineScope(dispatcherManager.unconfined)
|
private val unconfinedScope = CoroutineScope(dispatcherManager.unconfined)
|
||||||
|
|
||||||
init {
|
init {
|
||||||
authRepository
|
authRepository
|
||||||
.userStateFlow
|
.userStateFlow
|
||||||
|
|
|
@ -20,8 +20,6 @@ import com.x8bit.bitwarden.data.platform.manager.AssetManager
|
||||||
import com.x8bit.bitwarden.data.platform.manager.AssetManagerImpl
|
import com.x8bit.bitwarden.data.platform.manager.AssetManagerImpl
|
||||||
import com.x8bit.bitwarden.data.platform.manager.BiometricsEncryptionManager
|
import com.x8bit.bitwarden.data.platform.manager.BiometricsEncryptionManager
|
||||||
import com.x8bit.bitwarden.data.platform.manager.BiometricsEncryptionManagerImpl
|
import com.x8bit.bitwarden.data.platform.manager.BiometricsEncryptionManagerImpl
|
||||||
import com.x8bit.bitwarden.data.platform.processor.AuthenticatorBridgeProcessor
|
|
||||||
import com.x8bit.bitwarden.data.platform.processor.AuthenticatorBridgeProcessorImpl
|
|
||||||
import com.x8bit.bitwarden.data.platform.manager.CrashLogsManager
|
import com.x8bit.bitwarden.data.platform.manager.CrashLogsManager
|
||||||
import com.x8bit.bitwarden.data.platform.manager.CrashLogsManagerImpl
|
import com.x8bit.bitwarden.data.platform.manager.CrashLogsManagerImpl
|
||||||
import com.x8bit.bitwarden.data.platform.manager.DebugMenuFeatureFlagManagerImpl
|
import com.x8bit.bitwarden.data.platform.manager.DebugMenuFeatureFlagManagerImpl
|
||||||
|
@ -51,6 +49,8 @@ import com.x8bit.bitwarden.data.platform.manager.garbage.GarbageCollectionManage
|
||||||
import com.x8bit.bitwarden.data.platform.manager.garbage.GarbageCollectionManagerImpl
|
import com.x8bit.bitwarden.data.platform.manager.garbage.GarbageCollectionManagerImpl
|
||||||
import com.x8bit.bitwarden.data.platform.manager.restriction.RestrictionManager
|
import com.x8bit.bitwarden.data.platform.manager.restriction.RestrictionManager
|
||||||
import com.x8bit.bitwarden.data.platform.manager.restriction.RestrictionManagerImpl
|
import com.x8bit.bitwarden.data.platform.manager.restriction.RestrictionManagerImpl
|
||||||
|
import com.x8bit.bitwarden.data.platform.processor.AuthenticatorBridgeProcessor
|
||||||
|
import com.x8bit.bitwarden.data.platform.processor.AuthenticatorBridgeProcessorImpl
|
||||||
import com.x8bit.bitwarden.data.platform.repository.AuthenticatorBridgeRepository
|
import com.x8bit.bitwarden.data.platform.repository.AuthenticatorBridgeRepository
|
||||||
import com.x8bit.bitwarden.data.platform.repository.DebugMenuRepository
|
import com.x8bit.bitwarden.data.platform.repository.DebugMenuRepository
|
||||||
import com.x8bit.bitwarden.data.platform.repository.EnvironmentRepository
|
import com.x8bit.bitwarden.data.platform.repository.EnvironmentRepository
|
||||||
|
|
|
@ -75,7 +75,7 @@ class AuthenticatorBridgeRepositoryImpl(
|
||||||
is VaultUnlockResult.AuthenticationError,
|
is VaultUnlockResult.AuthenticationError,
|
||||||
VaultUnlockResult.GenericError,
|
VaultUnlockResult.GenericError,
|
||||||
VaultUnlockResult.InvalidStateError,
|
VaultUnlockResult.InvalidStateError,
|
||||||
-> {
|
-> {
|
||||||
// Not being able to unlock the user's vault with the
|
// Not being able to unlock the user's vault with the
|
||||||
// decrypted unlock key is an unexpected case, but if it does
|
// decrypted unlock key is an unexpected case, but if it does
|
||||||
// happen we omit the account from list of shared accounts
|
// happen we omit the account from list of shared accounts
|
||||||
|
|
|
@ -125,11 +125,11 @@ fun EnvironmentUrlDataJson.toEnvironmentUrls(): Environment =
|
||||||
when (this) {
|
when (this) {
|
||||||
EnvironmentUrlDataJson.DEFAULT_US,
|
EnvironmentUrlDataJson.DEFAULT_US,
|
||||||
EnvironmentUrlDataJson.DEFAULT_LEGACY_US,
|
EnvironmentUrlDataJson.DEFAULT_LEGACY_US,
|
||||||
-> Environment.Us
|
-> Environment.Us
|
||||||
|
|
||||||
EnvironmentUrlDataJson.DEFAULT_EU,
|
EnvironmentUrlDataJson.DEFAULT_EU,
|
||||||
EnvironmentUrlDataJson.DEFAULT_LEGACY_EU,
|
EnvironmentUrlDataJson.DEFAULT_LEGACY_EU,
|
||||||
-> Environment.Eu
|
-> Environment.Eu
|
||||||
|
|
||||||
else -> Environment.SelfHosted(environmentUrlData = this)
|
else -> Environment.SelfHosted(environmentUrlData = this)
|
||||||
}
|
}
|
||||||
|
|
|
@ -121,7 +121,7 @@ private fun parseDomainNameOrNullInternal(
|
||||||
val tldRange: IntRange? = when (largestMatch) {
|
val tldRange: IntRange? = when (largestMatch) {
|
||||||
is SuffixMatchType.Exception,
|
is SuffixMatchType.Exception,
|
||||||
is SuffixMatchType.Normal,
|
is SuffixMatchType.Normal,
|
||||||
-> {
|
-> {
|
||||||
host.findLastSubstringIndicesOrNull(largestMatch.partialDomain)
|
host.findLastSubstringIndicesOrNull(largestMatch.partialDomain)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@ package com.x8bit.bitwarden.data.vault.datasource.sdk
|
||||||
import com.bitwarden.core.DateTime
|
import com.bitwarden.core.DateTime
|
||||||
import com.bitwarden.core.DerivePinKeyResponse
|
import com.bitwarden.core.DerivePinKeyResponse
|
||||||
import com.bitwarden.core.InitOrgCryptoRequest
|
import com.bitwarden.core.InitOrgCryptoRequest
|
||||||
import com.bitwarden.core.InitUserCryptoMethod
|
|
||||||
import com.bitwarden.core.InitUserCryptoRequest
|
import com.bitwarden.core.InitUserCryptoRequest
|
||||||
import com.bitwarden.core.UpdatePasswordResponse
|
import com.bitwarden.core.UpdatePasswordResponse
|
||||||
import com.bitwarden.crypto.Kdf
|
import com.bitwarden.crypto.Kdf
|
||||||
|
|
|
@ -489,7 +489,7 @@ class VaultLockManagerImpl(
|
||||||
// User no longer active or engaging with the app.
|
// User no longer active or engaging with the app.
|
||||||
CheckTimeoutReason.APP_BACKGROUNDED,
|
CheckTimeoutReason.APP_BACKGROUNDED,
|
||||||
CheckTimeoutReason.USER_CHANGED,
|
CheckTimeoutReason.USER_CHANGED,
|
||||||
-> {
|
-> {
|
||||||
handleTimeoutActionWithDelay(
|
handleTimeoutActionWithDelay(
|
||||||
userId = userId,
|
userId = userId,
|
||||||
vaultTimeoutAction = vaultTimeoutAction,
|
vaultTimeoutAction = vaultTimeoutAction,
|
||||||
|
|
|
@ -464,11 +464,11 @@ data class CompleteRegistrationState(
|
||||||
PasswordStrengthState.WEAK_1,
|
PasswordStrengthState.WEAK_1,
|
||||||
PasswordStrengthState.WEAK_2,
|
PasswordStrengthState.WEAK_2,
|
||||||
PasswordStrengthState.WEAK_3,
|
PasswordStrengthState.WEAK_3,
|
||||||
-> false
|
-> false
|
||||||
|
|
||||||
PasswordStrengthState.GOOD,
|
PasswordStrengthState.GOOD,
|
||||||
PasswordStrengthState.STRONG,
|
PasswordStrengthState.STRONG,
|
||||||
-> true
|
-> true
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -415,11 +415,11 @@ data class CreateAccountState(
|
||||||
PasswordStrengthState.WEAK_1,
|
PasswordStrengthState.WEAK_1,
|
||||||
PasswordStrengthState.WEAK_2,
|
PasswordStrengthState.WEAK_2,
|
||||||
PasswordStrengthState.WEAK_3,
|
PasswordStrengthState.WEAK_3,
|
||||||
-> false
|
-> false
|
||||||
|
|
||||||
PasswordStrengthState.GOOD,
|
PasswordStrengthState.GOOD,
|
||||||
PasswordStrengthState.STRONG,
|
PasswordStrengthState.STRONG,
|
||||||
-> true
|
-> true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ class EnvironmentViewModel @Inject constructor(
|
||||||
val environmentUrlData = when (val environment = environmentRepository.environment) {
|
val environmentUrlData = when (val environment = environmentRepository.environment) {
|
||||||
Environment.Us,
|
Environment.Us,
|
||||||
Environment.Eu,
|
Environment.Eu,
|
||||||
-> EnvironmentUrlDataJson(base = "")
|
-> EnvironmentUrlDataJson(base = "")
|
||||||
|
|
||||||
is Environment.SelfHosted -> environment.environmentUrlData
|
is Environment.SelfHosted -> environment.environmentUrlData
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,8 +12,8 @@ import javax.inject.Inject
|
||||||
class ExpiredRegistrationLinkViewModel @Inject constructor(
|
class ExpiredRegistrationLinkViewModel @Inject constructor(
|
||||||
private val authRepository: AuthRepository,
|
private val authRepository: AuthRepository,
|
||||||
) : BaseViewModel<Unit, ExpiredRegistrationLinkEvent, ExpiredRegistrationLinkAction>(
|
) : BaseViewModel<Unit, ExpiredRegistrationLinkEvent, ExpiredRegistrationLinkAction>(
|
||||||
initialState = Unit,
|
initialState = Unit,
|
||||||
) {
|
) {
|
||||||
override fun handleAction(action: ExpiredRegistrationLinkAction) {
|
override fun handleAction(action: ExpiredRegistrationLinkAction) {
|
||||||
when (action) {
|
when (action) {
|
||||||
ExpiredRegistrationLinkAction.CloseClicked -> handleCloseClicked()
|
ExpiredRegistrationLinkAction.CloseClicked -> handleCloseClicked()
|
||||||
|
|
|
@ -161,7 +161,7 @@ class LoginWithDeviceViewModel @Inject constructor(
|
||||||
when (state.loginWithDeviceType) {
|
when (state.loginWithDeviceType) {
|
||||||
LoginWithDeviceType.OTHER_DEVICE,
|
LoginWithDeviceType.OTHER_DEVICE,
|
||||||
LoginWithDeviceType.SSO_OTHER_DEVICE,
|
LoginWithDeviceType.SSO_OTHER_DEVICE,
|
||||||
-> {
|
-> {
|
||||||
mutableStateFlow.update {
|
mutableStateFlow.update {
|
||||||
it.copy(
|
it.copy(
|
||||||
viewState = LoginWithDeviceState.ViewState.Content(
|
viewState = LoginWithDeviceState.ViewState.Content(
|
||||||
|
@ -292,7 +292,7 @@ class LoginWithDeviceViewModel @Inject constructor(
|
||||||
|
|
||||||
LoginWithDeviceType.SSO_ADMIN_APPROVAL,
|
LoginWithDeviceType.SSO_ADMIN_APPROVAL,
|
||||||
LoginWithDeviceType.SSO_OTHER_DEVICE,
|
LoginWithDeviceType.SSO_OTHER_DEVICE,
|
||||||
-> {
|
-> {
|
||||||
authRepository.completeTdeLogin(
|
authRepository.completeTdeLogin(
|
||||||
requestPrivateKey = loginData.privateKey,
|
requestPrivateKey = loginData.privateKey,
|
||||||
asymmetricalKey = loginData.asymmetricalKey,
|
asymmetricalKey = loginData.asymmetricalKey,
|
||||||
|
@ -352,7 +352,7 @@ data class LoginWithDeviceState(
|
||||||
get() = when (loginWithDeviceType) {
|
get() = when (loginWithDeviceType) {
|
||||||
LoginWithDeviceType.OTHER_DEVICE,
|
LoginWithDeviceType.OTHER_DEVICE,
|
||||||
LoginWithDeviceType.SSO_OTHER_DEVICE,
|
LoginWithDeviceType.SSO_OTHER_DEVICE,
|
||||||
-> R.string.log_in_with_device.asText()
|
-> R.string.log_in_with_device.asText()
|
||||||
|
|
||||||
LoginWithDeviceType.SSO_ADMIN_APPROVAL -> R.string.log_in_initiated.asText()
|
LoginWithDeviceType.SSO_ADMIN_APPROVAL -> R.string.log_in_initiated.asText()
|
||||||
}
|
}
|
||||||
|
@ -389,10 +389,10 @@ data class LoginWithDeviceState(
|
||||||
get() = when (loginWithDeviceType) {
|
get() = when (loginWithDeviceType) {
|
||||||
LoginWithDeviceType.OTHER_DEVICE,
|
LoginWithDeviceType.OTHER_DEVICE,
|
||||||
LoginWithDeviceType.SSO_OTHER_DEVICE,
|
LoginWithDeviceType.SSO_OTHER_DEVICE,
|
||||||
-> R.string.log_in_initiated.asText()
|
-> R.string.log_in_initiated.asText()
|
||||||
|
|
||||||
LoginWithDeviceType.SSO_ADMIN_APPROVAL,
|
LoginWithDeviceType.SSO_ADMIN_APPROVAL,
|
||||||
-> R.string.admin_approval_requested.asText()
|
-> R.string.admin_approval_requested.asText()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -402,10 +402,10 @@ data class LoginWithDeviceState(
|
||||||
get() = when (loginWithDeviceType) {
|
get() = when (loginWithDeviceType) {
|
||||||
LoginWithDeviceType.OTHER_DEVICE,
|
LoginWithDeviceType.OTHER_DEVICE,
|
||||||
LoginWithDeviceType.SSO_OTHER_DEVICE,
|
LoginWithDeviceType.SSO_OTHER_DEVICE,
|
||||||
-> R.string.a_notification_has_been_sent_to_your_device.asText()
|
-> R.string.a_notification_has_been_sent_to_your_device.asText()
|
||||||
|
|
||||||
LoginWithDeviceType.SSO_ADMIN_APPROVAL,
|
LoginWithDeviceType.SSO_ADMIN_APPROVAL,
|
||||||
-> R.string.your_request_has_been_sent_to_your_admin.asText()
|
-> R.string.your_request_has_been_sent_to_your_admin.asText()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -416,10 +416,10 @@ data class LoginWithDeviceState(
|
||||||
get() = when (loginWithDeviceType) {
|
get() = when (loginWithDeviceType) {
|
||||||
LoginWithDeviceType.OTHER_DEVICE,
|
LoginWithDeviceType.OTHER_DEVICE,
|
||||||
LoginWithDeviceType.SSO_OTHER_DEVICE,
|
LoginWithDeviceType.SSO_OTHER_DEVICE,
|
||||||
-> R.string.please_make_sure_your_vault_is_unlocked_and_the_fingerprint_phrase_matches_on_the_other_device.asText()
|
-> R.string.please_make_sure_your_vault_is_unlocked_and_the_fingerprint_phrase_matches_on_the_other_device.asText()
|
||||||
|
|
||||||
LoginWithDeviceType.SSO_ADMIN_APPROVAL,
|
LoginWithDeviceType.SSO_ADMIN_APPROVAL,
|
||||||
-> R.string.you_will_be_notified_once_approved.asText()
|
-> R.string.you_will_be_notified_once_approved.asText()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -430,7 +430,7 @@ data class LoginWithDeviceState(
|
||||||
get() = when (loginWithDeviceType) {
|
get() = when (loginWithDeviceType) {
|
||||||
LoginWithDeviceType.OTHER_DEVICE,
|
LoginWithDeviceType.OTHER_DEVICE,
|
||||||
LoginWithDeviceType.SSO_OTHER_DEVICE,
|
LoginWithDeviceType.SSO_OTHER_DEVICE,
|
||||||
-> R.string.log_in_with_device_must_be_set_up_in_the_settings_of_the_bitwarden_app_need_another_option.asText()
|
-> R.string.log_in_with_device_must_be_set_up_in_the_settings_of_the_bitwarden_app_need_another_option.asText()
|
||||||
|
|
||||||
LoginWithDeviceType.SSO_ADMIN_APPROVAL -> R.string.trouble_logging_in.asText()
|
LoginWithDeviceType.SSO_ADMIN_APPROVAL -> R.string.trouble_logging_in.asText()
|
||||||
}
|
}
|
||||||
|
|
|
@ -202,7 +202,7 @@ class TwoFactorLoginViewModel @Inject constructor(
|
||||||
when (state.authMethod) {
|
when (state.authMethod) {
|
||||||
TwoFactorAuthMethod.DUO,
|
TwoFactorAuthMethod.DUO,
|
||||||
TwoFactorAuthMethod.DUO_ORGANIZATION,
|
TwoFactorAuthMethod.DUO_ORGANIZATION,
|
||||||
-> {
|
-> {
|
||||||
val authUrl = authRepository.twoFactorResponse.twoFactorDuoAuthUrl
|
val authUrl = authRepository.twoFactorResponse.twoFactorDuoAuthUrl
|
||||||
// The url should not be empty unless the environment is somehow not supported.
|
// The url should not be empty unless the environment is somehow not supported.
|
||||||
authUrl
|
authUrl
|
||||||
|
@ -256,7 +256,7 @@ class TwoFactorLoginViewModel @Inject constructor(
|
||||||
TwoFactorAuthMethod.U2F,
|
TwoFactorAuthMethod.U2F,
|
||||||
TwoFactorAuthMethod.REMEMBER,
|
TwoFactorAuthMethod.REMEMBER,
|
||||||
TwoFactorAuthMethod.RECOVERY_CODE,
|
TwoFactorAuthMethod.RECOVERY_CODE,
|
||||||
-> initiateLogin()
|
-> initiateLogin()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -486,7 +486,7 @@ class TwoFactorLoginViewModel @Inject constructor(
|
||||||
TwoFactorAuthMethod.REMEMBER,
|
TwoFactorAuthMethod.REMEMBER,
|
||||||
TwoFactorAuthMethod.DUO_ORGANIZATION,
|
TwoFactorAuthMethod.DUO_ORGANIZATION,
|
||||||
TwoFactorAuthMethod.WEB_AUTH,
|
TwoFactorAuthMethod.WEB_AUTH,
|
||||||
-> {
|
-> {
|
||||||
updateAuthMethodRelatedState(action.authMethod)
|
updateAuthMethodRelatedState(action.authMethod)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -517,7 +517,7 @@ class TwoFactorLoginViewModel @Inject constructor(
|
||||||
val code = when (state.authMethod) {
|
val code = when (state.authMethod) {
|
||||||
TwoFactorAuthMethod.AUTHENTICATOR_APP,
|
TwoFactorAuthMethod.AUTHENTICATOR_APP,
|
||||||
TwoFactorAuthMethod.EMAIL,
|
TwoFactorAuthMethod.EMAIL,
|
||||||
-> state.codeInput.replace(" ", "")
|
-> state.codeInput.replace(" ", "")
|
||||||
|
|
||||||
TwoFactorAuthMethod.DUO,
|
TwoFactorAuthMethod.DUO,
|
||||||
TwoFactorAuthMethod.DUO_ORGANIZATION,
|
TwoFactorAuthMethod.DUO_ORGANIZATION,
|
||||||
|
@ -526,7 +526,7 @@ class TwoFactorLoginViewModel @Inject constructor(
|
||||||
TwoFactorAuthMethod.REMEMBER,
|
TwoFactorAuthMethod.REMEMBER,
|
||||||
TwoFactorAuthMethod.WEB_AUTH,
|
TwoFactorAuthMethod.WEB_AUTH,
|
||||||
TwoFactorAuthMethod.RECOVERY_CODE,
|
TwoFactorAuthMethod.RECOVERY_CODE,
|
||||||
-> state.codeInput
|
-> state.codeInput
|
||||||
}
|
}
|
||||||
|
|
||||||
viewModelScope.launch {
|
viewModelScope.launch {
|
||||||
|
|
|
@ -51,7 +51,7 @@ val TwoFactorAuthMethod.button: Text
|
||||||
get() = when (this) {
|
get() = when (this) {
|
||||||
TwoFactorAuthMethod.DUO,
|
TwoFactorAuthMethod.DUO,
|
||||||
TwoFactorAuthMethod.DUO_ORGANIZATION,
|
TwoFactorAuthMethod.DUO_ORGANIZATION,
|
||||||
-> R.string.launch_duo.asText()
|
-> R.string.launch_duo.asText()
|
||||||
|
|
||||||
TwoFactorAuthMethod.AUTHENTICATOR_APP,
|
TwoFactorAuthMethod.AUTHENTICATOR_APP,
|
||||||
TwoFactorAuthMethod.EMAIL,
|
TwoFactorAuthMethod.EMAIL,
|
||||||
|
@ -59,7 +59,7 @@ val TwoFactorAuthMethod.button: Text
|
||||||
TwoFactorAuthMethod.U2F,
|
TwoFactorAuthMethod.U2F,
|
||||||
TwoFactorAuthMethod.REMEMBER,
|
TwoFactorAuthMethod.REMEMBER,
|
||||||
TwoFactorAuthMethod.RECOVERY_CODE,
|
TwoFactorAuthMethod.RECOVERY_CODE,
|
||||||
-> R.string.continue_text.asText()
|
-> R.string.continue_text.asText()
|
||||||
|
|
||||||
TwoFactorAuthMethod.WEB_AUTH -> R.string.launch_web_authn.asText()
|
TwoFactorAuthMethod.WEB_AUTH -> R.string.launch_web_authn.asText()
|
||||||
}
|
}
|
||||||
|
@ -72,7 +72,7 @@ val TwoFactorAuthMethod.isContinueButtonEnabled: Boolean
|
||||||
TwoFactorAuthMethod.DUO,
|
TwoFactorAuthMethod.DUO,
|
||||||
TwoFactorAuthMethod.DUO_ORGANIZATION,
|
TwoFactorAuthMethod.DUO_ORGANIZATION,
|
||||||
TwoFactorAuthMethod.WEB_AUTH,
|
TwoFactorAuthMethod.WEB_AUTH,
|
||||||
-> true
|
-> true
|
||||||
|
|
||||||
TwoFactorAuthMethod.AUTHENTICATOR_APP,
|
TwoFactorAuthMethod.AUTHENTICATOR_APP,
|
||||||
TwoFactorAuthMethod.EMAIL,
|
TwoFactorAuthMethod.EMAIL,
|
||||||
|
@ -80,7 +80,7 @@ val TwoFactorAuthMethod.isContinueButtonEnabled: Boolean
|
||||||
TwoFactorAuthMethod.U2F,
|
TwoFactorAuthMethod.U2F,
|
||||||
TwoFactorAuthMethod.REMEMBER,
|
TwoFactorAuthMethod.REMEMBER,
|
||||||
TwoFactorAuthMethod.RECOVERY_CODE,
|
TwoFactorAuthMethod.RECOVERY_CODE,
|
||||||
-> false
|
-> false
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -91,7 +91,7 @@ val TwoFactorAuthMethod.showPasswordInput: Boolean
|
||||||
TwoFactorAuthMethod.DUO,
|
TwoFactorAuthMethod.DUO,
|
||||||
TwoFactorAuthMethod.DUO_ORGANIZATION,
|
TwoFactorAuthMethod.DUO_ORGANIZATION,
|
||||||
TwoFactorAuthMethod.WEB_AUTH,
|
TwoFactorAuthMethod.WEB_AUTH,
|
||||||
-> false
|
-> false
|
||||||
|
|
||||||
TwoFactorAuthMethod.AUTHENTICATOR_APP,
|
TwoFactorAuthMethod.AUTHENTICATOR_APP,
|
||||||
TwoFactorAuthMethod.EMAIL,
|
TwoFactorAuthMethod.EMAIL,
|
||||||
|
@ -99,7 +99,7 @@ val TwoFactorAuthMethod.showPasswordInput: Boolean
|
||||||
TwoFactorAuthMethod.U2F,
|
TwoFactorAuthMethod.U2F,
|
||||||
TwoFactorAuthMethod.REMEMBER,
|
TwoFactorAuthMethod.REMEMBER,
|
||||||
TwoFactorAuthMethod.RECOVERY_CODE,
|
TwoFactorAuthMethod.RECOVERY_CODE,
|
||||||
-> true
|
-> true
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -118,6 +118,7 @@ fun VaultUnlockScreen(
|
||||||
result = Fido2CredentialAssertionResult.Error,
|
result = Fido2CredentialAssertionResult.Error,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
VaultUnlockEvent.Fido2GetCredentialsError -> {
|
VaultUnlockEvent.Fido2GetCredentialsError -> {
|
||||||
fido2CompletionManager.completeFido2GetCredentialRequest(
|
fido2CompletionManager.completeFido2GetCredentialRequest(
|
||||||
result = Fido2GetCredentialsResult.Error,
|
result = Fido2GetCredentialsResult.Error,
|
||||||
|
|
|
@ -300,7 +300,7 @@ class VaultUnlockViewModel @Inject constructor(
|
||||||
|
|
||||||
VaultUnlockResult.GenericError,
|
VaultUnlockResult.GenericError,
|
||||||
VaultUnlockResult.InvalidStateError,
|
VaultUnlockResult.InvalidStateError,
|
||||||
-> {
|
-> {
|
||||||
mutableStateFlow.update {
|
mutableStateFlow.update {
|
||||||
it.copy(
|
it.copy(
|
||||||
dialog = VaultUnlockState.VaultUnlockDialog.Error(
|
dialog = VaultUnlockState.VaultUnlockDialog.Error(
|
||||||
|
|
|
@ -132,7 +132,7 @@ class Fido2CompletionManagerImpl(
|
||||||
}
|
}
|
||||||
|
|
||||||
Fido2GetCredentialsResult.Error,
|
Fido2GetCredentialsResult.Error,
|
||||||
-> {
|
-> {
|
||||||
PendingIntentHandler.setGetCredentialException(
|
PendingIntentHandler.setGetCredentialException(
|
||||||
resultIntent,
|
resultIntent,
|
||||||
GetCredentialUnknownException(),
|
GetCredentialUnknownException(),
|
||||||
|
|
|
@ -14,7 +14,7 @@ val Configuration.maxDialogHeight: Dp
|
||||||
Configuration.ORIENTATION_UNDEFINED -> Dp.Unspecified
|
Configuration.ORIENTATION_UNDEFINED -> Dp.Unspecified
|
||||||
@Suppress("DEPRECATION")
|
@Suppress("DEPRECATION")
|
||||||
Configuration.ORIENTATION_SQUARE,
|
Configuration.ORIENTATION_SQUARE,
|
||||||
-> Dp.Unspecified
|
-> Dp.Unspecified
|
||||||
|
|
||||||
else -> Dp.Unspecified
|
else -> Dp.Unspecified
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ val Configuration.maxDialogWidth: Dp
|
||||||
Configuration.ORIENTATION_UNDEFINED -> Dp.Unspecified
|
Configuration.ORIENTATION_UNDEFINED -> Dp.Unspecified
|
||||||
@Suppress("DEPRECATION")
|
@Suppress("DEPRECATION")
|
||||||
Configuration.ORIENTATION_SQUARE,
|
Configuration.ORIENTATION_SQUARE,
|
||||||
-> Dp.Unspecified
|
-> Dp.Unspecified
|
||||||
|
|
||||||
else -> Dp.Unspecified
|
else -> Dp.Unspecified
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,13 +20,13 @@ fun <T : Any> FlagKey<T>.ListItemContent(
|
||||||
FlagKey.DummyBoolean,
|
FlagKey.DummyBoolean,
|
||||||
is FlagKey.DummyInt,
|
is FlagKey.DummyInt,
|
||||||
FlagKey.DummyString,
|
FlagKey.DummyString,
|
||||||
-> Unit
|
-> Unit
|
||||||
|
|
||||||
FlagKey.AuthenticatorSync,
|
FlagKey.AuthenticatorSync,
|
||||||
FlagKey.EmailVerification,
|
FlagKey.EmailVerification,
|
||||||
FlagKey.OnboardingCarousel,
|
FlagKey.OnboardingCarousel,
|
||||||
FlagKey.OnboardingFlow,
|
FlagKey.OnboardingFlow,
|
||||||
-> BooleanFlagItem(
|
-> BooleanFlagItem(
|
||||||
label = flagKey.getDisplayLabel(),
|
label = flagKey.getDisplayLabel(),
|
||||||
key = flagKey as FlagKey<Boolean>,
|
key = flagKey as FlagKey<Boolean>,
|
||||||
currentValue = currentValue as Boolean,
|
currentValue = currentValue as Boolean,
|
||||||
|
@ -61,7 +61,7 @@ private fun <T : Any> FlagKey<T>.getDisplayLabel(): String = when (this) {
|
||||||
FlagKey.DummyBoolean,
|
FlagKey.DummyBoolean,
|
||||||
is FlagKey.DummyInt,
|
is FlagKey.DummyInt,
|
||||||
FlagKey.DummyString,
|
FlagKey.DummyString,
|
||||||
-> this.keyName
|
-> this.keyName
|
||||||
|
|
||||||
FlagKey.AuthenticatorSync -> stringResource(R.string.authenticator_sync)
|
FlagKey.AuthenticatorSync -> stringResource(R.string.authenticator_sync)
|
||||||
FlagKey.EmailVerification -> stringResource(R.string.email_verification)
|
FlagKey.EmailVerification -> stringResource(R.string.email_verification)
|
||||||
|
|
|
@ -109,7 +109,7 @@ fun RootNavScreen(
|
||||||
is RootNavState.CompleteOngoingRegistration,
|
is RootNavState.CompleteOngoingRegistration,
|
||||||
RootNavState.AuthWithWelcome,
|
RootNavState.AuthWithWelcome,
|
||||||
RootNavState.ExpiredRegistrationLink,
|
RootNavState.ExpiredRegistrationLink,
|
||||||
-> AUTH_GRAPH_ROUTE
|
-> AUTH_GRAPH_ROUTE
|
||||||
|
|
||||||
RootNavState.ResetPassword -> RESET_PASSWORD_ROUTE
|
RootNavState.ResetPassword -> RESET_PASSWORD_ROUTE
|
||||||
RootNavState.SetPassword -> SET_PASSWORD_ROUTE
|
RootNavState.SetPassword -> SET_PASSWORD_ROUTE
|
||||||
|
@ -126,7 +126,7 @@ fun RootNavScreen(
|
||||||
is RootNavState.VaultUnlockedForFido2Save,
|
is RootNavState.VaultUnlockedForFido2Save,
|
||||||
is RootNavState.VaultUnlockedForFido2Assertion,
|
is RootNavState.VaultUnlockedForFido2Assertion,
|
||||||
is RootNavState.VaultUnlockedForFido2GetCredentials,
|
is RootNavState.VaultUnlockedForFido2GetCredentials,
|
||||||
-> VAULT_UNLOCKED_GRAPH_ROUTE
|
-> VAULT_UNLOCKED_GRAPH_ROUTE
|
||||||
|
|
||||||
RootNavState.OnboardingAccountLockSetup -> SETUP_UNLOCK_AS_ROOT_ROUTE
|
RootNavState.OnboardingAccountLockSetup -> SETUP_UNLOCK_AS_ROOT_ROUTE
|
||||||
RootNavState.OnboardingAutoFillSetup -> SETUP_AUTO_FILL_AS_ROOT_ROUTE
|
RootNavState.OnboardingAutoFillSetup -> SETUP_AUTO_FILL_AS_ROOT_ROUTE
|
||||||
|
@ -235,7 +235,7 @@ fun RootNavScreen(
|
||||||
is RootNavState.VaultUnlockedForFido2Save,
|
is RootNavState.VaultUnlockedForFido2Save,
|
||||||
is RootNavState.VaultUnlockedForFido2Assertion,
|
is RootNavState.VaultUnlockedForFido2Assertion,
|
||||||
is RootNavState.VaultUnlockedForFido2GetCredentials,
|
is RootNavState.VaultUnlockedForFido2GetCredentials,
|
||||||
-> {
|
-> {
|
||||||
navController.navigateToVaultUnlockedGraph(rootNavOptions)
|
navController.navigateToVaultUnlockedGraph(rootNavOptions)
|
||||||
navController.navigateToVaultItemListingAsRoot(
|
navController.navigateToVaultItemListingAsRoot(
|
||||||
vaultItemListingType = VaultItemListingType.Login,
|
vaultItemListingType = VaultItemListingType.Login,
|
||||||
|
|
|
@ -95,7 +95,8 @@ class RootNavViewModel @Inject constructor(
|
||||||
when (userState.activeAccount.onboardingStatus) {
|
when (userState.activeAccount.onboardingStatus) {
|
||||||
OnboardingStatus.NOT_STARTED,
|
OnboardingStatus.NOT_STARTED,
|
||||||
OnboardingStatus.ACCOUNT_LOCK_SETUP,
|
OnboardingStatus.ACCOUNT_LOCK_SETUP,
|
||||||
-> RootNavState.OnboardingAccountLockSetup
|
-> RootNavState.OnboardingAccountLockSetup
|
||||||
|
|
||||||
OnboardingStatus.AUTOFILL_SETUP -> RootNavState.OnboardingAutoFillSetup
|
OnboardingStatus.AUTOFILL_SETUP -> RootNavState.OnboardingAutoFillSetup
|
||||||
OnboardingStatus.FINAL_STEP -> RootNavState.OnboardingStepsComplete
|
OnboardingStatus.FINAL_STEP -> RootNavState.OnboardingStepsComplete
|
||||||
OnboardingStatus.COMPLETE -> throw IllegalStateException("Should not have entered here.")
|
OnboardingStatus.COMPLETE -> throw IllegalStateException("Should not have entered here.")
|
||||||
|
@ -153,7 +154,7 @@ class RootNavViewModel @Inject constructor(
|
||||||
SpecialCircumstance.GeneratorShortcut,
|
SpecialCircumstance.GeneratorShortcut,
|
||||||
SpecialCircumstance.VaultShortcut,
|
SpecialCircumstance.VaultShortcut,
|
||||||
null,
|
null,
|
||||||
-> RootNavState.VaultUnlocked(activeUserId = userState.activeAccount.userId)
|
-> RootNavState.VaultUnlocked(activeUserId = userState.activeAccount.userId)
|
||||||
|
|
||||||
is SpecialCircumstance.RegistrationEvent -> {
|
is SpecialCircumstance.RegistrationEvent -> {
|
||||||
throw IllegalStateException(
|
throw IllegalStateException(
|
||||||
|
|
|
@ -73,7 +73,7 @@ fun SearchContent(
|
||||||
is ListingItemOverflowAction.VaultAction.LaunchClick,
|
is ListingItemOverflowAction.VaultAction.LaunchClick,
|
||||||
is ListingItemOverflowAction.VaultAction.ViewClick,
|
is ListingItemOverflowAction.VaultAction.ViewClick,
|
||||||
null,
|
null,
|
||||||
-> Unit
|
-> Unit
|
||||||
}
|
}
|
||||||
|
|
||||||
var autofillSelectionOptionsItem by rememberSaveable {
|
var autofillSelectionOptionsItem by rememberSaveable {
|
||||||
|
|
|
@ -95,7 +95,7 @@ fun DeleteAccountScreen(
|
||||||
|
|
||||||
DeleteAccountState.DeleteAccountDialog.Loading,
|
DeleteAccountState.DeleteAccountDialog.Loading,
|
||||||
|
|
||||||
-> BitwardenLoadingDialog(
|
-> BitwardenLoadingDialog(
|
||||||
visibilityState = LoadingDialogState.Shown(R.string.loading.asText()),
|
visibilityState = LoadingDialogState.Shown(R.string.loading.asText()),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -183,7 +183,7 @@ class LoginApprovalViewModel @Inject constructor(
|
||||||
AuthRequestUpdatesResult.Approved,
|
AuthRequestUpdatesResult.Approved,
|
||||||
AuthRequestUpdatesResult.Declined,
|
AuthRequestUpdatesResult.Declined,
|
||||||
AuthRequestUpdatesResult.Expired,
|
AuthRequestUpdatesResult.Expired,
|
||||||
-> {
|
-> {
|
||||||
sendClosingEvent()
|
sendClosingEvent()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,7 +86,7 @@ fun VaultUnlockedNavBarScreen(
|
||||||
when (event) {
|
when (event) {
|
||||||
is VaultUnlockedNavBarEvent.Shortcut.NavigateToVaultScreen,
|
is VaultUnlockedNavBarEvent.Shortcut.NavigateToVaultScreen,
|
||||||
is VaultUnlockedNavBarEvent.NavigateToVaultScreen,
|
is VaultUnlockedNavBarEvent.NavigateToVaultScreen,
|
||||||
-> {
|
-> {
|
||||||
navigateToVaultGraph(navOptions)
|
navigateToVaultGraph(navOptions)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ fun VaultUnlockedNavBarScreen(
|
||||||
|
|
||||||
VaultUnlockedNavBarEvent.Shortcut.NavigateToGeneratorScreen,
|
VaultUnlockedNavBarEvent.Shortcut.NavigateToGeneratorScreen,
|
||||||
VaultUnlockedNavBarEvent.NavigateToGeneratorScreen,
|
VaultUnlockedNavBarEvent.NavigateToGeneratorScreen,
|
||||||
-> {
|
-> {
|
||||||
navigateToGeneratorGraph(navOptions)
|
navigateToGeneratorGraph(navOptions)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,7 @@ class BiometricsManagerImpl(
|
||||||
BiometricManager.BIOMETRIC_ERROR_NONE_ENROLLED,
|
BiometricManager.BIOMETRIC_ERROR_NONE_ENROLLED,
|
||||||
BiometricManager.BIOMETRIC_ERROR_NO_HARDWARE,
|
BiometricManager.BIOMETRIC_ERROR_NO_HARDWARE,
|
||||||
BiometricManager.BIOMETRIC_ERROR_SECURITY_UPDATE_REQUIRED,
|
BiometricManager.BIOMETRIC_ERROR_SECURITY_UPDATE_REQUIRED,
|
||||||
-> false
|
-> false
|
||||||
|
|
||||||
else -> false
|
else -> false
|
||||||
}
|
}
|
||||||
|
@ -106,13 +106,13 @@ class BiometricsManagerImpl(
|
||||||
BiometricPrompt.ERROR_NO_BIOMETRICS,
|
BiometricPrompt.ERROR_NO_BIOMETRICS,
|
||||||
BiometricPrompt.ERROR_HW_NOT_PRESENT,
|
BiometricPrompt.ERROR_HW_NOT_PRESENT,
|
||||||
BiometricPrompt.ERROR_NO_DEVICE_CREDENTIAL,
|
BiometricPrompt.ERROR_NO_DEVICE_CREDENTIAL,
|
||||||
-> onError()
|
-> onError()
|
||||||
|
|
||||||
BiometricPrompt.ERROR_NEGATIVE_BUTTON -> onCancel()
|
BiometricPrompt.ERROR_NEGATIVE_BUTTON -> onCancel()
|
||||||
|
|
||||||
BiometricPrompt.ERROR_LOCKOUT,
|
BiometricPrompt.ERROR_LOCKOUT,
|
||||||
BiometricPrompt.ERROR_LOCKOUT_PERMANENT,
|
BiometricPrompt.ERROR_LOCKOUT_PERMANENT,
|
||||||
-> onLockOut()
|
-> onLockOut()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ val VaultTimeout.Type.minutes: Int
|
||||||
|
|
||||||
VaultTimeout.Type.ON_APP_RESTART,
|
VaultTimeout.Type.ON_APP_RESTART,
|
||||||
VaultTimeout.Type.NEVER,
|
VaultTimeout.Type.NEVER,
|
||||||
-> Int.MAX_VALUE
|
-> Int.MAX_VALUE
|
||||||
|
|
||||||
VaultTimeout.Type.CUSTOM -> 0
|
VaultTimeout.Type.CUSTOM -> 0
|
||||||
}
|
}
|
||||||
|
|
|
@ -192,7 +192,7 @@ fun GeneratorScreen(
|
||||||
when (state.generatorMode) {
|
when (state.generatorMode) {
|
||||||
is GeneratorMode.Modal.Username,
|
is GeneratorMode.Modal.Username,
|
||||||
GeneratorMode.Modal.Password,
|
GeneratorMode.Modal.Password,
|
||||||
-> {
|
-> {
|
||||||
ModalAppBar(
|
ModalAppBar(
|
||||||
scrollBehavior = scrollBehavior,
|
scrollBehavior = scrollBehavior,
|
||||||
onCloseClick = remember(viewModel) {
|
onCloseClick = remember(viewModel) {
|
||||||
|
|
|
@ -779,44 +779,44 @@ class GeneratorViewModel @Inject constructor(
|
||||||
) {
|
) {
|
||||||
when (action) {
|
when (action) {
|
||||||
is GeneratorAction.MainType.Passcode.PasscodeType.Password.SliderLengthChange,
|
is GeneratorAction.MainType.Passcode.PasscodeType.Password.SliderLengthChange,
|
||||||
-> {
|
-> {
|
||||||
handlePasswordLengthSliderChange(action)
|
handlePasswordLengthSliderChange(action)
|
||||||
}
|
}
|
||||||
|
|
||||||
is GeneratorAction.MainType.Passcode.PasscodeType.Password.ToggleCapitalLettersChange,
|
is GeneratorAction.MainType.Passcode.PasscodeType.Password.ToggleCapitalLettersChange,
|
||||||
-> {
|
-> {
|
||||||
handleToggleCapitalLetters(action)
|
handleToggleCapitalLetters(action)
|
||||||
}
|
}
|
||||||
|
|
||||||
is GeneratorAction.MainType.Passcode.PasscodeType.Password.ToggleLowercaseLettersChange,
|
is GeneratorAction.MainType.Passcode.PasscodeType.Password.ToggleLowercaseLettersChange,
|
||||||
-> {
|
-> {
|
||||||
handleToggleLowercaseLetters(action)
|
handleToggleLowercaseLetters(action)
|
||||||
}
|
}
|
||||||
|
|
||||||
is GeneratorAction.MainType.Passcode.PasscodeType.Password.ToggleNumbersChange,
|
is GeneratorAction.MainType.Passcode.PasscodeType.Password.ToggleNumbersChange,
|
||||||
-> {
|
-> {
|
||||||
handleToggleNumbers(action)
|
handleToggleNumbers(action)
|
||||||
}
|
}
|
||||||
|
|
||||||
is GeneratorAction.MainType.Passcode.PasscodeType.Password
|
is GeneratorAction.MainType.Passcode.PasscodeType.Password
|
||||||
.ToggleSpecialCharactersChange,
|
.ToggleSpecialCharactersChange,
|
||||||
-> {
|
-> {
|
||||||
handleToggleSpecialChars(action)
|
handleToggleSpecialChars(action)
|
||||||
}
|
}
|
||||||
|
|
||||||
is GeneratorAction.MainType.Passcode.PasscodeType.Password.MinNumbersCounterChange,
|
is GeneratorAction.MainType.Passcode.PasscodeType.Password.MinNumbersCounterChange,
|
||||||
-> {
|
-> {
|
||||||
handleMinNumbersChange(action)
|
handleMinNumbersChange(action)
|
||||||
}
|
}
|
||||||
|
|
||||||
is GeneratorAction.MainType.Passcode.PasscodeType.Password.MinSpecialCharactersChange,
|
is GeneratorAction.MainType.Passcode.PasscodeType.Password.MinSpecialCharactersChange,
|
||||||
-> {
|
-> {
|
||||||
handleMinSpecialChange(action)
|
handleMinSpecialChange(action)
|
||||||
}
|
}
|
||||||
|
|
||||||
is GeneratorAction.MainType.Passcode.PasscodeType.Password
|
is GeneratorAction.MainType.Passcode.PasscodeType.Password
|
||||||
.ToggleAvoidAmbigousCharactersChange,
|
.ToggleAvoidAmbigousCharactersChange,
|
||||||
-> {
|
-> {
|
||||||
handleToggleAmbiguousChars(action)
|
handleToggleAmbiguousChars(action)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -923,22 +923,22 @@ class GeneratorViewModel @Inject constructor(
|
||||||
) {
|
) {
|
||||||
when (action) {
|
when (action) {
|
||||||
is GeneratorAction.MainType.Passcode.PasscodeType.Passphrase.NumWordsCounterChange,
|
is GeneratorAction.MainType.Passcode.PasscodeType.Passphrase.NumWordsCounterChange,
|
||||||
-> {
|
-> {
|
||||||
handleNumWordsCounterChange(action)
|
handleNumWordsCounterChange(action)
|
||||||
}
|
}
|
||||||
|
|
||||||
is GeneratorAction.MainType.Passcode.PasscodeType.Passphrase.ToggleCapitalizeChange,
|
is GeneratorAction.MainType.Passcode.PasscodeType.Passphrase.ToggleCapitalizeChange,
|
||||||
-> {
|
-> {
|
||||||
handlePassphraseToggleCapitalizeChange(action)
|
handlePassphraseToggleCapitalizeChange(action)
|
||||||
}
|
}
|
||||||
|
|
||||||
is GeneratorAction.MainType.Passcode.PasscodeType.Passphrase.ToggleIncludeNumberChange,
|
is GeneratorAction.MainType.Passcode.PasscodeType.Passphrase.ToggleIncludeNumberChange,
|
||||||
-> {
|
-> {
|
||||||
handlePassphraseToggleIncludeNumberChange(action)
|
handlePassphraseToggleIncludeNumberChange(action)
|
||||||
}
|
}
|
||||||
|
|
||||||
is GeneratorAction.MainType.Passcode.PasscodeType.Passphrase.WordSeparatorTextChange,
|
is GeneratorAction.MainType.Passcode.PasscodeType.Passphrase.WordSeparatorTextChange,
|
||||||
-> {
|
-> {
|
||||||
handleWordSeparatorTextInputChange(action)
|
handleWordSeparatorTextInputChange(action)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1096,7 +1096,7 @@ class GeneratorViewModel @Inject constructor(
|
||||||
.ForwardedEmailAlias
|
.ForwardedEmailAlias
|
||||||
.AddyIo
|
.AddyIo
|
||||||
.AccessTokenTextChange,
|
.AccessTokenTextChange,
|
||||||
-> {
|
-> {
|
||||||
handleAddyIoAccessTokenTextChange(action)
|
handleAddyIoAccessTokenTextChange(action)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1107,7 +1107,7 @@ class GeneratorViewModel @Inject constructor(
|
||||||
.ForwardedEmailAlias
|
.ForwardedEmailAlias
|
||||||
.AddyIo
|
.AddyIo
|
||||||
.DomainTextChange,
|
.DomainTextChange,
|
||||||
-> {
|
-> {
|
||||||
handleAddyIoDomainNameTextChange(action)
|
handleAddyIoDomainNameTextChange(action)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1220,7 +1220,7 @@ class GeneratorViewModel @Inject constructor(
|
||||||
.ForwardedEmailAlias
|
.ForwardedEmailAlias
|
||||||
.ForwardEmail
|
.ForwardEmail
|
||||||
.ApiKeyTextChange,
|
.ApiKeyTextChange,
|
||||||
-> {
|
-> {
|
||||||
handleForwardEmailApiKeyTextChange(action)
|
handleForwardEmailApiKeyTextChange(action)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1231,7 +1231,7 @@ class GeneratorViewModel @Inject constructor(
|
||||||
.ForwardedEmailAlias
|
.ForwardedEmailAlias
|
||||||
.ForwardEmail
|
.ForwardEmail
|
||||||
.DomainNameTextChange,
|
.DomainNameTextChange,
|
||||||
-> {
|
-> {
|
||||||
handleForwardEmailDomainNameTextChange(action)
|
handleForwardEmailDomainNameTextChange(action)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1330,7 +1330,7 @@ class GeneratorViewModel @Inject constructor(
|
||||||
.UsernameType
|
.UsernameType
|
||||||
.RandomWord
|
.RandomWord
|
||||||
.ToggleIncludeNumberChange,
|
.ToggleIncludeNumberChange,
|
||||||
-> {
|
-> {
|
||||||
handleRandomWordToggleIncludeNumberChange(action)
|
handleRandomWordToggleIncludeNumberChange(action)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,7 +118,7 @@ private fun VaultAddEditType.toVaultItemCipherTypeOrNull(): String? =
|
||||||
is VaultAddEditType.AddItem -> vaultItemCipherType.toTypeString()
|
is VaultAddEditType.AddItem -> vaultItemCipherType.toTypeString()
|
||||||
is VaultAddEditType.CloneItem,
|
is VaultAddEditType.CloneItem,
|
||||||
is VaultAddEditType.EditItem,
|
is VaultAddEditType.EditItem,
|
||||||
-> null
|
-> null
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun VaultItemCipherType.toTypeString(): String =
|
private fun VaultItemCipherType.toTypeString(): String =
|
||||||
|
|
|
@ -195,7 +195,7 @@ fun VaultData.toViewState(
|
||||||
val shouldShowAddButton = when (itemListingType) {
|
val shouldShowAddButton = when (itemListingType) {
|
||||||
is VaultItemListingState.ItemListingType.Vault.Folder,
|
is VaultItemListingState.ItemListingType.Vault.Folder,
|
||||||
VaultItemListingState.ItemListingType.Vault.Trash,
|
VaultItemListingState.ItemListingType.Vault.Trash,
|
||||||
-> false
|
-> false
|
||||||
|
|
||||||
else -> true
|
else -> true
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,5 +40,9 @@ fun VaultItemListingState.ItemListingType.Vault.toVaultItemCipherType(): VaultIt
|
||||||
is VaultItemListingState.ItemListingType.Vault.Collection -> VaultItemCipherType.LOGIN
|
is VaultItemListingState.ItemListingType.Vault.Collection -> VaultItemCipherType.LOGIN
|
||||||
is VaultItemListingState.ItemListingType.Vault.Trash,
|
is VaultItemListingState.ItemListingType.Vault.Trash,
|
||||||
is VaultItemListingState.ItemListingType.Vault.Folder,
|
is VaultItemListingState.ItemListingType.Vault.Folder,
|
||||||
-> throw IllegalStateException("Cannot create vault item from this VaultItemListingState!")
|
-> {
|
||||||
|
throw IllegalStateException(
|
||||||
|
"Cannot create vault item from this VaultItemListingState!",
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,7 @@ val AccountSummary.iconTestTag: String
|
||||||
AccountSummary.Status.LOCKED,
|
AccountSummary.Status.LOCKED,
|
||||||
AccountSummary.Status.LOGGED_OUT,
|
AccountSummary.Status.LOGGED_OUT,
|
||||||
AccountSummary.Status.UNLOCKED,
|
AccountSummary.Status.UNLOCKED,
|
||||||
-> "InactiveVaultIcon"
|
-> "InactiveVaultIcon"
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -295,7 +295,7 @@ fun List<FolderView>.toFilteredList(
|
||||||
when (vaultFilterType) {
|
when (vaultFilterType) {
|
||||||
VaultFilterType.AllVaults,
|
VaultFilterType.AllVaults,
|
||||||
VaultFilterType.MyVault,
|
VaultFilterType.MyVault,
|
||||||
-> true
|
-> true
|
||||||
|
|
||||||
// Only include folders containing an item associated with this organization.
|
// Only include folders containing an item associated with this organization.
|
||||||
is VaultFilterType.OrganizationVault -> {
|
is VaultFilterType.OrganizationVault -> {
|
||||||
|
|
|
@ -13,7 +13,7 @@ fun VaultState.ViewState.vaultFilterDataIfRequired(
|
||||||
when (this) {
|
when (this) {
|
||||||
is VaultState.ViewState.Content,
|
is VaultState.ViewState.Content,
|
||||||
is VaultState.ViewState.NoItems,
|
is VaultState.ViewState.NoItems,
|
||||||
-> vaultFilterData?.let {
|
-> vaultFilterData?.let {
|
||||||
if (it.vaultFilterTypes.contains(VaultFilterType.MyVault) ||
|
if (it.vaultFilterTypes.contains(VaultFilterType.MyVault) ||
|
||||||
it.vaultFilterTypes.size > 2
|
it.vaultFilterTypes.size > 2
|
||||||
) {
|
) {
|
||||||
|
@ -25,5 +25,5 @@ fun VaultState.ViewState.vaultFilterDataIfRequired(
|
||||||
|
|
||||||
is VaultState.ViewState.Error,
|
is VaultState.ViewState.Error,
|
||||||
is VaultState.ViewState.Loading,
|
is VaultState.ViewState.Loading,
|
||||||
-> null
|
-> null
|
||||||
}
|
}
|
||||||
|
|
|
@ -408,27 +408,24 @@ class IdentityServiceTest : BaseServiceTest() {
|
||||||
|
|
||||||
@Suppress("MaxLineLength")
|
@Suppress("MaxLineLength")
|
||||||
@Test
|
@Test
|
||||||
fun `verifyEmailToken should return Invalid when response message is non expired error`() = runTest {
|
fun `verifyEmailToken should return Invalid when response message is non expired error`() =
|
||||||
val messageWithOutExpired = "message without expir... whoops"
|
runTest {
|
||||||
val json = """
|
val messageWithOutExpired = "message without expir... whoops"
|
||||||
{
|
val json = """{ "message": "$messageWithOutExpired" }""".trimIndent()
|
||||||
"message": "$messageWithOutExpired"
|
val response = MockResponse().setResponseCode(400).setBody(json)
|
||||||
}
|
server.enqueue(response)
|
||||||
""".trimIndent()
|
val result = identityService.verifyEmailRegistrationToken(
|
||||||
val response = MockResponse().setResponseCode(400).setBody(json)
|
body = VerifyEmailTokenRequestJson(
|
||||||
server.enqueue(response)
|
token = EMAIL_TOKEN,
|
||||||
val result = identityService.verifyEmailRegistrationToken(
|
email = EMAIL,
|
||||||
body = VerifyEmailTokenRequestJson(
|
),
|
||||||
token = EMAIL_TOKEN,
|
)
|
||||||
email = EMAIL,
|
assertTrue(result.isSuccess)
|
||||||
),
|
assertEquals(
|
||||||
)
|
VerifyEmailTokenResponseJson.Invalid(messageWithOutExpired),
|
||||||
assertTrue(result.isSuccess)
|
result.getOrThrow(),
|
||||||
assertEquals(
|
)
|
||||||
VerifyEmailTokenResponseJson.Invalid(messageWithOutExpired),
|
}
|
||||||
result.getOrThrow(),
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `verifyEmailToken should return an error when response is an un-handled error`() = runTest {
|
fun `verifyEmailToken should return an error when response is an un-handled error`() = runTest {
|
||||||
|
|
|
@ -352,6 +352,7 @@ class FakeSettingsDiskSource : SettingsDiskSource {
|
||||||
mutablePullToRefreshEnabledFlowMap.getOrPut(userId) {
|
mutablePullToRefreshEnabledFlowMap.getOrPut(userId) {
|
||||||
bufferedMutableSharedFlow(replay = 1)
|
bufferedMutableSharedFlow(replay = 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getMutableShowAutoFillSettingBadgeFlow(
|
private fun getMutableShowAutoFillSettingBadgeFlow(
|
||||||
userId: String,
|
userId: String,
|
||||||
): MutableSharedFlow<Boolean?> = mutableShowAutoFillSettingBadgeFlowMap.getOrPut(userId) {
|
): MutableSharedFlow<Boolean?> = mutableShowAutoFillSettingBadgeFlowMap.getOrPut(userId) {
|
||||||
|
|
|
@ -1119,7 +1119,9 @@ class SettingsRepositoryTest {
|
||||||
|
|
||||||
assertFalse(settingsRepository.isAuthenticatorSyncEnabled)
|
assertFalse(settingsRepository.isAuthenticatorSyncEnabled)
|
||||||
assertNull(fakeAuthDiskSource.getAuthenticatorSyncUnlockKey(USER_ID))
|
assertNull(fakeAuthDiskSource.getAuthenticatorSyncUnlockKey(USER_ID))
|
||||||
assertTrue(fakeAuthDiskSource.authenticatorSyncSymmetricKey.contentEquals(syncSymmetricKey))
|
assertTrue(
|
||||||
|
fakeAuthDiskSource.authenticatorSyncSymmetricKey.contentEquals(syncSymmetricKey),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -181,7 +181,7 @@ class VaultLockManagerTest {
|
||||||
VaultTimeout.OneHour,
|
VaultTimeout.OneHour,
|
||||||
VaultTimeout.FourHours,
|
VaultTimeout.FourHours,
|
||||||
is VaultTimeout.Custom,
|
is VaultTimeout.Custom,
|
||||||
-> {
|
-> {
|
||||||
assertTrue(vaultLockManager.isVaultUnlocked(USER_ID))
|
assertTrue(vaultLockManager.isVaultUnlocked(USER_ID))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -189,7 +189,7 @@ class VaultLockManagerTest {
|
||||||
VaultTimeout.Immediately,
|
VaultTimeout.Immediately,
|
||||||
VaultTimeout.OneMinute,
|
VaultTimeout.OneMinute,
|
||||||
VaultTimeout.FiveMinutes,
|
VaultTimeout.FiveMinutes,
|
||||||
-> {
|
-> {
|
||||||
assertFalse(vaultLockManager.isVaultUnlocked(USER_ID))
|
assertFalse(vaultLockManager.isVaultUnlocked(USER_ID))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -214,7 +214,7 @@ class VaultLockManagerTest {
|
||||||
VaultTimeout.OneHour,
|
VaultTimeout.OneHour,
|
||||||
VaultTimeout.FourHours,
|
VaultTimeout.FourHours,
|
||||||
is VaultTimeout.Custom,
|
is VaultTimeout.Custom,
|
||||||
-> {
|
-> {
|
||||||
verify(exactly = 0) { userLogoutManager.softLogout(any()) }
|
verify(exactly = 0) { userLogoutManager.softLogout(any()) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -222,7 +222,7 @@ class VaultLockManagerTest {
|
||||||
VaultTimeout.Immediately,
|
VaultTimeout.Immediately,
|
||||||
VaultTimeout.OneMinute,
|
VaultTimeout.OneMinute,
|
||||||
VaultTimeout.FiveMinutes,
|
VaultTimeout.FiveMinutes,
|
||||||
-> {
|
-> {
|
||||||
verify(exactly = 1) { userLogoutManager.softLogout(USER_ID) }
|
verify(exactly = 1) { userLogoutManager.softLogout(USER_ID) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -418,7 +418,7 @@ class VaultLockManagerTest {
|
||||||
VaultTimeout.OneHour,
|
VaultTimeout.OneHour,
|
||||||
VaultTimeout.FourHours,
|
VaultTimeout.FourHours,
|
||||||
is VaultTimeout.Custom,
|
is VaultTimeout.Custom,
|
||||||
-> {
|
-> {
|
||||||
assertTrue(vaultLockManager.isVaultUnlocked(activeUserId))
|
assertTrue(vaultLockManager.isVaultUnlocked(activeUserId))
|
||||||
assertTrue(vaultLockManager.isVaultUnlocked(inactiveUserId))
|
assertTrue(vaultLockManager.isVaultUnlocked(inactiveUserId))
|
||||||
}
|
}
|
||||||
|
@ -427,7 +427,7 @@ class VaultLockManagerTest {
|
||||||
VaultTimeout.Immediately,
|
VaultTimeout.Immediately,
|
||||||
VaultTimeout.OneMinute,
|
VaultTimeout.OneMinute,
|
||||||
VaultTimeout.FiveMinutes,
|
VaultTimeout.FiveMinutes,
|
||||||
-> {
|
-> {
|
||||||
assertTrue(vaultLockManager.isVaultUnlocked(activeUserId))
|
assertTrue(vaultLockManager.isVaultUnlocked(activeUserId))
|
||||||
assertFalse(vaultLockManager.isVaultUnlocked(inactiveUserId))
|
assertFalse(vaultLockManager.isVaultUnlocked(inactiveUserId))
|
||||||
}
|
}
|
||||||
|
@ -459,7 +459,7 @@ class VaultLockManagerTest {
|
||||||
VaultTimeout.OneHour,
|
VaultTimeout.OneHour,
|
||||||
VaultTimeout.FourHours,
|
VaultTimeout.FourHours,
|
||||||
is VaultTimeout.Custom,
|
is VaultTimeout.Custom,
|
||||||
-> {
|
-> {
|
||||||
verify(exactly = 0) { userLogoutManager.softLogout(any()) }
|
verify(exactly = 0) { userLogoutManager.softLogout(any()) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -467,7 +467,7 @@ class VaultLockManagerTest {
|
||||||
VaultTimeout.Immediately,
|
VaultTimeout.Immediately,
|
||||||
VaultTimeout.OneMinute,
|
VaultTimeout.OneMinute,
|
||||||
VaultTimeout.FiveMinutes,
|
VaultTimeout.FiveMinutes,
|
||||||
-> {
|
-> {
|
||||||
verify(exactly = 0) { userLogoutManager.softLogout(activeUserId) }
|
verify(exactly = 0) { userLogoutManager.softLogout(activeUserId) }
|
||||||
verify(exactly = 1) { userLogoutManager.softLogout(inactiveUserId) }
|
verify(exactly = 1) { userLogoutManager.softLogout(inactiveUserId) }
|
||||||
}
|
}
|
||||||
|
|
|
@ -350,10 +350,10 @@ class CompleteRegistrationScreenTest : BaseComposeTest() {
|
||||||
.performScrollTo()
|
.performScrollTo()
|
||||||
.performClick()
|
.performClick()
|
||||||
|
|
||||||
verify {
|
verify {
|
||||||
viewModel.trySendAction(CompleteRegistrationAction.LearnToPreventLockoutClick)
|
viewModel.trySendAction(CompleteRegistrationAction.LearnToPreventLockoutClick)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `Header should be displayed in portrait mode`() = testWithFeatureFlagOn {
|
fun `Header should be displayed in portrait mode`() = testWithFeatureFlagOn {
|
||||||
|
|
|
@ -731,8 +731,8 @@ class AccountSecurityViewModelTest : BaseViewModelTest() {
|
||||||
@Test
|
@Test
|
||||||
fun `when UnlockActionCardCtaClick action received, should dismiss unlock action card and send NavigateToSetupUnlockScreen event`() =
|
fun `when UnlockActionCardCtaClick action received, should dismiss unlock action card and send NavigateToSetupUnlockScreen event`() =
|
||||||
runTest {
|
runTest {
|
||||||
mutableShowUnlockBadgeFlow.update { true }
|
mutableShowUnlockBadgeFlow.update { true }
|
||||||
val viewModel = createViewModel()
|
val viewModel = createViewModel()
|
||||||
viewModel.eventFlow.test {
|
viewModel.eventFlow.test {
|
||||||
viewModel.trySendAction(AccountSecurityAction.UnlockActionCardCtaClick)
|
viewModel.trySendAction(AccountSecurityAction.UnlockActionCardCtaClick)
|
||||||
assertEquals(
|
assertEquals(
|
||||||
|
@ -740,10 +740,10 @@ class AccountSecurityViewModelTest : BaseViewModelTest() {
|
||||||
awaitItem(),
|
awaitItem(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
verify {
|
verify {
|
||||||
settingsRepository.storeShowUnlockSettingBadge(DEFAULT_STATE.userId, false)
|
settingsRepository.storeShowUnlockSettingBadge(DEFAULT_STATE.userId, false)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Suppress("LongParameterList")
|
@Suppress("LongParameterList")
|
||||||
private fun createViewModel(
|
private fun createViewModel(
|
||||||
|
|
|
@ -323,8 +323,8 @@ class AutoFillViewModelTest : BaseViewModelTest() {
|
||||||
@Test
|
@Test
|
||||||
fun `when AutoFillActionCardCtaClick action is sent should update show autofill in repository and send NavigateToSetupAutofill event`() =
|
fun `when AutoFillActionCardCtaClick action is sent should update show autofill in repository and send NavigateToSetupAutofill event`() =
|
||||||
runTest {
|
runTest {
|
||||||
mutableShowAutofillActionCardFlow.update { true }
|
mutableShowAutofillActionCardFlow.update { true }
|
||||||
val viewModel = createViewModel()
|
val viewModel = createViewModel()
|
||||||
viewModel.eventFlow.test {
|
viewModel.eventFlow.test {
|
||||||
viewModel.trySendAction(AutoFillAction.AutoFillActionCardCtaClick)
|
viewModel.trySendAction(AutoFillAction.AutoFillActionCardCtaClick)
|
||||||
assertEquals(
|
assertEquals(
|
||||||
|
@ -332,13 +332,10 @@ class AutoFillViewModelTest : BaseViewModelTest() {
|
||||||
awaitItem(),
|
awaitItem(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
verify {
|
verify {
|
||||||
settingsRepository.storeShowAutoFillSettingBadge(
|
settingsRepository.storeShowAutoFillSettingBadge(DEFAULT_STATE.activeUserId, false)
|
||||||
DEFAULT_STATE.activeUserId,
|
}
|
||||||
false,
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Suppress("MaxLineLength")
|
@Suppress("MaxLineLength")
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -44,7 +44,10 @@ class VaultUnlockedNavBarViewModelTest : BaseViewModelTest() {
|
||||||
val viewModel = createViewModel()
|
val viewModel = createViewModel()
|
||||||
|
|
||||||
viewModel.eventFlow.test {
|
viewModel.eventFlow.test {
|
||||||
assertEquals(VaultUnlockedNavBarEvent.Shortcut.NavigateToGeneratorScreen, awaitItem())
|
assertEquals(
|
||||||
|
VaultUnlockedNavBarEvent.Shortcut.NavigateToGeneratorScreen,
|
||||||
|
awaitItem(),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
verify(exactly = 1) {
|
verify(exactly = 1) {
|
||||||
specialCircumstancesManager.specialCircumstance
|
specialCircumstancesManager.specialCircumstance
|
||||||
|
|
Loading…
Add table
Reference in a new issue