diff --git a/app/src/main/java/com/x8bit/bitwarden/data/auth/manager/util/AuthRequestTypeExtensions.kt b/app/src/main/java/com/x8bit/bitwarden/data/auth/manager/util/AuthRequestTypeExtensions.kt index 5316da98d..dbeed3d2b 100644 --- a/app/src/main/java/com/x8bit/bitwarden/data/auth/manager/util/AuthRequestTypeExtensions.kt +++ b/app/src/main/java/com/x8bit/bitwarden/data/auth/manager/util/AuthRequestTypeExtensions.kt @@ -11,7 +11,7 @@ val AuthRequestType.isSso: Boolean AuthRequestType.OTHER_DEVICE -> false AuthRequestType.SSO_OTHER_DEVICE, AuthRequestType.SSO_ADMIN_APPROVAL, - -> true + -> true } /** @@ -21,7 +21,7 @@ fun AuthRequestType.toAuthRequestTypeJson(): AuthRequestTypeJson = when (this) { AuthRequestType.OTHER_DEVICE, AuthRequestType.SSO_OTHER_DEVICE, - -> AuthRequestTypeJson.LOGIN_WITH_DEVICE + -> AuthRequestTypeJson.LOGIN_WITH_DEVICE AuthRequestType.SSO_ADMIN_APPROVAL -> AuthRequestTypeJson.ADMIN_APPROVAL } diff --git a/app/src/main/java/com/x8bit/bitwarden/data/auth/repository/AuthRepositoryImpl.kt b/app/src/main/java/com/x8bit/bitwarden/data/auth/repository/AuthRepositoryImpl.kt index dd8cc582d..0641bb4b1 100644 --- a/app/src/main/java/com/x8bit/bitwarden/data/auth/repository/AuthRepositoryImpl.kt +++ b/app/src/main/java/com/x8bit/bitwarden/data/auth/repository/AuthRepositoryImpl.kt @@ -998,7 +998,7 @@ class AuthRepositoryImpl( ForcePasswordResetReason.ADMIN_FORCE_PASSWORD_RESET, ForcePasswordResetReason.WEAK_MASTER_PASSWORD_ON_LOGIN, null, - -> { + -> { authSdkSource .makeRegisterKeys( email = activeAccount.profile.email, @@ -1048,7 +1048,7 @@ class AuthRepositoryImpl( is VaultUnlockResult.AuthenticationError, VaultUnlockResult.InvalidStateError, VaultUnlockResult.GenericError, - -> { + -> { IllegalStateException("Failed to unlock vault").asFailure() } } diff --git a/app/src/main/java/com/x8bit/bitwarden/data/auth/repository/model/LoginResultExtensions.kt b/app/src/main/java/com/x8bit/bitwarden/data/auth/repository/model/LoginResultExtensions.kt index ec2baf01b..d4151119f 100644 --- a/app/src/main/java/com/x8bit/bitwarden/data/auth/repository/model/LoginResultExtensions.kt +++ b/app/src/main/java/com/x8bit/bitwarden/data/auth/repository/model/LoginResultExtensions.kt @@ -11,5 +11,5 @@ fun VaultUnlockError.toLoginErrorResult(): LoginResult.Error = when (this) { is VaultUnlockResult.AuthenticationError -> LoginResult.Error(this.message) VaultUnlockResult.GenericError, VaultUnlockResult.InvalidStateError, - -> LoginResult.Error(errorMessage = null) + -> LoginResult.Error(errorMessage = null) } diff --git a/app/src/main/java/com/x8bit/bitwarden/data/auth/repository/model/PolicyInformation.kt b/app/src/main/java/com/x8bit/bitwarden/data/auth/repository/model/PolicyInformation.kt index 91cc49ee1..32f4fb1b8 100644 --- a/app/src/main/java/com/x8bit/bitwarden/data/auth/repository/model/PolicyInformation.kt +++ b/app/src/main/java/com/x8bit/bitwarden/data/auth/repository/model/PolicyInformation.kt @@ -1,6 +1,5 @@ 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.Serializable diff --git a/app/src/main/java/com/x8bit/bitwarden/data/auth/repository/util/AuthDiskSourceExtensions.kt b/app/src/main/java/com/x8bit/bitwarden/data/auth/repository/util/AuthDiskSourceExtensions.kt index c3adedb3f..a9acced50 100644 --- a/app/src/main/java/com/x8bit/bitwarden/data/auth/repository/util/AuthDiskSourceExtensions.kt +++ b/app/src/main/java/com/x8bit/bitwarden/data/auth/repository/util/AuthDiskSourceExtensions.kt @@ -176,12 +176,12 @@ val AuthDiskSource.activeUserIdChangesFlow: Flow @OptIn(ExperimentalCoroutinesApi::class) val AuthDiskSource.onboardingStatusChangesFlow: Flow get() = activeUserIdChangesFlow - .flatMapLatest { activeUserId -> - activeUserId - ?.let { this.getOnboardingStatusFlow(userId = it) } - ?: flowOf(null) - } - .distinctUntilChanged() + .flatMapLatest { activeUserId -> + activeUserId + ?.let { this.getOnboardingStatusFlow(userId = it) } + ?: flowOf(null) + } + .distinctUntilChanged() val AuthDiskSource.currentOnboardingStatus: OnboardingStatus? get() = this diff --git a/app/src/main/java/com/x8bit/bitwarden/data/platform/manager/BiometricsEncryptionManagerImpl.kt b/app/src/main/java/com/x8bit/bitwarden/data/platform/manager/BiometricsEncryptionManagerImpl.kt index 534d3e0ab..83387786f 100644 --- a/app/src/main/java/com/x8bit/bitwarden/data/platform/manager/BiometricsEncryptionManagerImpl.kt +++ b/app/src/main/java/com/x8bit/bitwarden/data/platform/manager/BiometricsEncryptionManagerImpl.kt @@ -55,9 +55,9 @@ class BiometricsEncryptionManagerImpl( } val cipher = try { Cipher.getInstance(CIPHER_TRANSFORMATION) - } catch (e: NoSuchAlgorithmException) { + } catch (_: NoSuchAlgorithmException) { return null - } catch (e: NoSuchPaddingException) { + } catch (_: NoSuchPaddingException) { return null } // This should never fail to initialize / return false because the cipher is newly generated @@ -116,20 +116,20 @@ class BiometricsEncryptionManagerImpl( KeyProperties.KEY_ALGORITHM_AES, ENCRYPTION_KEYSTORE_NAME, ) - } catch (e: NoSuchAlgorithmException) { + } catch (_: NoSuchAlgorithmException) { return null - } catch (e: NoSuchProviderException) { + } catch (_: NoSuchProviderException) { return null - } catch (e: IllegalArgumentException) { + } catch (_: IllegalArgumentException) { return null } try { keyGen.init(keyGenParameterSpec) keyGen.generateKey() - } catch (e: InvalidAlgorithmParameterException) { + } catch (_: InvalidAlgorithmParameterException) { return null - } catch (e: ProviderException) { + } catch (_: ProviderException) { return null } @@ -142,29 +142,29 @@ class BiometricsEncryptionManagerImpl( private fun getSecretKeyOrNull(): SecretKey? { try { keystore.load(null) - } catch (e: IllegalArgumentException) { + } catch (_: IllegalArgumentException) { // keystore could not be loaded because [param] is unrecognized. return null - } catch (e: IOException) { + } catch (_: IOException) { // keystore data format is invalid or the password is incorrect. return null - } catch (e: NoSuchAlgorithmException) { + } catch (_: NoSuchAlgorithmException) { // keystore integrity could not be checked due to missing algorithm. return null - } catch (e: CertificateException) { + } catch (_: CertificateException) { // keystore certificates could not be loaded return null } return try { keystore.getKey(ENCRYPTION_KEY_NAME, null) as? SecretKey - } catch (e: KeyStoreException) { + } catch (_: KeyStoreException) { // keystore was not loaded null - } catch (e: NoSuchAlgorithmException) { + } catch (_: NoSuchAlgorithmException) { // keystore algorithm cannot be found null - } catch (e: UnrecoverableKeyException) { + } catch (_: UnrecoverableKeyException) { // key could not be recovered null } @@ -181,15 +181,15 @@ class BiometricsEncryptionManagerImpl( try { cipher.init(Cipher.ENCRYPT_MODE, secretKey) true - } catch (e: KeyPermanentlyInvalidatedException) { + } catch (_: KeyPermanentlyInvalidatedException) { // Biometric has changed settingsDiskSource.systemBiometricIntegritySource = null false - } catch (e: UnrecoverableKeyException) { + } catch (_: UnrecoverableKeyException) { // Biometric was disabled and re-enabled settingsDiskSource.systemBiometricIntegritySource = null false - } catch (e: InvalidKeyException) { + } catch (_: InvalidKeyException) { // Fallback for old Bitwarden users without a key createIntegrityValues(userId) true diff --git a/app/src/main/java/com/x8bit/bitwarden/data/platform/manager/PushManagerImpl.kt b/app/src/main/java/com/x8bit/bitwarden/data/platform/manager/PushManagerImpl.kt index 400e2919d..b17da2a6f 100644 --- a/app/src/main/java/com/x8bit/bitwarden/data/platform/manager/PushManagerImpl.kt +++ b/app/src/main/java/com/x8bit/bitwarden/data/platform/manager/PushManagerImpl.kt @@ -129,7 +129,7 @@ class PushManagerImpl @Inject constructor( when (val type = notification.notificationType) { NotificationType.AUTH_REQUEST, NotificationType.AUTH_REQUEST_RESPONSE, - -> { + -> { json .decodeFromString( string = notification.payload, @@ -156,7 +156,7 @@ class PushManagerImpl @Inject constructor( NotificationType.SYNC_CIPHER_CREATE, NotificationType.SYNC_CIPHER_UPDATE, - -> { + -> { json .decodeFromString( string = notification.payload, @@ -183,7 +183,7 @@ class PushManagerImpl @Inject constructor( NotificationType.SYNC_CIPHER_DELETE, NotificationType.SYNC_LOGIN_DELETE, - -> { + -> { json .decodeFromString( string = notification.payload, @@ -196,13 +196,13 @@ class PushManagerImpl @Inject constructor( NotificationType.SYNC_CIPHERS, NotificationType.SYNC_SETTINGS, NotificationType.SYNC_VAULT, - -> { + -> { mutableFullSyncSharedFlow.tryEmit(Unit) } NotificationType.SYNC_FOLDER_CREATE, NotificationType.SYNC_FOLDER_UPDATE, - -> { + -> { json .decodeFromString( string = notification.payload, @@ -238,7 +238,7 @@ class PushManagerImpl @Inject constructor( NotificationType.SYNC_SEND_CREATE, NotificationType.SYNC_SEND_UPDATE, - -> { + -> { json .decodeFromString( string = notification.payload, diff --git a/app/src/main/java/com/x8bit/bitwarden/data/platform/manager/SpecialCircumstanceManagerImpl.kt b/app/src/main/java/com/x8bit/bitwarden/data/platform/manager/SpecialCircumstanceManagerImpl.kt index 486eb5dbd..f6eab91b9 100644 --- a/app/src/main/java/com/x8bit/bitwarden/data/platform/manager/SpecialCircumstanceManagerImpl.kt +++ b/app/src/main/java/com/x8bit/bitwarden/data/platform/manager/SpecialCircumstanceManagerImpl.kt @@ -19,6 +19,7 @@ class SpecialCircumstanceManagerImpl( ) : SpecialCircumstanceManager { private val mutableSpecialCircumstanceFlow = MutableStateFlow(null) private val unconfinedScope = CoroutineScope(dispatcherManager.unconfined) + init { authRepository .userStateFlow diff --git a/app/src/main/java/com/x8bit/bitwarden/data/platform/manager/di/PlatformManagerModule.kt b/app/src/main/java/com/x8bit/bitwarden/data/platform/manager/di/PlatformManagerModule.kt index 2cf703678..3c3873ff8 100644 --- a/app/src/main/java/com/x8bit/bitwarden/data/platform/manager/di/PlatformManagerModule.kt +++ b/app/src/main/java/com/x8bit/bitwarden/data/platform/manager/di/PlatformManagerModule.kt @@ -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.BiometricsEncryptionManager 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.CrashLogsManagerImpl 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.restriction.RestrictionManager 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.DebugMenuRepository import com.x8bit.bitwarden.data.platform.repository.EnvironmentRepository diff --git a/app/src/main/java/com/x8bit/bitwarden/data/platform/repository/AuthenticatorBridgeRepositoryImpl.kt b/app/src/main/java/com/x8bit/bitwarden/data/platform/repository/AuthenticatorBridgeRepositoryImpl.kt index d906fe57f..11bdcd29d 100644 --- a/app/src/main/java/com/x8bit/bitwarden/data/platform/repository/AuthenticatorBridgeRepositoryImpl.kt +++ b/app/src/main/java/com/x8bit/bitwarden/data/platform/repository/AuthenticatorBridgeRepositoryImpl.kt @@ -75,7 +75,7 @@ class AuthenticatorBridgeRepositoryImpl( is VaultUnlockResult.AuthenticationError, VaultUnlockResult.GenericError, VaultUnlockResult.InvalidStateError, - -> { + -> { // Not being able to unlock the user's vault with the // decrypted unlock key is an unexpected case, but if it does // happen we omit the account from list of shared accounts diff --git a/app/src/main/java/com/x8bit/bitwarden/data/platform/repository/util/EnvironmentUrlDataJsonExtensions.kt b/app/src/main/java/com/x8bit/bitwarden/data/platform/repository/util/EnvironmentUrlDataJsonExtensions.kt index 26139688d..b3a276fc3 100644 --- a/app/src/main/java/com/x8bit/bitwarden/data/platform/repository/util/EnvironmentUrlDataJsonExtensions.kt +++ b/app/src/main/java/com/x8bit/bitwarden/data/platform/repository/util/EnvironmentUrlDataJsonExtensions.kt @@ -125,11 +125,11 @@ fun EnvironmentUrlDataJson.toEnvironmentUrls(): Environment = when (this) { EnvironmentUrlDataJson.DEFAULT_US, EnvironmentUrlDataJson.DEFAULT_LEGACY_US, - -> Environment.Us + -> Environment.Us EnvironmentUrlDataJson.DEFAULT_EU, EnvironmentUrlDataJson.DEFAULT_LEGACY_EU, - -> Environment.Eu + -> Environment.Eu else -> Environment.SelfHosted(environmentUrlData = this) } diff --git a/app/src/main/java/com/x8bit/bitwarden/data/platform/util/URIExtensions.kt b/app/src/main/java/com/x8bit/bitwarden/data/platform/util/URIExtensions.kt index 865ddb41c..1d6647222 100644 --- a/app/src/main/java/com/x8bit/bitwarden/data/platform/util/URIExtensions.kt +++ b/app/src/main/java/com/x8bit/bitwarden/data/platform/util/URIExtensions.kt @@ -121,7 +121,7 @@ private fun parseDomainNameOrNullInternal( val tldRange: IntRange? = when (largestMatch) { is SuffixMatchType.Exception, is SuffixMatchType.Normal, - -> { + -> { host.findLastSubstringIndicesOrNull(largestMatch.partialDomain) } diff --git a/app/src/main/java/com/x8bit/bitwarden/data/vault/datasource/sdk/VaultSdkSource.kt b/app/src/main/java/com/x8bit/bitwarden/data/vault/datasource/sdk/VaultSdkSource.kt index bc0cc3230..4e26eb042 100644 --- a/app/src/main/java/com/x8bit/bitwarden/data/vault/datasource/sdk/VaultSdkSource.kt +++ b/app/src/main/java/com/x8bit/bitwarden/data/vault/datasource/sdk/VaultSdkSource.kt @@ -3,7 +3,6 @@ package com.x8bit.bitwarden.data.vault.datasource.sdk import com.bitwarden.core.DateTime import com.bitwarden.core.DerivePinKeyResponse import com.bitwarden.core.InitOrgCryptoRequest -import com.bitwarden.core.InitUserCryptoMethod import com.bitwarden.core.InitUserCryptoRequest import com.bitwarden.core.UpdatePasswordResponse import com.bitwarden.crypto.Kdf diff --git a/app/src/main/java/com/x8bit/bitwarden/data/vault/manager/VaultLockManagerImpl.kt b/app/src/main/java/com/x8bit/bitwarden/data/vault/manager/VaultLockManagerImpl.kt index b537f1f19..41189cb87 100644 --- a/app/src/main/java/com/x8bit/bitwarden/data/vault/manager/VaultLockManagerImpl.kt +++ b/app/src/main/java/com/x8bit/bitwarden/data/vault/manager/VaultLockManagerImpl.kt @@ -489,7 +489,7 @@ class VaultLockManagerImpl( // User no longer active or engaging with the app. CheckTimeoutReason.APP_BACKGROUNDED, CheckTimeoutReason.USER_CHANGED, - -> { + -> { handleTimeoutActionWithDelay( userId = userId, vaultTimeoutAction = vaultTimeoutAction, diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/completeregistration/CompleteRegistrationViewModel.kt b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/completeregistration/CompleteRegistrationViewModel.kt index 93c0ebc71..ebc9e6624 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/completeregistration/CompleteRegistrationViewModel.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/completeregistration/CompleteRegistrationViewModel.kt @@ -464,11 +464,11 @@ data class CompleteRegistrationState( PasswordStrengthState.WEAK_1, PasswordStrengthState.WEAK_2, PasswordStrengthState.WEAK_3, - -> false + -> false PasswordStrengthState.GOOD, PasswordStrengthState.STRONG, - -> true + -> true } /** diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/createaccount/CreateAccountViewModel.kt b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/createaccount/CreateAccountViewModel.kt index e8a313284..68ad5971b 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/createaccount/CreateAccountViewModel.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/createaccount/CreateAccountViewModel.kt @@ -415,11 +415,11 @@ data class CreateAccountState( PasswordStrengthState.WEAK_1, PasswordStrengthState.WEAK_2, PasswordStrengthState.WEAK_3, - -> false + -> false PasswordStrengthState.GOOD, PasswordStrengthState.STRONG, - -> true + -> true } } diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/environment/EnvironmentViewModel.kt b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/environment/EnvironmentViewModel.kt index da0356031..4c93113f8 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/environment/EnvironmentViewModel.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/environment/EnvironmentViewModel.kt @@ -33,7 +33,7 @@ class EnvironmentViewModel @Inject constructor( val environmentUrlData = when (val environment = environmentRepository.environment) { Environment.Us, Environment.Eu, - -> EnvironmentUrlDataJson(base = "") + -> EnvironmentUrlDataJson(base = "") is Environment.SelfHosted -> environment.environmentUrlData } diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/expiredregistrationlink/ExpiredRegistrationLinkViewModel.kt b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/expiredregistrationlink/ExpiredRegistrationLinkViewModel.kt index 60c98edd9..160539de1 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/expiredregistrationlink/ExpiredRegistrationLinkViewModel.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/expiredregistrationlink/ExpiredRegistrationLinkViewModel.kt @@ -12,8 +12,8 @@ import javax.inject.Inject class ExpiredRegistrationLinkViewModel @Inject constructor( private val authRepository: AuthRepository, ) : BaseViewModel( - initialState = Unit, - ) { + initialState = Unit, +) { override fun handleAction(action: ExpiredRegistrationLinkAction) { when (action) { ExpiredRegistrationLinkAction.CloseClicked -> handleCloseClicked() diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/loginwithdevice/LoginWithDeviceViewModel.kt b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/loginwithdevice/LoginWithDeviceViewModel.kt index 040d7a115..cbc952071 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/loginwithdevice/LoginWithDeviceViewModel.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/loginwithdevice/LoginWithDeviceViewModel.kt @@ -161,7 +161,7 @@ class LoginWithDeviceViewModel @Inject constructor( when (state.loginWithDeviceType) { LoginWithDeviceType.OTHER_DEVICE, LoginWithDeviceType.SSO_OTHER_DEVICE, - -> { + -> { mutableStateFlow.update { it.copy( viewState = LoginWithDeviceState.ViewState.Content( @@ -292,7 +292,7 @@ class LoginWithDeviceViewModel @Inject constructor( LoginWithDeviceType.SSO_ADMIN_APPROVAL, LoginWithDeviceType.SSO_OTHER_DEVICE, - -> { + -> { authRepository.completeTdeLogin( requestPrivateKey = loginData.privateKey, asymmetricalKey = loginData.asymmetricalKey, @@ -352,7 +352,7 @@ data class LoginWithDeviceState( get() = when (loginWithDeviceType) { LoginWithDeviceType.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() } @@ -389,10 +389,10 @@ data class LoginWithDeviceState( get() = when (loginWithDeviceType) { LoginWithDeviceType.OTHER_DEVICE, LoginWithDeviceType.SSO_OTHER_DEVICE, - -> R.string.log_in_initiated.asText() + -> R.string.log_in_initiated.asText() 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) { LoginWithDeviceType.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, - -> 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) { LoginWithDeviceType.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, - -> 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) { LoginWithDeviceType.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() } diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/twofactorlogin/TwoFactorLoginViewModel.kt b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/twofactorlogin/TwoFactorLoginViewModel.kt index 14afa3136..731b4bbc4 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/twofactorlogin/TwoFactorLoginViewModel.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/twofactorlogin/TwoFactorLoginViewModel.kt @@ -202,7 +202,7 @@ class TwoFactorLoginViewModel @Inject constructor( when (state.authMethod) { TwoFactorAuthMethod.DUO, TwoFactorAuthMethod.DUO_ORGANIZATION, - -> { + -> { val authUrl = authRepository.twoFactorResponse.twoFactorDuoAuthUrl // The url should not be empty unless the environment is somehow not supported. authUrl @@ -256,7 +256,7 @@ class TwoFactorLoginViewModel @Inject constructor( TwoFactorAuthMethod.U2F, TwoFactorAuthMethod.REMEMBER, TwoFactorAuthMethod.RECOVERY_CODE, - -> initiateLogin() + -> initiateLogin() } } @@ -486,7 +486,7 @@ class TwoFactorLoginViewModel @Inject constructor( TwoFactorAuthMethod.REMEMBER, TwoFactorAuthMethod.DUO_ORGANIZATION, TwoFactorAuthMethod.WEB_AUTH, - -> { + -> { updateAuthMethodRelatedState(action.authMethod) } } @@ -517,7 +517,7 @@ class TwoFactorLoginViewModel @Inject constructor( val code = when (state.authMethod) { TwoFactorAuthMethod.AUTHENTICATOR_APP, TwoFactorAuthMethod.EMAIL, - -> state.codeInput.replace(" ", "") + -> state.codeInput.replace(" ", "") TwoFactorAuthMethod.DUO, TwoFactorAuthMethod.DUO_ORGANIZATION, @@ -526,7 +526,7 @@ class TwoFactorLoginViewModel @Inject constructor( TwoFactorAuthMethod.REMEMBER, TwoFactorAuthMethod.WEB_AUTH, TwoFactorAuthMethod.RECOVERY_CODE, - -> state.codeInput + -> state.codeInput } viewModelScope.launch { diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/twofactorlogin/util/TwoFactorAuthMethodExtensions.kt b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/twofactorlogin/util/TwoFactorAuthMethodExtensions.kt index fd052d02d..be3e83fb0 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/twofactorlogin/util/TwoFactorAuthMethodExtensions.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/twofactorlogin/util/TwoFactorAuthMethodExtensions.kt @@ -51,7 +51,7 @@ val TwoFactorAuthMethod.button: Text get() = when (this) { TwoFactorAuthMethod.DUO, TwoFactorAuthMethod.DUO_ORGANIZATION, - -> R.string.launch_duo.asText() + -> R.string.launch_duo.asText() TwoFactorAuthMethod.AUTHENTICATOR_APP, TwoFactorAuthMethod.EMAIL, @@ -59,7 +59,7 @@ val TwoFactorAuthMethod.button: Text TwoFactorAuthMethod.U2F, TwoFactorAuthMethod.REMEMBER, TwoFactorAuthMethod.RECOVERY_CODE, - -> R.string.continue_text.asText() + -> R.string.continue_text.asText() TwoFactorAuthMethod.WEB_AUTH -> R.string.launch_web_authn.asText() } @@ -72,7 +72,7 @@ val TwoFactorAuthMethod.isContinueButtonEnabled: Boolean TwoFactorAuthMethod.DUO, TwoFactorAuthMethod.DUO_ORGANIZATION, TwoFactorAuthMethod.WEB_AUTH, - -> true + -> true TwoFactorAuthMethod.AUTHENTICATOR_APP, TwoFactorAuthMethod.EMAIL, @@ -80,7 +80,7 @@ val TwoFactorAuthMethod.isContinueButtonEnabled: Boolean TwoFactorAuthMethod.U2F, TwoFactorAuthMethod.REMEMBER, TwoFactorAuthMethod.RECOVERY_CODE, - -> false + -> false } /** @@ -91,7 +91,7 @@ val TwoFactorAuthMethod.showPasswordInput: Boolean TwoFactorAuthMethod.DUO, TwoFactorAuthMethod.DUO_ORGANIZATION, TwoFactorAuthMethod.WEB_AUTH, - -> false + -> false TwoFactorAuthMethod.AUTHENTICATOR_APP, TwoFactorAuthMethod.EMAIL, @@ -99,7 +99,7 @@ val TwoFactorAuthMethod.showPasswordInput: Boolean TwoFactorAuthMethod.U2F, TwoFactorAuthMethod.REMEMBER, TwoFactorAuthMethod.RECOVERY_CODE, - -> true + -> true } /** diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/vaultunlock/VaultUnlockScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/vaultunlock/VaultUnlockScreen.kt index 7cda8433a..555a0ce5f 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/vaultunlock/VaultUnlockScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/vaultunlock/VaultUnlockScreen.kt @@ -118,6 +118,7 @@ fun VaultUnlockScreen( result = Fido2CredentialAssertionResult.Error, ) } + VaultUnlockEvent.Fido2GetCredentialsError -> { fido2CompletionManager.completeFido2GetCredentialRequest( result = Fido2GetCredentialsResult.Error, diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/vaultunlock/VaultUnlockViewModel.kt b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/vaultunlock/VaultUnlockViewModel.kt index 3f6f0bcda..780651e43 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/vaultunlock/VaultUnlockViewModel.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/vaultunlock/VaultUnlockViewModel.kt @@ -300,7 +300,7 @@ class VaultUnlockViewModel @Inject constructor( VaultUnlockResult.GenericError, VaultUnlockResult.InvalidStateError, - -> { + -> { mutableStateFlow.update { it.copy( dialog = VaultUnlockState.VaultUnlockDialog.Error( diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/autofill/fido2/manager/Fido2CompletionManagerImpl.kt b/app/src/main/java/com/x8bit/bitwarden/ui/autofill/fido2/manager/Fido2CompletionManagerImpl.kt index ed5cb41b1..85962dce0 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/autofill/fido2/manager/Fido2CompletionManagerImpl.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/autofill/fido2/manager/Fido2CompletionManagerImpl.kt @@ -132,7 +132,7 @@ class Fido2CompletionManagerImpl( } Fido2GetCredentialsResult.Error, - -> { + -> { PendingIntentHandler.setGetCredentialException( resultIntent, GetCredentialUnknownException(), diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/util/DialogExtensions.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/util/DialogExtensions.kt index f1ba50fe0..153cfc8e9 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/util/DialogExtensions.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/util/DialogExtensions.kt @@ -14,7 +14,7 @@ val Configuration.maxDialogHeight: Dp Configuration.ORIENTATION_UNDEFINED -> Dp.Unspecified @Suppress("DEPRECATION") Configuration.ORIENTATION_SQUARE, - -> Dp.Unspecified + -> Dp.Unspecified else -> Dp.Unspecified } @@ -29,7 +29,7 @@ val Configuration.maxDialogWidth: Dp Configuration.ORIENTATION_UNDEFINED -> Dp.Unspecified @Suppress("DEPRECATION") Configuration.ORIENTATION_SQUARE, - -> Dp.Unspecified + -> Dp.Unspecified else -> Dp.Unspecified } diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/debugmenu/components/FeatureFlagListItems.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/debugmenu/components/FeatureFlagListItems.kt index ac291f3e6..cb7cedecc 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/debugmenu/components/FeatureFlagListItems.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/debugmenu/components/FeatureFlagListItems.kt @@ -20,13 +20,13 @@ fun FlagKey.ListItemContent( FlagKey.DummyBoolean, is FlagKey.DummyInt, FlagKey.DummyString, - -> Unit + -> Unit FlagKey.AuthenticatorSync, FlagKey.EmailVerification, FlagKey.OnboardingCarousel, FlagKey.OnboardingFlow, - -> BooleanFlagItem( + -> BooleanFlagItem( label = flagKey.getDisplayLabel(), key = flagKey as FlagKey, currentValue = currentValue as Boolean, @@ -61,7 +61,7 @@ private fun FlagKey.getDisplayLabel(): String = when (this) { FlagKey.DummyBoolean, is FlagKey.DummyInt, FlagKey.DummyString, - -> this.keyName + -> this.keyName FlagKey.AuthenticatorSync -> stringResource(R.string.authenticator_sync) FlagKey.EmailVerification -> stringResource(R.string.email_verification) diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/rootnav/RootNavScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/rootnav/RootNavScreen.kt index 3affef5ae..4bb22e3fa 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/rootnav/RootNavScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/rootnav/RootNavScreen.kt @@ -109,7 +109,7 @@ fun RootNavScreen( is RootNavState.CompleteOngoingRegistration, RootNavState.AuthWithWelcome, RootNavState.ExpiredRegistrationLink, - -> AUTH_GRAPH_ROUTE + -> AUTH_GRAPH_ROUTE RootNavState.ResetPassword -> RESET_PASSWORD_ROUTE RootNavState.SetPassword -> SET_PASSWORD_ROUTE @@ -126,7 +126,7 @@ fun RootNavScreen( is RootNavState.VaultUnlockedForFido2Save, is RootNavState.VaultUnlockedForFido2Assertion, is RootNavState.VaultUnlockedForFido2GetCredentials, - -> VAULT_UNLOCKED_GRAPH_ROUTE + -> VAULT_UNLOCKED_GRAPH_ROUTE RootNavState.OnboardingAccountLockSetup -> SETUP_UNLOCK_AS_ROOT_ROUTE RootNavState.OnboardingAutoFillSetup -> SETUP_AUTO_FILL_AS_ROOT_ROUTE @@ -235,7 +235,7 @@ fun RootNavScreen( is RootNavState.VaultUnlockedForFido2Save, is RootNavState.VaultUnlockedForFido2Assertion, is RootNavState.VaultUnlockedForFido2GetCredentials, - -> { + -> { navController.navigateToVaultUnlockedGraph(rootNavOptions) navController.navigateToVaultItemListingAsRoot( vaultItemListingType = VaultItemListingType.Login, diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/rootnav/RootNavViewModel.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/rootnav/RootNavViewModel.kt index 5fc98402e..ca13a34a6 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/rootnav/RootNavViewModel.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/rootnav/RootNavViewModel.kt @@ -95,7 +95,8 @@ class RootNavViewModel @Inject constructor( when (userState.activeAccount.onboardingStatus) { OnboardingStatus.NOT_STARTED, OnboardingStatus.ACCOUNT_LOCK_SETUP, - -> RootNavState.OnboardingAccountLockSetup + -> RootNavState.OnboardingAccountLockSetup + OnboardingStatus.AUTOFILL_SETUP -> RootNavState.OnboardingAutoFillSetup OnboardingStatus.FINAL_STEP -> RootNavState.OnboardingStepsComplete OnboardingStatus.COMPLETE -> throw IllegalStateException("Should not have entered here.") @@ -153,7 +154,7 @@ class RootNavViewModel @Inject constructor( SpecialCircumstance.GeneratorShortcut, SpecialCircumstance.VaultShortcut, null, - -> RootNavState.VaultUnlocked(activeUserId = userState.activeAccount.userId) + -> RootNavState.VaultUnlocked(activeUserId = userState.activeAccount.userId) is SpecialCircumstance.RegistrationEvent -> { throw IllegalStateException( diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/search/SearchContent.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/search/SearchContent.kt index 77b5d003a..c0fc89f3f 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/search/SearchContent.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/search/SearchContent.kt @@ -73,7 +73,7 @@ fun SearchContent( is ListingItemOverflowAction.VaultAction.LaunchClick, is ListingItemOverflowAction.VaultAction.ViewClick, null, - -> Unit + -> Unit } var autofillSelectionOptionsItem by rememberSaveable { diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/deleteaccount/DeleteAccountScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/deleteaccount/DeleteAccountScreen.kt index 42e5b32f9..3fec7d5eb 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/deleteaccount/DeleteAccountScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/deleteaccount/DeleteAccountScreen.kt @@ -95,7 +95,7 @@ fun DeleteAccountScreen( DeleteAccountState.DeleteAccountDialog.Loading, - -> BitwardenLoadingDialog( + -> BitwardenLoadingDialog( visibilityState = LoadingDialogState.Shown(R.string.loading.asText()), ) diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/loginapproval/LoginApprovalViewModel.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/loginapproval/LoginApprovalViewModel.kt index 02f4ca813..bacf6d6c6 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/loginapproval/LoginApprovalViewModel.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/loginapproval/LoginApprovalViewModel.kt @@ -183,7 +183,7 @@ class LoginApprovalViewModel @Inject constructor( AuthRequestUpdatesResult.Approved, AuthRequestUpdatesResult.Declined, AuthRequestUpdatesResult.Expired, - -> { + -> { sendClosingEvent() } } diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/vaultunlockednavbar/VaultUnlockedNavBarScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/vaultunlockednavbar/VaultUnlockedNavBarScreen.kt index 7acad49de..1ee2d7eeb 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/vaultunlockednavbar/VaultUnlockedNavBarScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/vaultunlockednavbar/VaultUnlockedNavBarScreen.kt @@ -86,7 +86,7 @@ fun VaultUnlockedNavBarScreen( when (event) { is VaultUnlockedNavBarEvent.Shortcut.NavigateToVaultScreen, is VaultUnlockedNavBarEvent.NavigateToVaultScreen, - -> { + -> { navigateToVaultGraph(navOptions) } @@ -96,7 +96,7 @@ fun VaultUnlockedNavBarScreen( VaultUnlockedNavBarEvent.Shortcut.NavigateToGeneratorScreen, VaultUnlockedNavBarEvent.NavigateToGeneratorScreen, - -> { + -> { navigateToGeneratorGraph(navOptions) } diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/manager/biometrics/BiometricsManagerImpl.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/manager/biometrics/BiometricsManagerImpl.kt index 6e464b182..430031db5 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/manager/biometrics/BiometricsManagerImpl.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/manager/biometrics/BiometricsManagerImpl.kt @@ -74,7 +74,7 @@ class BiometricsManagerImpl( BiometricManager.BIOMETRIC_ERROR_NONE_ENROLLED, BiometricManager.BIOMETRIC_ERROR_NO_HARDWARE, BiometricManager.BIOMETRIC_ERROR_SECURITY_UPDATE_REQUIRED, - -> false + -> false else -> false } @@ -106,13 +106,13 @@ class BiometricsManagerImpl( BiometricPrompt.ERROR_NO_BIOMETRICS, BiometricPrompt.ERROR_HW_NOT_PRESENT, BiometricPrompt.ERROR_NO_DEVICE_CREDENTIAL, - -> onError() + -> onError() BiometricPrompt.ERROR_NEGATIVE_BUTTON -> onCancel() BiometricPrompt.ERROR_LOCKOUT, BiometricPrompt.ERROR_LOCKOUT_PERMANENT, - -> onLockOut() + -> onLockOut() } } diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/util/VaultTimeoutExtensions.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/util/VaultTimeoutExtensions.kt index 0559aa0a3..c8493bea3 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/util/VaultTimeoutExtensions.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/util/VaultTimeoutExtensions.kt @@ -40,7 +40,7 @@ val VaultTimeout.Type.minutes: Int VaultTimeout.Type.ON_APP_RESTART, VaultTimeout.Type.NEVER, - -> Int.MAX_VALUE + -> Int.MAX_VALUE VaultTimeout.Type.CUSTOM -> 0 } diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/tools/feature/generator/GeneratorScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/tools/feature/generator/GeneratorScreen.kt index 0cb709c3d..08bb27fb8 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/tools/feature/generator/GeneratorScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/tools/feature/generator/GeneratorScreen.kt @@ -192,7 +192,7 @@ fun GeneratorScreen( when (state.generatorMode) { is GeneratorMode.Modal.Username, GeneratorMode.Modal.Password, - -> { + -> { ModalAppBar( scrollBehavior = scrollBehavior, onCloseClick = remember(viewModel) { diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/tools/feature/generator/GeneratorViewModel.kt b/app/src/main/java/com/x8bit/bitwarden/ui/tools/feature/generator/GeneratorViewModel.kt index 39b0769dd..124a40784 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/tools/feature/generator/GeneratorViewModel.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/tools/feature/generator/GeneratorViewModel.kt @@ -779,44 +779,44 @@ class GeneratorViewModel @Inject constructor( ) { when (action) { is GeneratorAction.MainType.Passcode.PasscodeType.Password.SliderLengthChange, - -> { + -> { handlePasswordLengthSliderChange(action) } is GeneratorAction.MainType.Passcode.PasscodeType.Password.ToggleCapitalLettersChange, - -> { + -> { handleToggleCapitalLetters(action) } is GeneratorAction.MainType.Passcode.PasscodeType.Password.ToggleLowercaseLettersChange, - -> { + -> { handleToggleLowercaseLetters(action) } is GeneratorAction.MainType.Passcode.PasscodeType.Password.ToggleNumbersChange, - -> { + -> { handleToggleNumbers(action) } is GeneratorAction.MainType.Passcode.PasscodeType.Password .ToggleSpecialCharactersChange, - -> { + -> { handleToggleSpecialChars(action) } is GeneratorAction.MainType.Passcode.PasscodeType.Password.MinNumbersCounterChange, - -> { + -> { handleMinNumbersChange(action) } is GeneratorAction.MainType.Passcode.PasscodeType.Password.MinSpecialCharactersChange, - -> { + -> { handleMinSpecialChange(action) } is GeneratorAction.MainType.Passcode.PasscodeType.Password .ToggleAvoidAmbigousCharactersChange, - -> { + -> { handleToggleAmbiguousChars(action) } } @@ -923,22 +923,22 @@ class GeneratorViewModel @Inject constructor( ) { when (action) { is GeneratorAction.MainType.Passcode.PasscodeType.Passphrase.NumWordsCounterChange, - -> { + -> { handleNumWordsCounterChange(action) } is GeneratorAction.MainType.Passcode.PasscodeType.Passphrase.ToggleCapitalizeChange, - -> { + -> { handlePassphraseToggleCapitalizeChange(action) } is GeneratorAction.MainType.Passcode.PasscodeType.Passphrase.ToggleIncludeNumberChange, - -> { + -> { handlePassphraseToggleIncludeNumberChange(action) } is GeneratorAction.MainType.Passcode.PasscodeType.Passphrase.WordSeparatorTextChange, - -> { + -> { handleWordSeparatorTextInputChange(action) } } @@ -1096,7 +1096,7 @@ class GeneratorViewModel @Inject constructor( .ForwardedEmailAlias .AddyIo .AccessTokenTextChange, - -> { + -> { handleAddyIoAccessTokenTextChange(action) } @@ -1107,7 +1107,7 @@ class GeneratorViewModel @Inject constructor( .ForwardedEmailAlias .AddyIo .DomainTextChange, - -> { + -> { handleAddyIoDomainNameTextChange(action) } } @@ -1220,7 +1220,7 @@ class GeneratorViewModel @Inject constructor( .ForwardedEmailAlias .ForwardEmail .ApiKeyTextChange, - -> { + -> { handleForwardEmailApiKeyTextChange(action) } @@ -1231,7 +1231,7 @@ class GeneratorViewModel @Inject constructor( .ForwardedEmailAlias .ForwardEmail .DomainNameTextChange, - -> { + -> { handleForwardEmailDomainNameTextChange(action) } } @@ -1330,7 +1330,7 @@ class GeneratorViewModel @Inject constructor( .UsernameType .RandomWord .ToggleIncludeNumberChange, - -> { + -> { handleRandomWordToggleIncludeNumberChange(action) } } diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/addedit/VaultAddEditNavigation.kt b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/addedit/VaultAddEditNavigation.kt index 51adb236a..5a9ee185c 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/addedit/VaultAddEditNavigation.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/addedit/VaultAddEditNavigation.kt @@ -118,7 +118,7 @@ private fun VaultAddEditType.toVaultItemCipherTypeOrNull(): String? = is VaultAddEditType.AddItem -> vaultItemCipherType.toTypeString() is VaultAddEditType.CloneItem, is VaultAddEditType.EditItem, - -> null + -> null } private fun VaultItemCipherType.toTypeString(): String = diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/itemlisting/util/VaultItemListingDataExtensions.kt b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/itemlisting/util/VaultItemListingDataExtensions.kt index a1ee3341c..67d09b720 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/itemlisting/util/VaultItemListingDataExtensions.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/itemlisting/util/VaultItemListingDataExtensions.kt @@ -195,7 +195,7 @@ fun VaultData.toViewState( val shouldShowAddButton = when (itemListingType) { is VaultItemListingState.ItemListingType.Vault.Folder, VaultItemListingState.ItemListingType.Vault.Trash, - -> false + -> false else -> true } diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/itemlisting/util/VaultItemListingStateExtensions.kt b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/itemlisting/util/VaultItemListingStateExtensions.kt index e9e86a03f..3548da9f3 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/itemlisting/util/VaultItemListingStateExtensions.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/itemlisting/util/VaultItemListingStateExtensions.kt @@ -40,5 +40,9 @@ fun VaultItemListingState.ItemListingType.Vault.toVaultItemCipherType(): VaultIt is VaultItemListingState.ItemListingType.Vault.Collection -> VaultItemCipherType.LOGIN is VaultItemListingState.ItemListingType.Vault.Trash, is VaultItemListingState.ItemListingType.Vault.Folder, - -> throw IllegalStateException("Cannot create vault item from this VaultItemListingState!") + -> { + throw IllegalStateException( + "Cannot create vault item from this VaultItemListingState!", + ) + } } diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/vault/util/AccountSummaryExtensions.kt b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/vault/util/AccountSummaryExtensions.kt index 54da72d56..ad46aea5a 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/vault/util/AccountSummaryExtensions.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/vault/util/AccountSummaryExtensions.kt @@ -50,7 +50,7 @@ val AccountSummary.iconTestTag: String AccountSummary.Status.LOCKED, AccountSummary.Status.LOGGED_OUT, AccountSummary.Status.UNLOCKED, - -> "InactiveVaultIcon" + -> "InactiveVaultIcon" } /** diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/vault/util/VaultDataExtensions.kt b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/vault/util/VaultDataExtensions.kt index 1cee834d3..6b087bd18 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/vault/util/VaultDataExtensions.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/vault/util/VaultDataExtensions.kt @@ -295,7 +295,7 @@ fun List.toFilteredList( when (vaultFilterType) { VaultFilterType.AllVaults, VaultFilterType.MyVault, - -> true + -> true // Only include folders containing an item associated with this organization. is VaultFilterType.OrganizationVault -> { diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/vault/util/VaultStateExtensions.kt b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/vault/util/VaultStateExtensions.kt index bcba7cfeb..7b1845d0f 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/vault/util/VaultStateExtensions.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/vault/util/VaultStateExtensions.kt @@ -13,7 +13,7 @@ fun VaultState.ViewState.vaultFilterDataIfRequired( when (this) { is VaultState.ViewState.Content, is VaultState.ViewState.NoItems, - -> vaultFilterData?.let { + -> vaultFilterData?.let { if (it.vaultFilterTypes.contains(VaultFilterType.MyVault) || it.vaultFilterTypes.size > 2 ) { @@ -25,5 +25,5 @@ fun VaultState.ViewState.vaultFilterDataIfRequired( is VaultState.ViewState.Error, is VaultState.ViewState.Loading, - -> null + -> null } diff --git a/app/src/test/java/com/x8bit/bitwarden/data/auth/datasource/network/service/IdentityServiceTest.kt b/app/src/test/java/com/x8bit/bitwarden/data/auth/datasource/network/service/IdentityServiceTest.kt index 4a5e11dd1..50d92b082 100644 --- a/app/src/test/java/com/x8bit/bitwarden/data/auth/datasource/network/service/IdentityServiceTest.kt +++ b/app/src/test/java/com/x8bit/bitwarden/data/auth/datasource/network/service/IdentityServiceTest.kt @@ -408,27 +408,24 @@ class IdentityServiceTest : BaseServiceTest() { @Suppress("MaxLineLength") @Test - fun `verifyEmailToken should return Invalid when response message is non expired error`() = runTest { - val messageWithOutExpired = "message without expir... whoops" - val json = """ - { - "message": "$messageWithOutExpired" - } - """.trimIndent() - val response = MockResponse().setResponseCode(400).setBody(json) - server.enqueue(response) - val result = identityService.verifyEmailRegistrationToken( - body = VerifyEmailTokenRequestJson( - token = EMAIL_TOKEN, - email = EMAIL, - ), - ) - assertTrue(result.isSuccess) - assertEquals( - VerifyEmailTokenResponseJson.Invalid(messageWithOutExpired), - result.getOrThrow(), - ) - } + fun `verifyEmailToken should return Invalid when response message is non expired error`() = + runTest { + val messageWithOutExpired = "message without expir... whoops" + val json = """{ "message": "$messageWithOutExpired" }""".trimIndent() + val response = MockResponse().setResponseCode(400).setBody(json) + server.enqueue(response) + val result = identityService.verifyEmailRegistrationToken( + body = VerifyEmailTokenRequestJson( + token = EMAIL_TOKEN, + email = EMAIL, + ), + ) + assertTrue(result.isSuccess) + assertEquals( + VerifyEmailTokenResponseJson.Invalid(messageWithOutExpired), + result.getOrThrow(), + ) + } @Test fun `verifyEmailToken should return an error when response is an un-handled error`() = runTest { @@ -566,7 +563,7 @@ private const val LOGIN_SUCCESS_JSON = """ } }, "KeyConnectorUrl": "keyConnectorUrl" -} +} """ private val LOGIN_SUCCESS = GetTokenResponseJson.Success( diff --git a/app/src/test/java/com/x8bit/bitwarden/data/platform/datasource/disk/util/FakeSettingsDiskSource.kt b/app/src/test/java/com/x8bit/bitwarden/data/platform/datasource/disk/util/FakeSettingsDiskSource.kt index 79c734149..6519a0d27 100644 --- a/app/src/test/java/com/x8bit/bitwarden/data/platform/datasource/disk/util/FakeSettingsDiskSource.kt +++ b/app/src/test/java/com/x8bit/bitwarden/data/platform/datasource/disk/util/FakeSettingsDiskSource.kt @@ -352,6 +352,7 @@ class FakeSettingsDiskSource : SettingsDiskSource { mutablePullToRefreshEnabledFlowMap.getOrPut(userId) { bufferedMutableSharedFlow(replay = 1) } + private fun getMutableShowAutoFillSettingBadgeFlow( userId: String, ): MutableSharedFlow = mutableShowAutoFillSettingBadgeFlowMap.getOrPut(userId) { diff --git a/app/src/test/java/com/x8bit/bitwarden/data/platform/repository/SettingsRepositoryTest.kt b/app/src/test/java/com/x8bit/bitwarden/data/platform/repository/SettingsRepositoryTest.kt index 8a5b1788a..36f7ca029 100644 --- a/app/src/test/java/com/x8bit/bitwarden/data/platform/repository/SettingsRepositoryTest.kt +++ b/app/src/test/java/com/x8bit/bitwarden/data/platform/repository/SettingsRepositoryTest.kt @@ -1119,7 +1119,9 @@ class SettingsRepositoryTest { assertFalse(settingsRepository.isAuthenticatorSyncEnabled) assertNull(fakeAuthDiskSource.getAuthenticatorSyncUnlockKey(USER_ID)) - assertTrue(fakeAuthDiskSource.authenticatorSyncSymmetricKey.contentEquals(syncSymmetricKey)) + assertTrue( + fakeAuthDiskSource.authenticatorSyncSymmetricKey.contentEquals(syncSymmetricKey), + ) } @Test diff --git a/app/src/test/java/com/x8bit/bitwarden/data/vault/manager/VaultLockManagerTest.kt b/app/src/test/java/com/x8bit/bitwarden/data/vault/manager/VaultLockManagerTest.kt index 284e898de..afc420842 100644 --- a/app/src/test/java/com/x8bit/bitwarden/data/vault/manager/VaultLockManagerTest.kt +++ b/app/src/test/java/com/x8bit/bitwarden/data/vault/manager/VaultLockManagerTest.kt @@ -181,7 +181,7 @@ class VaultLockManagerTest { VaultTimeout.OneHour, VaultTimeout.FourHours, is VaultTimeout.Custom, - -> { + -> { assertTrue(vaultLockManager.isVaultUnlocked(USER_ID)) } @@ -189,7 +189,7 @@ class VaultLockManagerTest { VaultTimeout.Immediately, VaultTimeout.OneMinute, VaultTimeout.FiveMinutes, - -> { + -> { assertFalse(vaultLockManager.isVaultUnlocked(USER_ID)) } } @@ -214,7 +214,7 @@ class VaultLockManagerTest { VaultTimeout.OneHour, VaultTimeout.FourHours, is VaultTimeout.Custom, - -> { + -> { verify(exactly = 0) { userLogoutManager.softLogout(any()) } } @@ -222,7 +222,7 @@ class VaultLockManagerTest { VaultTimeout.Immediately, VaultTimeout.OneMinute, VaultTimeout.FiveMinutes, - -> { + -> { verify(exactly = 1) { userLogoutManager.softLogout(USER_ID) } } } @@ -418,7 +418,7 @@ class VaultLockManagerTest { VaultTimeout.OneHour, VaultTimeout.FourHours, is VaultTimeout.Custom, - -> { + -> { assertTrue(vaultLockManager.isVaultUnlocked(activeUserId)) assertTrue(vaultLockManager.isVaultUnlocked(inactiveUserId)) } @@ -427,7 +427,7 @@ class VaultLockManagerTest { VaultTimeout.Immediately, VaultTimeout.OneMinute, VaultTimeout.FiveMinutes, - -> { + -> { assertTrue(vaultLockManager.isVaultUnlocked(activeUserId)) assertFalse(vaultLockManager.isVaultUnlocked(inactiveUserId)) } @@ -459,7 +459,7 @@ class VaultLockManagerTest { VaultTimeout.OneHour, VaultTimeout.FourHours, is VaultTimeout.Custom, - -> { + -> { verify(exactly = 0) { userLogoutManager.softLogout(any()) } } @@ -467,7 +467,7 @@ class VaultLockManagerTest { VaultTimeout.Immediately, VaultTimeout.OneMinute, VaultTimeout.FiveMinutes, - -> { + -> { verify(exactly = 0) { userLogoutManager.softLogout(activeUserId) } verify(exactly = 1) { userLogoutManager.softLogout(inactiveUserId) } } diff --git a/app/src/test/java/com/x8bit/bitwarden/ui/auth/feature/completeregistration/CompleteRegistrationScreenTest.kt b/app/src/test/java/com/x8bit/bitwarden/ui/auth/feature/completeregistration/CompleteRegistrationScreenTest.kt index 12adc2159..10778cebc 100644 --- a/app/src/test/java/com/x8bit/bitwarden/ui/auth/feature/completeregistration/CompleteRegistrationScreenTest.kt +++ b/app/src/test/java/com/x8bit/bitwarden/ui/auth/feature/completeregistration/CompleteRegistrationScreenTest.kt @@ -350,10 +350,10 @@ class CompleteRegistrationScreenTest : BaseComposeTest() { .performScrollTo() .performClick() - verify { - viewModel.trySendAction(CompleteRegistrationAction.LearnToPreventLockoutClick) + verify { + viewModel.trySendAction(CompleteRegistrationAction.LearnToPreventLockoutClick) + } } - } @Test fun `Header should be displayed in portrait mode`() = testWithFeatureFlagOn { diff --git a/app/src/test/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/AccountSecurityViewModelTest.kt b/app/src/test/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/AccountSecurityViewModelTest.kt index cefd3e998..dd0bdee34 100644 --- a/app/src/test/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/AccountSecurityViewModelTest.kt +++ b/app/src/test/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/AccountSecurityViewModelTest.kt @@ -731,8 +731,8 @@ class AccountSecurityViewModelTest : BaseViewModelTest() { @Test fun `when UnlockActionCardCtaClick action received, should dismiss unlock action card and send NavigateToSetupUnlockScreen event`() = runTest { - mutableShowUnlockBadgeFlow.update { true } - val viewModel = createViewModel() + mutableShowUnlockBadgeFlow.update { true } + val viewModel = createViewModel() viewModel.eventFlow.test { viewModel.trySendAction(AccountSecurityAction.UnlockActionCardCtaClick) assertEquals( @@ -740,10 +740,10 @@ class AccountSecurityViewModelTest : BaseViewModelTest() { awaitItem(), ) } - verify { - settingsRepository.storeShowUnlockSettingBadge(DEFAULT_STATE.userId, false) + verify { + settingsRepository.storeShowUnlockSettingBadge(DEFAULT_STATE.userId, false) + } } - } @Suppress("LongParameterList") private fun createViewModel( diff --git a/app/src/test/java/com/x8bit/bitwarden/ui/platform/feature/settings/autofill/AutoFillViewModelTest.kt b/app/src/test/java/com/x8bit/bitwarden/ui/platform/feature/settings/autofill/AutoFillViewModelTest.kt index b2963fdc6..ea5914624 100644 --- a/app/src/test/java/com/x8bit/bitwarden/ui/platform/feature/settings/autofill/AutoFillViewModelTest.kt +++ b/app/src/test/java/com/x8bit/bitwarden/ui/platform/feature/settings/autofill/AutoFillViewModelTest.kt @@ -323,8 +323,8 @@ class AutoFillViewModelTest : BaseViewModelTest() { @Test fun `when AutoFillActionCardCtaClick action is sent should update show autofill in repository and send NavigateToSetupAutofill event`() = runTest { - mutableShowAutofillActionCardFlow.update { true } - val viewModel = createViewModel() + mutableShowAutofillActionCardFlow.update { true } + val viewModel = createViewModel() viewModel.eventFlow.test { viewModel.trySendAction(AutoFillAction.AutoFillActionCardCtaClick) assertEquals( @@ -332,13 +332,10 @@ class AutoFillViewModelTest : BaseViewModelTest() { awaitItem(), ) } - verify { - settingsRepository.storeShowAutoFillSettingBadge( - DEFAULT_STATE.activeUserId, - false, - ) + verify { + settingsRepository.storeShowAutoFillSettingBadge(DEFAULT_STATE.activeUserId, false) + } } - } @Suppress("MaxLineLength") @Test diff --git a/app/src/test/java/com/x8bit/bitwarden/ui/platform/feature/vaultunlockednavbar/VaultUnlockedNavBarViewModelTest.kt b/app/src/test/java/com/x8bit/bitwarden/ui/platform/feature/vaultunlockednavbar/VaultUnlockedNavBarViewModelTest.kt index 7f6be985c..05fbaf24c 100644 --- a/app/src/test/java/com/x8bit/bitwarden/ui/platform/feature/vaultunlockednavbar/VaultUnlockedNavBarViewModelTest.kt +++ b/app/src/test/java/com/x8bit/bitwarden/ui/platform/feature/vaultunlockednavbar/VaultUnlockedNavBarViewModelTest.kt @@ -44,7 +44,10 @@ class VaultUnlockedNavBarViewModelTest : BaseViewModelTest() { val viewModel = createViewModel() viewModel.eventFlow.test { - assertEquals(VaultUnlockedNavBarEvent.Shortcut.NavigateToGeneratorScreen, awaitItem()) + assertEquals( + VaultUnlockedNavBarEvent.Shortcut.NavigateToGeneratorScreen, + awaitItem(), + ) } verify(exactly = 1) { specialCircumstancesManager.specialCircumstance