From 162da64567951c683fac1a5917f74624eb72b9df Mon Sep 17 00:00:00 2001 From: David Perez Date: Fri, 23 Aug 2024 10:49:59 -0500 Subject: [PATCH] Minor formatting an import cleanup (#3819) --- .../data/auth/repository/AuthRepositoryImpl.kt | 7 +++---- .../ui/auth/feature/landing/LandingViewModel.kt | 12 ++++++------ .../startregistration/StartRegistrationScreen.kt | 5 +++-- .../startregistration/StartRegistrationViewModel.kt | 8 ++++---- .../CompleteRegistrationScreenTest.kt | 6 +++--- .../StartRegistrationViewModelTest.kt | 1 + 6 files changed, 20 insertions(+), 19 deletions(-) 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 2d6a5bb26..38240b55d 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 @@ -7,7 +7,6 @@ import com.bitwarden.crypto.HashPurpose import com.bitwarden.crypto.Kdf import com.x8bit.bitwarden.data.auth.datasource.disk.AuthDiskSource import com.x8bit.bitwarden.data.auth.datasource.disk.model.AccountJson -import com.x8bit.bitwarden.data.auth.datasource.disk.model.AccountJson.Profile import com.x8bit.bitwarden.data.auth.datasource.disk.model.AccountTokensJson import com.x8bit.bitwarden.data.auth.datasource.disk.model.ForcePasswordResetReason import com.x8bit.bitwarden.data.auth.datasource.disk.model.UserStateJson @@ -1671,7 +1670,7 @@ class AuthRepositoryImpl( */ private suspend fun unlockVaultWithPasswordOnLoginSuccess( loginResponse: GetTokenResponseJson.Success, - profile: Profile, + profile: AccountJson.Profile, password: String?, ): VaultUnlockResult? { // Attempt to unlock the vault with password if possible. @@ -1693,7 +1692,7 @@ class AuthRepositoryImpl( */ private suspend fun unlockVaultWithTdeOnLoginSuccess( loginResponse: GetTokenResponseJson.Success, - profile: Profile, + profile: AccountJson.Profile, deviceData: DeviceDataModel?, ): VaultUnlockResult? { // Attempt to unlock the vault with auth request if possible. @@ -1743,7 +1742,7 @@ class AuthRepositoryImpl( */ private suspend fun unlockVaultWithTrustedDeviceUserDecryptionOptionsAndStoreKeys( options: TrustedDeviceUserDecryptionOptionsJson, - profile: Profile, + profile: AccountJson.Profile, privateKey: String, ): VaultUnlockResult? { var vaultUnlockResult: VaultUnlockResult? = null diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/landing/LandingViewModel.kt b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/landing/LandingViewModel.kt index 01eebaf27..2a8a9e099 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/landing/LandingViewModel.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/landing/LandingViewModel.kt @@ -194,12 +194,12 @@ class LandingViewModel @Inject constructor( } private fun handleCreateAccountClicked() { - @Suppress("MaxLineLength") - val navigationEvent = if (featureFlagManager.getFeatureFlag(key = FlagKey.EmailVerification)) { - LandingEvent.NavigateToStartRegistration - } else { - LandingEvent.NavigateToCreateAccount - } + val navigationEvent = + if (featureFlagManager.getFeatureFlag(key = FlagKey.EmailVerification)) { + LandingEvent.NavigateToStartRegistration + } else { + LandingEvent.NavigateToCreateAccount + } sendEvent(navigationEvent) } diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/startregistration/StartRegistrationScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/startregistration/StartRegistrationScreen.kt index 7e448613c..8dff71862 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/startregistration/StartRegistrationScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/startregistration/StartRegistrationScreen.kt @@ -238,8 +238,8 @@ private fun StartRegistrationContent( Spacer(modifier = Modifier.height(16.dp)) BitwardenTextField( label = stringResource( - id = R.string.email_address, - ), + id = R.string.email_address, + ), placeholder = stringResource(R.string.email_address_required), value = emailInput, onValueChange = handler.onEmailInputChange, @@ -422,6 +422,7 @@ private fun ReceiveMarketingEmailsSwitch( modifier: Modifier = Modifier, ) { val unsubscribeString = stringResource(id = R.string.unsubscribe) + @Suppress("MaxLineLength") val annotatedLinkString = createAnnotatedString( mainString = stringResource(id = R.string.get_advice_announcements_and_research_opportunities_from_bitwarden_in_your_inbox_unsubscribe_any_time), diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/startregistration/StartRegistrationViewModel.kt b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/startregistration/StartRegistrationViewModel.kt index 9a3480bea..f9bd16b96 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/startregistration/StartRegistrationViewModel.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/startregistration/StartRegistrationViewModel.kt @@ -117,11 +117,11 @@ class StartRegistrationViewModel @Inject constructor( } } -private fun handleOnboardingFeatureFlagUpdated(action: OnboardingFeatureFlagUpdated) { - mutableStateFlow.update { - it.copy(showNewOnboardingUi = action.newValue) + private fun handleOnboardingFeatureFlagUpdated(action: OnboardingFeatureFlagUpdated) { + mutableStateFlow.update { + it.copy(showNewOnboardingUi = action.newValue) + } } -} private fun handleServerGeologyHelpClick() { sendEvent(StartRegistrationEvent.NavigateToServerSelectionInfo) 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 9d7293c68..dc0cb3d94 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 @@ -278,9 +278,9 @@ class CompleteRegistrationScreenTest : BaseComposeTest() { .performScrollTo() .performClick() - verify { - viewModel.trySendAction(CompleteRegistrationAction.LearnToPreventLockoutClick) - } + verify { + viewModel.trySendAction(CompleteRegistrationAction.LearnToPreventLockoutClick) + } } @Suppress("MaxLineLength") diff --git a/app/src/test/java/com/x8bit/bitwarden/ui/auth/feature/startregistration/StartRegistrationViewModelTest.kt b/app/src/test/java/com/x8bit/bitwarden/ui/auth/feature/startregistration/StartRegistrationViewModelTest.kt index 5a430b154..c558c9403 100644 --- a/app/src/test/java/com/x8bit/bitwarden/ui/auth/feature/startregistration/StartRegistrationViewModelTest.kt +++ b/app/src/test/java/com/x8bit/bitwarden/ui/auth/feature/startregistration/StartRegistrationViewModelTest.kt @@ -50,6 +50,7 @@ class StartRegistrationViewModelTest : BaseViewModelTest() { every { getFeatureFlag(FlagKey.OnboardingFlow) } returns false every { getFeatureFlagFlow(FlagKey.OnboardingFlow) } returns mutableFeatureFlagFlow } + /** * Saved state handle that has valid inputs. Useful for tests that want to test things * after the user has entered all valid inputs.