diff --git a/app/build.gradle.kts b/app/build.gradle.kts index c31e52086..37d2a0eec 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -162,8 +162,7 @@ dependencies { add("standardImplementation", dependencyNotation) } - // TODO: this should use a versioned AAR instead of referencing a local AAR BITAU-94 - implementation(files("libs/authenticatorbridge-0.1.0-SNAPSHOT-release.aar")) + implementation(files("libs/authenticatorbridge-1.0.0-release.aar")) implementation(libs.androidx.activity.compose) implementation(libs.androidx.appcompat) diff --git a/app/libs/authenticatorbridge-0.1.0-SNAPSHOT-release.aar b/app/libs/authenticatorbridge-1.0.0-release.aar similarity index 63% rename from app/libs/authenticatorbridge-0.1.0-SNAPSHOT-release.aar rename to app/libs/authenticatorbridge-1.0.0-release.aar index defcb5273..58a7c494b 100644 Binary files a/app/libs/authenticatorbridge-0.1.0-SNAPSHOT-release.aar and b/app/libs/authenticatorbridge-1.0.0-release.aar differ diff --git a/app/src/main/java/com/x8bit/bitwarden/data/auth/datasource/network/api/UnauthenticatedOrganizationApi.kt b/app/src/main/java/com/x8bit/bitwarden/data/auth/datasource/network/api/UnauthenticatedOrganizationApi.kt index 20f3c70bf..ec26cb922 100644 --- a/app/src/main/java/com/x8bit/bitwarden/data/auth/datasource/network/api/UnauthenticatedOrganizationApi.kt +++ b/app/src/main/java/com/x8bit/bitwarden/data/auth/datasource/network/api/UnauthenticatedOrganizationApi.kt @@ -2,6 +2,8 @@ package com.x8bit.bitwarden.data.auth.datasource.network.api import com.x8bit.bitwarden.data.auth.datasource.network.model.OrganizationDomainSsoDetailsRequestJson import com.x8bit.bitwarden.data.auth.datasource.network.model.OrganizationDomainSsoDetailsResponseJson +import com.x8bit.bitwarden.data.auth.datasource.network.model.VerifiedOrganizationDomainSsoDetailsRequest +import com.x8bit.bitwarden.data.auth.datasource.network.model.VerifiedOrganizationDomainSsoDetailsResponse import retrofit2.http.Body import retrofit2.http.POST @@ -16,4 +18,12 @@ interface UnauthenticatedOrganizationApi { suspend fun getClaimedDomainOrganizationDetails( @Body body: OrganizationDomainSsoDetailsRequestJson, ): Result + + /** + * Checks for the verfied organization domains of an email for SSO purposes. + */ + @POST("/organizations/domain/sso/verified") + suspend fun getVerifiedOrganizationDomainsByEmail( + @Body body: VerifiedOrganizationDomainSsoDetailsRequest, + ): Result } diff --git a/app/src/main/java/com/x8bit/bitwarden/data/auth/datasource/network/model/OrganizationDomainSsoDetailsResponseJson.kt b/app/src/main/java/com/x8bit/bitwarden/data/auth/datasource/network/model/OrganizationDomainSsoDetailsResponseJson.kt index ad03c30f4..df4dc3806 100644 --- a/app/src/main/java/com/x8bit/bitwarden/data/auth/datasource/network/model/OrganizationDomainSsoDetailsResponseJson.kt +++ b/app/src/main/java/com/x8bit/bitwarden/data/auth/datasource/network/model/OrganizationDomainSsoDetailsResponseJson.kt @@ -1,16 +1,26 @@ package com.x8bit.bitwarden.data.auth.datasource.network.model +import kotlinx.serialization.Contextual import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable +import java.time.ZonedDateTime /** * Response object returned when requesting organization domain SSO details. * * @property isSsoAvailable Whether or not SSO is available for this domain. * @property organizationIdentifier The organization's identifier. + * @property verifiedDate The date the domain was verified. */ @Serializable data class OrganizationDomainSsoDetailsResponseJson( - @SerialName("ssoAvailable") val isSsoAvailable: Boolean, - @SerialName("organizationIdentifier") val organizationIdentifier: String, + @SerialName("ssoAvailable") + val isSsoAvailable: Boolean, + + @SerialName("organizationIdentifier") + val organizationIdentifier: String, + + @SerialName("verifiedDate") + @Contextual + val verifiedDate: ZonedDateTime?, ) diff --git a/app/src/main/java/com/x8bit/bitwarden/data/auth/datasource/network/model/VerifiedOrganizationDomainSsoDetailsRequest.kt b/app/src/main/java/com/x8bit/bitwarden/data/auth/datasource/network/model/VerifiedOrganizationDomainSsoDetailsRequest.kt new file mode 100644 index 000000000..653f1686a --- /dev/null +++ b/app/src/main/java/com/x8bit/bitwarden/data/auth/datasource/network/model/VerifiedOrganizationDomainSsoDetailsRequest.kt @@ -0,0 +1,14 @@ +package com.x8bit.bitwarden.data.auth.datasource.network.model + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +/** + * Request body object when retrieving organization verified domain SSO info. + * + * @param email The email address to check against. + */ +@Serializable +data class VerifiedOrganizationDomainSsoDetailsRequest( + @SerialName("email") val email: String, +) diff --git a/app/src/main/java/com/x8bit/bitwarden/data/auth/datasource/network/model/VerifiedOrganizationDomainSsoDetailsResponse.kt b/app/src/main/java/com/x8bit/bitwarden/data/auth/datasource/network/model/VerifiedOrganizationDomainSsoDetailsResponse.kt new file mode 100644 index 000000000..7f0337795 --- /dev/null +++ b/app/src/main/java/com/x8bit/bitwarden/data/auth/datasource/network/model/VerifiedOrganizationDomainSsoDetailsResponse.kt @@ -0,0 +1,35 @@ +package com.x8bit.bitwarden.data.auth.datasource.network.model + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +/** + * Response object returned when requesting organization verified domain SSO details. + * + * @property verifiedOrganizationDomainSsoDetails The list of verified organization domain SSO + * details. + */ +@Serializable +data class VerifiedOrganizationDomainSsoDetailsResponse( + @SerialName("data") + val verifiedOrganizationDomainSsoDetails: List, +) { + /** + * Response body for an organization verified domain SSO details. + * + * @property organizationName The name of the organization. + * @property organizationIdentifier The identifier of the organization. + * @property domainName The name of the domain. + */ + @Serializable + data class VerifiedOrganizationDomainSsoDetail( + @SerialName("organizationName") + val organizationName: String, + + @SerialName("organizationIdentifier") + val organizationIdentifier: String, + + @SerialName("domainName") + val domainName: String, + ) +} diff --git a/app/src/main/java/com/x8bit/bitwarden/data/auth/datasource/network/service/OrganizationService.kt b/app/src/main/java/com/x8bit/bitwarden/data/auth/datasource/network/service/OrganizationService.kt index d25d6765d..0febe90f8 100644 --- a/app/src/main/java/com/x8bit/bitwarden/data/auth/datasource/network/service/OrganizationService.kt +++ b/app/src/main/java/com/x8bit/bitwarden/data/auth/datasource/network/service/OrganizationService.kt @@ -3,6 +3,7 @@ package com.x8bit.bitwarden.data.auth.datasource.network.service import com.x8bit.bitwarden.data.auth.datasource.network.model.OrganizationAutoEnrollStatusResponseJson import com.x8bit.bitwarden.data.auth.datasource.network.model.OrganizationDomainSsoDetailsResponseJson import com.x8bit.bitwarden.data.auth.datasource.network.model.OrganizationKeysResponseJson +import com.x8bit.bitwarden.data.auth.datasource.network.model.VerifiedOrganizationDomainSsoDetailsResponse /** * Provides an API for querying organization endpoints. @@ -38,4 +39,12 @@ interface OrganizationService { suspend fun getOrganizationKeys( organizationId: String, ): Result + + /** + * Request organization verified domain details for an [email] needed for SSO + * requests. + */ + suspend fun getVerifiedOrganizationDomainSsoDetails( + email: String, + ): Result } diff --git a/app/src/main/java/com/x8bit/bitwarden/data/auth/datasource/network/service/OrganizationServiceImpl.kt b/app/src/main/java/com/x8bit/bitwarden/data/auth/datasource/network/service/OrganizationServiceImpl.kt index 8de08bd27..f4d857da9 100644 --- a/app/src/main/java/com/x8bit/bitwarden/data/auth/datasource/network/service/OrganizationServiceImpl.kt +++ b/app/src/main/java/com/x8bit/bitwarden/data/auth/datasource/network/service/OrganizationServiceImpl.kt @@ -7,6 +7,8 @@ import com.x8bit.bitwarden.data.auth.datasource.network.model.OrganizationDomain import com.x8bit.bitwarden.data.auth.datasource.network.model.OrganizationDomainSsoDetailsResponseJson import com.x8bit.bitwarden.data.auth.datasource.network.model.OrganizationKeysResponseJson import com.x8bit.bitwarden.data.auth.datasource.network.model.OrganizationResetPasswordEnrollRequestJson +import com.x8bit.bitwarden.data.auth.datasource.network.model.VerifiedOrganizationDomainSsoDetailsRequest +import com.x8bit.bitwarden.data.auth.datasource.network.model.VerifiedOrganizationDomainSsoDetailsResponse /** * Default implementation of [OrganizationService]. @@ -52,4 +54,13 @@ class OrganizationServiceImpl( .getOrganizationKeys( organizationId = organizationId, ) + + override suspend fun getVerifiedOrganizationDomainSsoDetails( + email: String, + ): Result = unauthenticatedOrganizationApi + .getVerifiedOrganizationDomainsByEmail( + body = VerifiedOrganizationDomainSsoDetailsRequest( + email = email, + ), + ) } diff --git a/app/src/main/java/com/x8bit/bitwarden/data/auth/repository/AuthRepository.kt b/app/src/main/java/com/x8bit/bitwarden/data/auth/repository/AuthRepository.kt index fc316f28d..b9102b146 100644 --- a/app/src/main/java/com/x8bit/bitwarden/data/auth/repository/AuthRepository.kt +++ b/app/src/main/java/com/x8bit/bitwarden/data/auth/repository/AuthRepository.kt @@ -28,6 +28,7 @@ import com.x8bit.bitwarden.data.auth.repository.model.SwitchAccountResult import com.x8bit.bitwarden.data.auth.repository.model.UserState import com.x8bit.bitwarden.data.auth.repository.model.ValidatePasswordResult import com.x8bit.bitwarden.data.auth.repository.model.ValidatePinResult +import com.x8bit.bitwarden.data.auth.repository.model.VerifiedOrganizationDomainSsoDetailsResult import com.x8bit.bitwarden.data.auth.repository.model.VerifyOtpResult import com.x8bit.bitwarden.data.auth.repository.util.CaptchaCallbackTokenResult import com.x8bit.bitwarden.data.auth.repository.util.DuoCallbackTokenResult @@ -329,6 +330,13 @@ interface AuthRepository : AuthenticatorProvider, AuthRequestManager { email: String, ): OrganizationDomainSsoDetailsResult + /** + * Get the verified organization domain SSO details for the given [email]. + */ + suspend fun getVerifiedOrganizationDomainSsoDetails( + email: String, + ): VerifiedOrganizationDomainSsoDetailsResult + /** * Prevalidates the organization identifier used in an SSO request. */ 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 88f22b081..bc76f5131 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 @@ -68,6 +68,7 @@ import com.x8bit.bitwarden.data.auth.repository.model.UserState import com.x8bit.bitwarden.data.auth.repository.model.ValidatePasswordResult import com.x8bit.bitwarden.data.auth.repository.model.ValidatePinResult import com.x8bit.bitwarden.data.auth.repository.model.VaultUnlockType +import com.x8bit.bitwarden.data.auth.repository.model.VerifiedOrganizationDomainSsoDetailsResult import com.x8bit.bitwarden.data.auth.repository.model.VerifyOtpResult import com.x8bit.bitwarden.data.auth.repository.model.toLoginErrorResult import com.x8bit.bitwarden.data.auth.repository.util.CaptchaCallbackTokenResult @@ -1123,11 +1124,27 @@ class AuthRepositoryImpl( OrganizationDomainSsoDetailsResult.Success( isSsoAvailable = it.isSsoAvailable, organizationIdentifier = it.organizationIdentifier, + verifiedDate = it.verifiedDate, ) }, onFailure = { OrganizationDomainSsoDetailsResult.Failure }, ) + override suspend fun getVerifiedOrganizationDomainSsoDetails( + email: String, + ): VerifiedOrganizationDomainSsoDetailsResult = organizationService + .getVerifiedOrganizationDomainSsoDetails( + email = email, + ) + .fold( + onSuccess = { + VerifiedOrganizationDomainSsoDetailsResult.Success( + verifiedOrganizationDomainSsoDetails = it.verifiedOrganizationDomainSsoDetails, + ) + }, + onFailure = { VerifiedOrganizationDomainSsoDetailsResult.Failure }, + ) + override suspend fun prevalidateSso( organizationIdentifier: String, ): PrevalidateSsoResult = identityService diff --git a/app/src/main/java/com/x8bit/bitwarden/data/auth/repository/model/OrganizationDomainSsoDetailsResult.kt b/app/src/main/java/com/x8bit/bitwarden/data/auth/repository/model/OrganizationDomainSsoDetailsResult.kt index 27bdcc399..70afde04f 100644 --- a/app/src/main/java/com/x8bit/bitwarden/data/auth/repository/model/OrganizationDomainSsoDetailsResult.kt +++ b/app/src/main/java/com/x8bit/bitwarden/data/auth/repository/model/OrganizationDomainSsoDetailsResult.kt @@ -1,5 +1,7 @@ package com.x8bit.bitwarden.data.auth.repository.model +import java.time.ZonedDateTime + /** * Response types when checking for an email's claimed domain organization. */ @@ -9,10 +11,12 @@ sealed class OrganizationDomainSsoDetailsResult { * * @property isSsoAvailable Indicates if SSO is available for the email address. * @property organizationIdentifier The claimed organization identifier for the email address. + * @property verifiedDate The date and time when the domain was verified. */ data class Success( val isSsoAvailable: Boolean, val organizationIdentifier: String, + val verifiedDate: ZonedDateTime?, ) : OrganizationDomainSsoDetailsResult() /** diff --git a/app/src/main/java/com/x8bit/bitwarden/data/auth/repository/model/VerifiedOrganizationDomainSsoDetailsResult.kt b/app/src/main/java/com/x8bit/bitwarden/data/auth/repository/model/VerifiedOrganizationDomainSsoDetailsResult.kt new file mode 100644 index 000000000..bab873666 --- /dev/null +++ b/app/src/main/java/com/x8bit/bitwarden/data/auth/repository/model/VerifiedOrganizationDomainSsoDetailsResult.kt @@ -0,0 +1,22 @@ +package com.x8bit.bitwarden.data.auth.repository.model + +import com.x8bit.bitwarden.data.auth.datasource.network.model.VerifiedOrganizationDomainSsoDetailsResponse.VerifiedOrganizationDomainSsoDetail + +/** + * Response types when checking for an email's claimed domain organization. + */ +sealed class VerifiedOrganizationDomainSsoDetailsResult { + /** + * The request was successful. + * + * @property verifiedOrganizationDomainSsoDetails The verified organization domain SSO details. + */ + data class Success( + val verifiedOrganizationDomainSsoDetails: List, + ) : VerifiedOrganizationDomainSsoDetailsResult() + + /** + * The request failed. + */ + data object Failure : VerifiedOrganizationDomainSsoDetailsResult() +} diff --git a/app/src/main/java/com/x8bit/bitwarden/data/autofill/accessibility/di/ActivityAccessibilityModule.kt b/app/src/main/java/com/x8bit/bitwarden/data/autofill/accessibility/di/ActivityAccessibilityModule.kt index 33ddff1f5..636a6d15d 100644 --- a/app/src/main/java/com/x8bit/bitwarden/data/autofill/accessibility/di/ActivityAccessibilityModule.kt +++ b/app/src/main/java/com/x8bit/bitwarden/data/autofill/accessibility/di/ActivityAccessibilityModule.kt @@ -5,7 +5,7 @@ import androidx.lifecycle.LifecycleCoroutineScope import com.x8bit.bitwarden.data.autofill.accessibility.manager.AccessibilityActivityManager import com.x8bit.bitwarden.data.autofill.accessibility.manager.AccessibilityActivityManagerImpl import com.x8bit.bitwarden.data.autofill.accessibility.manager.AccessibilityEnabledManager -import com.x8bit.bitwarden.data.platform.manager.AppForegroundManager +import com.x8bit.bitwarden.data.platform.manager.AppStateManager import dagger.Module import dagger.Provides import dagger.hilt.InstallIn @@ -24,13 +24,13 @@ object ActivityAccessibilityModule { fun providesAccessibilityActivityManager( @ApplicationContext context: Context, accessibilityEnabledManager: AccessibilityEnabledManager, - appForegroundManager: AppForegroundManager, + appStateManager: AppStateManager, lifecycleScope: LifecycleCoroutineScope, ): AccessibilityActivityManager = AccessibilityActivityManagerImpl( context = context, accessibilityEnabledManager = accessibilityEnabledManager, - appForegroundManager = appForegroundManager, + appStateManager = appStateManager, lifecycleScope = lifecycleScope, ) } diff --git a/app/src/main/java/com/x8bit/bitwarden/data/autofill/accessibility/manager/AccessibilityActivityManagerImpl.kt b/app/src/main/java/com/x8bit/bitwarden/data/autofill/accessibility/manager/AccessibilityActivityManagerImpl.kt index 62670454b..0777298b6 100644 --- a/app/src/main/java/com/x8bit/bitwarden/data/autofill/accessibility/manager/AccessibilityActivityManagerImpl.kt +++ b/app/src/main/java/com/x8bit/bitwarden/data/autofill/accessibility/manager/AccessibilityActivityManagerImpl.kt @@ -3,7 +3,7 @@ package com.x8bit.bitwarden.data.autofill.accessibility.manager import android.content.Context import androidx.lifecycle.LifecycleCoroutineScope import com.x8bit.bitwarden.data.autofill.accessibility.util.isAccessibilityServiceEnabled -import com.x8bit.bitwarden.data.platform.manager.AppForegroundManager +import com.x8bit.bitwarden.data.platform.manager.AppStateManager import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.onEach @@ -13,11 +13,11 @@ import kotlinx.coroutines.flow.onEach class AccessibilityActivityManagerImpl( private val context: Context, private val accessibilityEnabledManager: AccessibilityEnabledManager, - appForegroundManager: AppForegroundManager, + appStateManager: AppStateManager, lifecycleScope: LifecycleCoroutineScope, ) : AccessibilityActivityManager { init { - appForegroundManager + appStateManager .appForegroundStateFlow .onEach { accessibilityEnabledManager.isAccessibilityEnabled = diff --git a/app/src/main/java/com/x8bit/bitwarden/data/autofill/di/ActivityAutofillModule.kt b/app/src/main/java/com/x8bit/bitwarden/data/autofill/di/ActivityAutofillModule.kt index e5d4cba3b..2a63df444 100644 --- a/app/src/main/java/com/x8bit/bitwarden/data/autofill/di/ActivityAutofillModule.kt +++ b/app/src/main/java/com/x8bit/bitwarden/data/autofill/di/ActivityAutofillModule.kt @@ -8,7 +8,7 @@ import androidx.lifecycle.lifecycleScope import com.x8bit.bitwarden.data.autofill.manager.AutofillActivityManager import com.x8bit.bitwarden.data.autofill.manager.AutofillActivityManagerImpl import com.x8bit.bitwarden.data.autofill.manager.AutofillEnabledManager -import com.x8bit.bitwarden.data.platform.manager.AppForegroundManager +import com.x8bit.bitwarden.data.platform.manager.AppStateManager import dagger.Module import dagger.Provides import dagger.hilt.InstallIn @@ -27,13 +27,13 @@ object ActivityAutofillModule { @Provides fun provideAutofillActivityManager( @ActivityScopedManager autofillManager: AutofillManager, - appForegroundManager: AppForegroundManager, + appStateManager: AppStateManager, autofillEnabledManager: AutofillEnabledManager, lifecycleScope: LifecycleCoroutineScope, ): AutofillActivityManager = AutofillActivityManagerImpl( autofillManager = autofillManager, - appForegroundManager = appForegroundManager, + appStateManager = appStateManager, autofillEnabledManager = autofillEnabledManager, lifecycleScope = lifecycleScope, ) diff --git a/app/src/main/java/com/x8bit/bitwarden/data/autofill/manager/AutofillActivityManagerImpl.kt b/app/src/main/java/com/x8bit/bitwarden/data/autofill/manager/AutofillActivityManagerImpl.kt index e01a7713d..154be4db9 100644 --- a/app/src/main/java/com/x8bit/bitwarden/data/autofill/manager/AutofillActivityManagerImpl.kt +++ b/app/src/main/java/com/x8bit/bitwarden/data/autofill/manager/AutofillActivityManagerImpl.kt @@ -2,7 +2,7 @@ package com.x8bit.bitwarden.data.autofill.manager import android.view.autofill.AutofillManager import androidx.lifecycle.LifecycleCoroutineScope -import com.x8bit.bitwarden.data.platform.manager.AppForegroundManager +import com.x8bit.bitwarden.data.platform.manager.AppStateManager import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.onEach @@ -12,7 +12,7 @@ import kotlinx.coroutines.flow.onEach class AutofillActivityManagerImpl( private val autofillManager: AutofillManager, private val autofillEnabledManager: AutofillEnabledManager, - appForegroundManager: AppForegroundManager, + appStateManager: AppStateManager, lifecycleScope: LifecycleCoroutineScope, ) : AutofillActivityManager { private val isAutofillEnabledAndSupported: Boolean @@ -21,7 +21,7 @@ class AutofillActivityManagerImpl( autofillManager.isAutofillSupported init { - appForegroundManager + appStateManager .appForegroundStateFlow .onEach { autofillEnabledManager.isAutofillEnabled = isAutofillEnabledAndSupported } .launchIn(lifecycleScope) diff --git a/app/src/main/java/com/x8bit/bitwarden/data/platform/manager/AppForegroundManager.kt b/app/src/main/java/com/x8bit/bitwarden/data/platform/manager/AppForegroundManager.kt deleted file mode 100644 index 268842c5f..000000000 --- a/app/src/main/java/com/x8bit/bitwarden/data/platform/manager/AppForegroundManager.kt +++ /dev/null @@ -1,15 +0,0 @@ -package com.x8bit.bitwarden.data.platform.manager - -import com.x8bit.bitwarden.data.platform.manager.model.AppForegroundState -import kotlinx.coroutines.flow.StateFlow - -/** - * A manager for tracking app foreground state changes. - */ -interface AppForegroundManager { - - /** - * Emits whenever there are changes to the app foreground state. - */ - val appForegroundStateFlow: StateFlow -} diff --git a/app/src/main/java/com/x8bit/bitwarden/data/platform/manager/AppForegroundManagerImpl.kt b/app/src/main/java/com/x8bit/bitwarden/data/platform/manager/AppForegroundManagerImpl.kt deleted file mode 100644 index 3f0a51075..000000000 --- a/app/src/main/java/com/x8bit/bitwarden/data/platform/manager/AppForegroundManagerImpl.kt +++ /dev/null @@ -1,36 +0,0 @@ -package com.x8bit.bitwarden.data.platform.manager - -import androidx.lifecycle.DefaultLifecycleObserver -import androidx.lifecycle.LifecycleOwner -import androidx.lifecycle.ProcessLifecycleOwner -import com.x8bit.bitwarden.data.platform.manager.model.AppForegroundState -import kotlinx.coroutines.flow.MutableStateFlow -import kotlinx.coroutines.flow.StateFlow -import kotlinx.coroutines.flow.asStateFlow - -/** - * Primary implementation of [AppForegroundManager]. - */ -class AppForegroundManagerImpl( - processLifecycleOwner: LifecycleOwner = ProcessLifecycleOwner.get(), -) : AppForegroundManager { - private val mutableAppForegroundStateFlow = - MutableStateFlow(AppForegroundState.BACKGROUNDED) - - override val appForegroundStateFlow: StateFlow - get() = mutableAppForegroundStateFlow.asStateFlow() - - init { - processLifecycleOwner.lifecycle.addObserver( - object : DefaultLifecycleObserver { - override fun onStart(owner: LifecycleOwner) { - mutableAppForegroundStateFlow.value = AppForegroundState.FOREGROUNDED - } - - override fun onStop(owner: LifecycleOwner) { - mutableAppForegroundStateFlow.value = AppForegroundState.BACKGROUNDED - } - }, - ) - } -} diff --git a/app/src/main/java/com/x8bit/bitwarden/data/platform/manager/AppStateManager.kt b/app/src/main/java/com/x8bit/bitwarden/data/platform/manager/AppStateManager.kt new file mode 100644 index 000000000..7bf69d039 --- /dev/null +++ b/app/src/main/java/com/x8bit/bitwarden/data/platform/manager/AppStateManager.kt @@ -0,0 +1,24 @@ +package com.x8bit.bitwarden.data.platform.manager + +import com.x8bit.bitwarden.data.autofill.accessibility.BitwardenAccessibilityService +import com.x8bit.bitwarden.data.platform.manager.model.AppCreationState +import com.x8bit.bitwarden.data.platform.manager.model.AppForegroundState +import kotlinx.coroutines.flow.StateFlow + +/** + * A manager for tracking app foreground state changes. + */ +interface AppStateManager { + /** + * Emits whenever there are changes to the app creation state. + * + * This is required because the [BitwardenAccessibilityService] will keep the app process alive + * when the app would otherwise be destroyed. + */ + val appCreatedStateFlow: StateFlow + + /** + * Emits whenever there are changes to the app foreground state. + */ + val appForegroundStateFlow: StateFlow +} diff --git a/app/src/main/java/com/x8bit/bitwarden/data/platform/manager/AppStateManagerImpl.kt b/app/src/main/java/com/x8bit/bitwarden/data/platform/manager/AppStateManagerImpl.kt new file mode 100644 index 000000000..4baa775c0 --- /dev/null +++ b/app/src/main/java/com/x8bit/bitwarden/data/platform/manager/AppStateManagerImpl.kt @@ -0,0 +1,72 @@ +package com.x8bit.bitwarden.data.platform.manager + +import android.app.Activity +import android.app.Application +import android.os.Bundle +import androidx.lifecycle.DefaultLifecycleObserver +import androidx.lifecycle.LifecycleOwner +import androidx.lifecycle.ProcessLifecycleOwner +import com.x8bit.bitwarden.data.platform.manager.model.AppCreationState +import com.x8bit.bitwarden.data.platform.manager.model.AppForegroundState +import kotlinx.coroutines.flow.MutableStateFlow +import kotlinx.coroutines.flow.StateFlow +import kotlinx.coroutines.flow.asStateFlow + +/** + * Primary implementation of [AppStateManager]. + */ +class AppStateManagerImpl( + application: Application, + processLifecycleOwner: LifecycleOwner = ProcessLifecycleOwner.get(), +) : AppStateManager { + private val mutableAppCreationStateFlow = MutableStateFlow(AppCreationState.DESTROYED) + private val mutableAppForegroundStateFlow = MutableStateFlow(AppForegroundState.BACKGROUNDED) + + override val appCreatedStateFlow: StateFlow + get() = mutableAppCreationStateFlow.asStateFlow() + + override val appForegroundStateFlow: StateFlow + get() = mutableAppForegroundStateFlow.asStateFlow() + + init { + application.registerActivityLifecycleCallbacks(AppCreationCallback()) + processLifecycleOwner.lifecycle.addObserver(AppForegroundObserver()) + } + + private inner class AppForegroundObserver : DefaultLifecycleObserver { + override fun onStart(owner: LifecycleOwner) { + mutableAppForegroundStateFlow.value = AppForegroundState.FOREGROUNDED + } + + override fun onStop(owner: LifecycleOwner) { + mutableAppForegroundStateFlow.value = AppForegroundState.BACKGROUNDED + } + } + + private inner class AppCreationCallback : Application.ActivityLifecycleCallbacks { + private var activityCount: Int = 0 + + override fun onActivityCreated(activity: Activity, savedInstanceState: Bundle?) { + activityCount++ + // Always be in a created state if we have an activity + mutableAppCreationStateFlow.value = AppCreationState.CREATED + } + + override fun onActivityDestroyed(activity: Activity) { + activityCount-- + if (activityCount == 0 && !activity.isChangingConfigurations) { + mutableAppCreationStateFlow.value = AppCreationState.DESTROYED + } + } + + override fun onActivityStarted(activity: Activity) = Unit + + override fun onActivityResumed(activity: Activity) = Unit + + override fun onActivityPaused(activity: Activity) = Unit + + override fun onActivityStopped(activity: Activity) = Unit + + override fun onActivitySaveInstanceState(activity: Activity, outState: Bundle) = Unit + } +} 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 ce53e923d..b962ccb8f 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 @@ -14,8 +14,8 @@ import com.x8bit.bitwarden.data.platform.datasource.network.authenticator.Refres import com.x8bit.bitwarden.data.platform.datasource.network.interceptor.BaseUrlInterceptors import com.x8bit.bitwarden.data.platform.datasource.network.service.EventService import com.x8bit.bitwarden.data.platform.datasource.network.service.PushService -import com.x8bit.bitwarden.data.platform.manager.AppForegroundManager -import com.x8bit.bitwarden.data.platform.manager.AppForegroundManagerImpl +import com.x8bit.bitwarden.data.platform.manager.AppStateManager +import com.x8bit.bitwarden.data.platform.manager.AppStateManagerImpl import com.x8bit.bitwarden.data.platform.manager.AssetManager import com.x8bit.bitwarden.data.platform.manager.AssetManagerImpl import com.x8bit.bitwarden.data.platform.manager.BiometricsEncryptionManager @@ -80,8 +80,9 @@ object PlatformManagerModule { @Provides @Singleton - fun provideAppForegroundManager(): AppForegroundManager = - AppForegroundManagerImpl() + fun provideAppStateManager( + application: Application, + ): AppStateManager = AppStateManagerImpl(application = application) @Provides @Singleton @@ -267,11 +268,11 @@ object PlatformManagerModule { @Singleton fun provideRestrictionManager( @ApplicationContext context: Context, - appForegroundManager: AppForegroundManager, + appStateManager: AppStateManager, dispatcherManager: DispatcherManager, environmentRepository: EnvironmentRepository, ): RestrictionManager = RestrictionManagerImpl( - appForegroundManager = appForegroundManager, + appStateManager = appStateManager, dispatcherManager = dispatcherManager, context = context, environmentRepository = environmentRepository, diff --git a/app/src/main/java/com/x8bit/bitwarden/data/platform/manager/model/AppCreationState.kt b/app/src/main/java/com/x8bit/bitwarden/data/platform/manager/model/AppCreationState.kt new file mode 100644 index 000000000..e5bb388c9 --- /dev/null +++ b/app/src/main/java/com/x8bit/bitwarden/data/platform/manager/model/AppCreationState.kt @@ -0,0 +1,16 @@ +package com.x8bit.bitwarden.data.platform.manager.model + +/** + * Represents the creation state of the app. + */ +enum class AppCreationState { + /** + * Denotes that the app is currently created. + */ + CREATED, + + /** + * Denotes that the app is currently destroyed. + */ + DESTROYED, +} diff --git a/app/src/main/java/com/x8bit/bitwarden/data/platform/manager/model/FlagKey.kt b/app/src/main/java/com/x8bit/bitwarden/data/platform/manager/model/FlagKey.kt index 861711879..60d81bd42 100644 --- a/app/src/main/java/com/x8bit/bitwarden/data/platform/manager/model/FlagKey.kt +++ b/app/src/main/java/com/x8bit/bitwarden/data/platform/manager/model/FlagKey.kt @@ -32,6 +32,7 @@ sealed class FlagKey { OnboardingCarousel, ImportLoginsFlow, SshKeyCipherItems, + VerifiedSsoDomainEndpoint, ) } } @@ -89,6 +90,14 @@ sealed class FlagKey { override val defaultValue: Boolean = false override val isRemotelyConfigured: Boolean = true } + /** + * Data object holding the feature flag key for the new verified SSO domain endpoint feature. + */ + data object VerifiedSsoDomainEndpoint : FlagKey() { + override val keyName: String = "pm-12337-refactor-sso-details-endpoint" + override val defaultValue: Boolean = false + override val isRemotelyConfigured: Boolean = true + } /** * Data object holding the key for a [Boolean] flag to be used in tests. diff --git a/app/src/main/java/com/x8bit/bitwarden/data/platform/manager/restriction/RestrictionManagerImpl.kt b/app/src/main/java/com/x8bit/bitwarden/data/platform/manager/restriction/RestrictionManagerImpl.kt index 4f75d8d75..cac5655c4 100644 --- a/app/src/main/java/com/x8bit/bitwarden/data/platform/manager/restriction/RestrictionManagerImpl.kt +++ b/app/src/main/java/com/x8bit/bitwarden/data/platform/manager/restriction/RestrictionManagerImpl.kt @@ -6,7 +6,7 @@ import android.content.Intent import android.content.IntentFilter import android.content.RestrictionsManager import android.os.Bundle -import com.x8bit.bitwarden.data.platform.manager.AppForegroundManager +import com.x8bit.bitwarden.data.platform.manager.AppStateManager import com.x8bit.bitwarden.data.platform.manager.dispatcher.DispatcherManager import com.x8bit.bitwarden.data.platform.manager.model.AppForegroundState import com.x8bit.bitwarden.data.platform.repository.EnvironmentRepository @@ -19,7 +19,7 @@ import kotlinx.coroutines.flow.onEach * The default implementation of the [RestrictionManager]. */ class RestrictionManagerImpl( - appForegroundManager: AppForegroundManager, + appStateManager: AppStateManager, dispatcherManager: DispatcherManager, private val context: Context, private val environmentRepository: EnvironmentRepository, @@ -31,7 +31,7 @@ class RestrictionManagerImpl( private var isReceiverRegistered = false init { - appForegroundManager + appStateManager .appForegroundStateFlow .onEach { when (it) { diff --git a/app/src/main/java/com/x8bit/bitwarden/data/platform/util/StringExtensions.kt b/app/src/main/java/com/x8bit/bitwarden/data/platform/util/StringExtensions.kt index 909cb2ef5..cfb84dbb8 100644 --- a/app/src/main/java/com/x8bit/bitwarden/data/platform/util/StringExtensions.kt +++ b/app/src/main/java/com/x8bit/bitwarden/data/platform/util/StringExtensions.kt @@ -56,6 +56,7 @@ fun String.getWebHostFromAndroidUriOrNull(): String? = fun String.getDomainOrNull(resourceCacheManager: ResourceCacheManager): String? = this .toUriOrNull() + ?.addSchemeToUriIfNecessary() ?.parseDomainOrNull(resourceCacheManager = resourceCacheManager) /** @@ -63,7 +64,10 @@ fun String.getDomainOrNull(resourceCacheManager: ResourceCacheManager): String? */ @OmitFromCoverage fun String.hasPort(): Boolean { - val uri = this.toUriOrNull() ?: return false + val uri = this + .toUriOrNull() + ?.addSchemeToUriIfNecessary() + ?: return false return uri.port != -1 } @@ -71,14 +75,19 @@ fun String.hasPort(): Boolean { * Extract the host from this [String] if possible, otherwise return null. */ @OmitFromCoverage -fun String.getHostOrNull(): String? = this.toUriOrNull()?.host +fun String.getHostOrNull(): String? = this.toUriOrNull() + ?.addSchemeToUriIfNecessary() + ?.host /** * Extract the host with optional port from this [String] if possible, otherwise return null. */ @OmitFromCoverage fun String.getHostWithPortOrNull(): String? { - val uri = this.toUriOrNull() ?: return null + val uri = this + .toUriOrNull() + ?.addSchemeToUriIfNecessary() + ?: return null return uri.host?.let { host -> val port = uri.port if (port != -1) { 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 1d6647222..eb96af197 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 @@ -45,6 +45,27 @@ fun URI.parseDomainNameOrNull(resourceCacheManager: ResourceCacheManager): Domai ) } +/** + * Adds and HTTPS scheme to a valid URI if that URI has a valid host in the raw string but + * the standard parsing of `URI("foo.com")` is not able to determine a valid host. + * (i.e. val uri = URI("foo.bar:1090") -> uri.host == null) + */ +fun URI.addSchemeToUriIfNecessary(): URI { + val uriString = this.toString() + return if ( + // see if the string contains a host pattern + uriString.contains(".") && + // if it does but the URI's host is null, add an https scheme + this.host == null && + // provided that scheme does not exist already. + !uriString.hasHttpProtocol() + ) { + URI("https://$uriString") + } else { + this + } +} + /** * The internal implementation of [parseDomainNameOrNull]. This doesn't extend URI and has a * non-null [host] parameter. Technically, URI.host could be null and we want to avoid issues with 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 41189cb87..1320c2ca3 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 @@ -12,8 +12,9 @@ import com.x8bit.bitwarden.data.auth.manager.UserLogoutManager import com.x8bit.bitwarden.data.auth.repository.util.toSdkParams import com.x8bit.bitwarden.data.auth.repository.util.userAccountTokens import com.x8bit.bitwarden.data.auth.repository.util.userSwitchingChangesFlow -import com.x8bit.bitwarden.data.platform.manager.AppForegroundManager +import com.x8bit.bitwarden.data.platform.manager.AppStateManager import com.x8bit.bitwarden.data.platform.manager.dispatcher.DispatcherManager +import com.x8bit.bitwarden.data.platform.manager.model.AppCreationState import com.x8bit.bitwarden.data.platform.manager.model.AppForegroundState import com.x8bit.bitwarden.data.platform.repository.SettingsRepository import com.x8bit.bitwarden.data.platform.repository.model.VaultTimeout @@ -65,7 +66,7 @@ class VaultLockManagerImpl( private val authSdkSource: AuthSdkSource, private val vaultSdkSource: VaultSdkSource, private val settingsRepository: SettingsRepository, - private val appForegroundManager: AppForegroundManager, + private val appStateManager: AppStateManager, private val userLogoutManager: UserLogoutManager, private val trustedDeviceManager: TrustedDeviceManager, dispatcherManager: DispatcherManager, @@ -90,6 +91,7 @@ class VaultLockManagerImpl( get() = mutableVaultStateEventSharedFlow.asSharedFlow() init { + observeAppCreationChanges() observeAppForegroundChanges() observeUserSwitchingChanges() observeVaultTimeoutChanges() @@ -302,10 +304,31 @@ class VaultLockManagerImpl( } } + private fun observeAppCreationChanges() { + appStateManager + .appCreatedStateFlow + .onEach { appCreationState -> + when (appCreationState) { + AppCreationState.CREATED -> Unit + AppCreationState.DESTROYED -> handleOnDestroyed() + } + } + .launchIn(unconfinedScope) + } + + private fun handleOnDestroyed() { + activeUserId?.let { userId -> + checkForVaultTimeout( + userId = userId, + checkTimeoutReason = CheckTimeoutReason.APP_RESTARTED, + ) + } + } + private fun observeAppForegroundChanges() { var isFirstForeground = true - appForegroundManager + appStateManager .appForegroundStateFlow .onEach { appForegroundState -> when (appForegroundState) { diff --git a/app/src/main/java/com/x8bit/bitwarden/data/vault/manager/di/VaultManagerModule.kt b/app/src/main/java/com/x8bit/bitwarden/data/vault/manager/di/VaultManagerModule.kt index 519ea6fc3..18ca9ebf2 100644 --- a/app/src/main/java/com/x8bit/bitwarden/data/vault/manager/di/VaultManagerModule.kt +++ b/app/src/main/java/com/x8bit/bitwarden/data/vault/manager/di/VaultManagerModule.kt @@ -5,7 +5,7 @@ import com.x8bit.bitwarden.data.auth.datasource.disk.AuthDiskSource import com.x8bit.bitwarden.data.auth.datasource.sdk.AuthSdkSource import com.x8bit.bitwarden.data.auth.manager.TrustedDeviceManager import com.x8bit.bitwarden.data.auth.manager.UserLogoutManager -import com.x8bit.bitwarden.data.platform.manager.AppForegroundManager +import com.x8bit.bitwarden.data.platform.manager.AppStateManager import com.x8bit.bitwarden.data.platform.manager.dispatcher.DispatcherManager import com.x8bit.bitwarden.data.platform.repository.SettingsRepository import com.x8bit.bitwarden.data.vault.datasource.disk.VaultDiskSource @@ -72,7 +72,7 @@ object VaultManagerModule { authSdkSource: AuthSdkSource, vaultSdkSource: VaultSdkSource, settingsRepository: SettingsRepository, - appForegroundManager: AppForegroundManager, + appStateManager: AppStateManager, userLogoutManager: UserLogoutManager, dispatcherManager: DispatcherManager, trustedDeviceManager: TrustedDeviceManager, @@ -82,7 +82,7 @@ object VaultManagerModule { authSdkSource = authSdkSource, vaultSdkSource = vaultSdkSource, settingsRepository = settingsRepository, - appForegroundManager = appForegroundManager, + appStateManager = appStateManager, userLogoutManager = userLogoutManager, dispatcherManager = dispatcherManager, trustedDeviceManager = trustedDeviceManager, diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/enterprisesignon/EnterpriseSignOnViewModel.kt b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/enterprisesignon/EnterpriseSignOnViewModel.kt index 243c61327..1ae84ce2a 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/enterprisesignon/EnterpriseSignOnViewModel.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/auth/feature/enterprisesignon/EnterpriseSignOnViewModel.kt @@ -9,12 +9,15 @@ import com.x8bit.bitwarden.data.auth.repository.AuthRepository import com.x8bit.bitwarden.data.auth.repository.model.LoginResult import com.x8bit.bitwarden.data.auth.repository.model.OrganizationDomainSsoDetailsResult import com.x8bit.bitwarden.data.auth.repository.model.PrevalidateSsoResult +import com.x8bit.bitwarden.data.auth.repository.model.VerifiedOrganizationDomainSsoDetailsResult import com.x8bit.bitwarden.data.auth.repository.util.CaptchaCallbackTokenResult import com.x8bit.bitwarden.data.auth.repository.util.SSO_URI import com.x8bit.bitwarden.data.auth.repository.util.SsoCallbackResult import com.x8bit.bitwarden.data.auth.repository.util.generateUriForCaptcha import com.x8bit.bitwarden.data.auth.repository.util.generateUriForSso +import com.x8bit.bitwarden.data.platform.manager.FeatureFlagManager import com.x8bit.bitwarden.data.platform.manager.NetworkConnectionManager +import com.x8bit.bitwarden.data.platform.manager.model.FlagKey import com.x8bit.bitwarden.data.platform.repository.EnvironmentRepository import com.x8bit.bitwarden.data.platform.repository.util.baseIdentityUrl import com.x8bit.bitwarden.data.tools.generator.repository.GeneratorRepository @@ -43,6 +46,7 @@ private const val RANDOM_STRING_LENGTH = 64 class EnterpriseSignOnViewModel @Inject constructor( private val authRepository: AuthRepository, private val environmentRepository: EnvironmentRepository, + private val featureFlagManager: FeatureFlagManager, private val generatorRepository: GeneratorRepository, private val networkConnectionManager: NetworkConnectionManager, private val savedStateHandle: SavedStateHandle, @@ -123,6 +127,10 @@ class EnterpriseSignOnViewModel @Inject constructor( is EnterpriseSignOnAction.Internal.OnReceiveCaptchaToken -> { handleOnReceiveCaptchaToken(action) } + + is EnterpriseSignOnAction.Internal.OnVerifiedOrganizationDomainSsoDetailsReceive -> { + handleOnVerifiedOrganizationDomainSsoDetailsReceive(action) + } } } @@ -209,6 +217,54 @@ class EnterpriseSignOnViewModel @Inject constructor( } } + private fun handleOnVerifiedOrganizationDomainSsoDetailsReceive( + action: EnterpriseSignOnAction.Internal.OnVerifiedOrganizationDomainSsoDetailsReceive, + ) { + when (val orgDetails = action.verifiedOrgDomainSsoDetailsResult) { + is VerifiedOrganizationDomainSsoDetailsResult.Failure -> { + mutableStateFlow.update { + it.copy( + dialogState = null, + orgIdentifierInput = authRepository.rememberedOrgIdentifier ?: "", + ) + } + } + + is VerifiedOrganizationDomainSsoDetailsResult.Success -> { + handleOnVerifiedOrganizationDomainSsoDetailsSuccess(orgDetails) + } + } + } + + private fun handleOnVerifiedOrganizationDomainSsoDetailsSuccess( + orgDetails: VerifiedOrganizationDomainSsoDetailsResult.Success, + ) { + if (orgDetails.verifiedOrganizationDomainSsoDetails.isEmpty()) { + mutableStateFlow.update { + it.copy( + dialogState = null, + orgIdentifierInput = authRepository.rememberedOrgIdentifier ?: "", + ) + } + return + } + + val organizationIdentifier = orgDetails + .verifiedOrganizationDomainSsoDetails + .first() + .organizationIdentifier + + mutableStateFlow.update { + it.copy( + orgIdentifierInput = organizationIdentifier, + ) + } + + // If the email address is associated with a claimed organization we can proceed to the + // prevalidation step. + prevalidateSso() + } + private fun handleOnOrganizationDomainSsoDetailsReceive( action: EnterpriseSignOnAction.Internal.OnOrganizationDomainSsoDetailsReceive, ) { @@ -226,7 +282,7 @@ class EnterpriseSignOnViewModel @Inject constructor( private fun handleOnOrganizationDomainSsoDetailsSuccess( orgDetails: OrganizationDomainSsoDetailsResult.Success, ) { - if (!orgDetails.isSsoAvailable) { + if (!orgDetails.isSsoAvailable || orgDetails.verifiedDate == null) { mutableStateFlow.update { it.copy( dialogState = null, @@ -375,12 +431,23 @@ class EnterpriseSignOnViewModel @Inject constructor( ) } viewModelScope.launch { - val result = authRepository.getOrganizationDomainSsoDetails( - email = EnterpriseSignOnArgs(savedStateHandle).emailAddress, - ) - sendAction( - EnterpriseSignOnAction.Internal.OnOrganizationDomainSsoDetailsReceive(result), - ) + if (featureFlagManager.getFeatureFlag(key = FlagKey.VerifiedSsoDomainEndpoint)) { + val result = authRepository.getVerifiedOrganizationDomainSsoDetails( + email = EnterpriseSignOnArgs(savedStateHandle).emailAddress, + ) + sendAction( + EnterpriseSignOnAction.Internal.OnVerifiedOrganizationDomainSsoDetailsReceive( + result, + ), + ) + } else { + val result = authRepository.getOrganizationDomainSsoDetails( + email = EnterpriseSignOnArgs(savedStateHandle).emailAddress, + ) + sendAction( + EnterpriseSignOnAction.Internal.OnOrganizationDomainSsoDetailsReceive(result), + ) + } } } @@ -561,6 +628,13 @@ sealed class EnterpriseSignOnAction { * A captcha callback result has been received */ data class OnReceiveCaptchaToken(val tokenResult: CaptchaCallbackTokenResult) : Internal() + + /** + * A result was received when requesting an [VerifiedOrganizationDomainSsoDetailsResult]. + */ + data class OnVerifiedOrganizationDomainSsoDetailsReceive( + val verifiedOrgDomainSsoDetailsResult: VerifiedOrganizationDomainSsoDetailsResult, + ) : Internal() } } diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/bottomsheet/BitwardenModalBottomSheet.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/bottomsheet/BitwardenModalBottomSheet.kt index 505b6b445..85956def3 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/bottomsheet/BitwardenModalBottomSheet.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/components/bottomsheet/BitwardenModalBottomSheet.kt @@ -9,6 +9,7 @@ import androidx.compose.material3.SheetState import androidx.compose.material3.TopAppBarDefaults import androidx.compose.material3.rememberModalBottomSheetState import androidx.compose.runtime.Composable +import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.ui.Modifier import androidx.compose.ui.input.nestedscroll.nestedScroll import androidx.compose.ui.res.stringResource @@ -19,6 +20,7 @@ import com.x8bit.bitwarden.ui.platform.components.appbar.NavigationIcon import com.x8bit.bitwarden.ui.platform.components.scaffold.BitwardenScaffold import com.x8bit.bitwarden.ui.platform.components.util.rememberVectorPainter import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme +import kotlinx.coroutines.launch /** * A reusable modal bottom sheet that applies provides a bottom sheet layout with the @@ -28,11 +30,12 @@ import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme * @param sheetTitle The title to display in the [BitwardenTopAppBar] * @param onDismiss The action to perform when the bottom sheet is dismissed will also be performed * when the "close" icon is clicked, caller must handle any desired animation or hiding of the - * bottom sheet. + * bottom sheet. This will be invoked _after_ the sheet has been animated away. * @param showBottomSheet Whether or not to show the bottom sheet, by default this is true assuming * the showing/hiding will be handled by the caller. * @param sheetContent Content to display in the bottom sheet. The content is passed the padding - * from the containing [BitwardenScaffold]. + * from the containing [BitwardenScaffold] and a `onDismiss` lambda to be used for manual dismissal + * that will include the dismissal animation. */ @OptIn(ExperimentalMaterial3Api::class) @Composable @@ -42,7 +45,10 @@ fun BitwardenModalBottomSheet( modifier: Modifier = Modifier, showBottomSheet: Boolean = true, sheetState: SheetState = rememberModalBottomSheetState(), - sheetContent: @Composable (PaddingValues) -> Unit, + sheetContent: @Composable ( + paddingValues: PaddingValues, + animatedOnDismiss: () -> Unit, + ) -> Unit, ) { if (!showBottomSheet) return ModalBottomSheet( @@ -56,13 +62,14 @@ fun BitwardenModalBottomSheet( shape = BitwardenTheme.shapes.bottomSheet, ) { val scrollBehavior = TopAppBarDefaults.pinnedScrollBehavior() + val animatedOnDismiss = sheetState.createAnimatedDismissAction(onDismiss = onDismiss) BitwardenScaffold( topBar = { BitwardenTopAppBar( title = sheetTitle, navigationIcon = NavigationIcon( navigationIcon = rememberVectorPainter(R.drawable.ic_close), - onNavigationIconClick = onDismiss, + onNavigationIconClick = animatedOnDismiss, navigationIconContentDescription = stringResource(R.string.close), ), scrollBehavior = scrollBehavior, @@ -73,7 +80,18 @@ fun BitwardenModalBottomSheet( .nestedScroll(scrollBehavior.nestedScrollConnection) .fillMaxSize(), ) { paddingValues -> - sheetContent(paddingValues) + sheetContent(paddingValues, animatedOnDismiss) } } } + +@OptIn(ExperimentalMaterial3Api::class) +@Composable +private fun SheetState.createAnimatedDismissAction(onDismiss: () -> Unit): () -> Unit { + val scope = rememberCoroutineScope() + return { + scope + .launch { this@createAnimatedDismissAction.hide() } + .invokeOnCompletion { onDismiss() } + } +} 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 26b276ccb..98e7342db 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 @@ -28,6 +28,7 @@ fun FlagKey.ListItemContent( FlagKey.OnboardingFlow, FlagKey.ImportLoginsFlow, FlagKey.SshKeyCipherItems, + FlagKey.VerifiedSsoDomainEndpoint, -> BooleanFlagItem( label = flagKey.getDisplayLabel(), key = flagKey as FlagKey, @@ -71,4 +72,5 @@ private fun FlagKey.getDisplayLabel(): String = when (this) { FlagKey.OnboardingFlow -> stringResource(R.string.onboarding_flow) FlagKey.ImportLoginsFlow -> stringResource(R.string.import_logins_flow) FlagKey.SshKeyCipherItems -> stringResource(R.string.ssh_key_cipher_item_types) + FlagKey.VerifiedSsoDomainEndpoint -> stringResource(R.string.verified_sso_domain_verified) } diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/pendingrequests/PendingRequestsScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/pendingrequests/PendingRequestsScreen.kt index 52d58190e..f38b56f25 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/pendingrequests/PendingRequestsScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/pendingrequests/PendingRequestsScreen.kt @@ -1,5 +1,8 @@ package com.x8bit.bitwarden.ui.platform.feature.settings.accountsecurity.pendingrequests +import android.Manifest +import android.annotation.SuppressLint +import android.os.Build import android.widget.Toast import androidx.compose.foundation.Image import androidx.compose.foundation.clickable @@ -14,6 +17,7 @@ import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.navigationBarsPadding import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size +import androidx.compose.foundation.layout.statusBarsPadding import androidx.compose.foundation.lazy.LazyColumn import androidx.compose.foundation.lazy.items import androidx.compose.foundation.rememberScrollState @@ -21,6 +25,7 @@ import androidx.compose.foundation.verticalScroll import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.Text import androidx.compose.material3.TopAppBarDefaults +import androidx.compose.material3.rememberModalBottomSheetState import androidx.compose.material3.rememberTopAppBarState import androidx.compose.material3.ripple import androidx.compose.runtime.Composable @@ -40,11 +45,15 @@ import androidx.hilt.navigation.compose.hiltViewModel import androidx.lifecycle.Lifecycle import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.x8bit.bitwarden.R +import com.x8bit.bitwarden.data.platform.util.isBuildVersionBelow +import com.x8bit.bitwarden.data.platform.util.isFdroid import com.x8bit.bitwarden.ui.platform.base.util.EventsEffect import com.x8bit.bitwarden.ui.platform.base.util.LivecycleEventEffect import com.x8bit.bitwarden.ui.platform.base.util.bottomDivider import com.x8bit.bitwarden.ui.platform.base.util.standardHorizontalMargin import com.x8bit.bitwarden.ui.platform.components.appbar.BitwardenTopAppBar +import com.x8bit.bitwarden.ui.platform.components.bottomsheet.BitwardenModalBottomSheet +import com.x8bit.bitwarden.ui.platform.components.button.BitwardenFilledButton import com.x8bit.bitwarden.ui.platform.components.button.BitwardenOutlinedButton import com.x8bit.bitwarden.ui.platform.components.content.BitwardenErrorContent import com.x8bit.bitwarden.ui.platform.components.content.BitwardenLoadingContent @@ -52,6 +61,8 @@ import com.x8bit.bitwarden.ui.platform.components.dialog.BitwardenTwoButtonDialo import com.x8bit.bitwarden.ui.platform.components.scaffold.BitwardenScaffold import com.x8bit.bitwarden.ui.platform.components.scaffold.rememberBitwardenPullToRefreshState import com.x8bit.bitwarden.ui.platform.components.util.rememberVectorPainter +import com.x8bit.bitwarden.ui.platform.composition.LocalPermissionsManager +import com.x8bit.bitwarden.ui.platform.manager.permissions.PermissionsManager import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme /** @@ -62,6 +73,7 @@ import com.x8bit.bitwarden.ui.platform.theme.BitwardenTheme @Composable fun PendingRequestsScreen( viewModel: PendingRequestsViewModel = hiltViewModel(), + permissionsManager: PermissionsManager = LocalPermissionsManager.current, onNavigateBack: () -> Unit, onNavigateToLoginApproval: (fingerprint: String) -> Unit, ) { @@ -98,6 +110,29 @@ fun PendingRequestsScreen( } } + val hideBottomSheet = state.hideBottomSheet || + isFdroid || + isBuildVersionBelow(Build.VERSION_CODES.TIRAMISU) || + permissionsManager.checkPermission(Manifest.permission.POST_NOTIFICATIONS) || + !permissionsManager.shouldShowRequestPermissionRationale( + permission = Manifest.permission.POST_NOTIFICATIONS, + ) + BitwardenModalBottomSheet( + showBottomSheet = !hideBottomSheet, + sheetTitle = stringResource(R.string.enable_notifications), + onDismiss = remember(viewModel) { + { viewModel.trySendAction(PendingRequestsAction.HideBottomSheet) } + }, + sheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true), + modifier = Modifier.statusBarsPadding(), + ) { paddingValues, animatedOnDismiss -> + PendingRequestsBottomSheetContent( + modifier = Modifier.padding(paddingValues), + permissionsManager = permissionsManager, + onDismiss = animatedOnDismiss, + ) + } + val scrollBehavior = TopAppBarDefaults.pinnedScrollBehavior(rememberTopAppBarState()) BitwardenScaffold( modifier = Modifier @@ -338,3 +373,68 @@ private fun PendingRequestsEmpty( Spacer(modifier = Modifier.height(64.dp)) } } + +@Composable +private fun PendingRequestsBottomSheetContent( + permissionsManager: PermissionsManager, + onDismiss: () -> Unit, + modifier: Modifier = Modifier, +) { + val notificationPermissionLauncher = permissionsManager.getLauncher { + onDismiss() + } + Column(modifier = modifier.verticalScroll(rememberScrollState())) { + Spacer(modifier = Modifier.height(height = 24.dp)) + Image( + painter = rememberVectorPainter(id = R.drawable.img_2fa), + contentDescription = null, + modifier = Modifier + .standardHorizontalMargin() + .size(size = 132.dp) + .align(alignment = Alignment.CenterHorizontally), + ) + Spacer(modifier = Modifier.height(height = 24.dp)) + Text( + text = stringResource(id = R.string.log_in_quickly_and_easily_across_devices), + style = BitwardenTheme.typography.titleMedium, + color = BitwardenTheme.colorScheme.text.primary, + textAlign = TextAlign.Center, + modifier = Modifier + .fillMaxWidth() + .standardHorizontalMargin(), + ) + Spacer(modifier = Modifier.height(height = 12.dp)) + @Suppress("MaxLineLength") + Text( + text = stringResource( + id = R.string.bitwarden_can_notify_you_each_time_you_receive_a_new_login_request_from_another_device, + ), + style = BitwardenTheme.typography.bodyMedium, + color = BitwardenTheme.colorScheme.text.primary, + textAlign = TextAlign.Center, + modifier = Modifier + .fillMaxWidth() + .standardHorizontalMargin(), + ) + Spacer(modifier = Modifier.height(height = 24.dp)) + BitwardenFilledButton( + label = stringResource(id = R.string.enable_notifications), + onClick = { + @SuppressLint("InlinedApi") + notificationPermissionLauncher.launch(Manifest.permission.POST_NOTIFICATIONS) + }, + modifier = Modifier + .fillMaxWidth() + .standardHorizontalMargin(), + ) + Spacer(modifier = Modifier.height(height = 12.dp)) + BitwardenOutlinedButton( + label = stringResource(id = R.string.skip_for_now), + onClick = onDismiss, + modifier = Modifier + .fillMaxWidth() + .standardHorizontalMargin(), + ) + Spacer(modifier = Modifier.navigationBarsPadding()) + } +} diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/pendingrequests/PendingRequestsViewModel.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/pendingrequests/PendingRequestsViewModel.kt index f4ac92d24..812b952eb 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/pendingrequests/PendingRequestsViewModel.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/pendingrequests/PendingRequestsViewModel.kt @@ -27,6 +27,7 @@ private const val KEY_STATE = "state" /** * View model for the pending login requests screen. */ +@Suppress("TooManyFunctions") @HiltViewModel class PendingRequestsViewModel @Inject constructor( private val clock: Clock, @@ -39,6 +40,7 @@ class PendingRequestsViewModel @Inject constructor( viewState = PendingRequestsState.ViewState.Loading, isPullToRefreshSettingEnabled = settingsRepository.getPullToRefreshEnabledFlow().value, isRefreshing = false, + hideBottomSheet = false, ), ) { private var authJob: Job = Job().apply { complete() } @@ -56,6 +58,7 @@ class PendingRequestsViewModel @Inject constructor( when (action) { PendingRequestsAction.CloseClick -> handleCloseClicked() PendingRequestsAction.DeclineAllRequestsConfirm -> handleDeclineAllRequestsConfirmed() + PendingRequestsAction.HideBottomSheet -> handleHideBottomSheet() PendingRequestsAction.LifecycleResume -> handleOnLifecycleResumed() PendingRequestsAction.RefreshPull -> handleRefreshPull() is PendingRequestsAction.PendingRequestRowClick -> { @@ -89,6 +92,10 @@ class PendingRequestsViewModel @Inject constructor( } } + private fun handleHideBottomSheet() { + mutableStateFlow.update { it.copy(hideBottomSheet = true) } + } + private fun handleOnLifecycleResumed() { updateAuthRequestList() } @@ -193,6 +200,7 @@ data class PendingRequestsState( val viewState: ViewState, private val isPullToRefreshSettingEnabled: Boolean, val isRefreshing: Boolean, + val hideBottomSheet: Boolean, ) : Parcelable { /** * Indicates that the pull-to-refresh should be enabled in the UI. @@ -297,6 +305,11 @@ sealed class PendingRequestsAction { */ data object DeclineAllRequestsConfirm : PendingRequestsAction() + /** + * The user has dismissed the bottom sheet. + */ + data object HideBottomSheet : PendingRequestsAction() + /** * The screen has been re-opened and should be updated. */ diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/manager/intent/IntentManagerImpl.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/manager/intent/IntentManagerImpl.kt index e53088032..3902676e6 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/manager/intent/IntentManagerImpl.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/manager/intent/IntentManagerImpl.kt @@ -6,6 +6,7 @@ import android.content.ActivityNotFoundException import android.content.ComponentName import android.content.Context import android.content.Intent +import android.content.IntentSender import android.content.pm.PackageManager import android.net.Uri import android.os.Build @@ -27,6 +28,7 @@ import com.x8bit.bitwarden.MainActivity import com.x8bit.bitwarden.R import com.x8bit.bitwarden.data.autofill.util.toPendingIntentMutabilityFlag import com.x8bit.bitwarden.data.platform.annotation.OmitFromCoverage +import com.x8bit.bitwarden.data.platform.util.isBuildVersionBelow import com.x8bit.bitwarden.ui.platform.util.toFormattedPattern import java.io.File import java.time.Clock @@ -82,7 +84,7 @@ class IntentManagerImpl( override fun startActivity(intent: Intent) { try { context.startActivity(intent) - } catch (e: ActivityNotFoundException) { + } catch (_: ActivityNotFoundException) { // no-op } } @@ -115,7 +117,7 @@ class IntentManagerImpl( } context.startActivity(intent) true - } catch (e: ActivityNotFoundException) { + } catch (_: ActivityNotFoundException) { false } @@ -132,12 +134,28 @@ class IntentManagerImpl( } override fun launchUri(uri: Uri) { - val newUri = if (uri.scheme == null) { - uri.buildUpon().scheme("https").build() + if (uri.scheme.equals(other = "androidapp", ignoreCase = true)) { + val packageName = uri.toString().removePrefix(prefix = "androidapp://") + if (isBuildVersionBelow(Build.VERSION_CODES.TIRAMISU)) { + startActivity(createPlayStoreIntent(packageName)) + } else { + try { + context + .packageManager + .getLaunchIntentSenderForPackage(packageName) + .sendIntent(context, Activity.RESULT_OK, null, null, null) + } catch (_: IntentSender.SendIntentException) { + startActivity(createPlayStoreIntent(packageName)) + } + } } else { - uri.normalizeScheme() + val newUri = if (uri.scheme == null) { + uri.buildUpon().scheme("https").build() + } else { + uri.normalizeScheme() + } + startActivity(Intent(Intent.ACTION_VIEW, newUri)) } - startActivity(Intent(Intent.ACTION_VIEW, newUri)) } override fun shareText(text: String) { @@ -301,6 +319,15 @@ class IntentManagerImpl( startActivity(intent) } + private fun createPlayStoreIntent(packageName: String): Intent { + val playStoreUri = "https://play.google.com/store/apps/details" + .toUri() + .buildUpon() + .appendQueryParameter("id", packageName) + .build() + return Intent(Intent.ACTION_VIEW, playStoreUri) + } + private fun getCameraFileData(): IntentManager.FileData { val tmpDir = File(context.filesDir, TEMP_CAMERA_IMAGE_DIR) val file = File(tmpDir, TEMP_CAMERA_IMAGE_NAME) diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/manager/snackbar/SnackbarRelayManager.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/manager/snackbar/SnackbarRelayManager.kt index cf341c3c4..1b7e809b9 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/manager/snackbar/SnackbarRelayManager.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/manager/snackbar/SnackbarRelayManager.kt @@ -19,4 +19,9 @@ interface SnackbarRelayManager { * the [relay] to receive the data from. */ fun getSnackbarDataFlow(relay: SnackbarRelay): Flow + + /** + * Clears the buffer for the given [relay]. + */ + fun clearRelayBuffer(relay: SnackbarRelay) } diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/platform/manager/snackbar/SnackbarRelayManagerImpl.kt b/app/src/main/java/com/x8bit/bitwarden/ui/platform/manager/snackbar/SnackbarRelayManagerImpl.kt index 83cfae46f..22ef37765 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/platform/manager/snackbar/SnackbarRelayManagerImpl.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/platform/manager/snackbar/SnackbarRelayManagerImpl.kt @@ -2,6 +2,7 @@ package com.x8bit.bitwarden.ui.platform.manager.snackbar import com.x8bit.bitwarden.data.platform.repository.util.bufferedMutableSharedFlow import com.x8bit.bitwarden.ui.platform.components.snackbar.BitwardenSnackbarData +import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.MutableSharedFlow import kotlinx.coroutines.flow.filterNotNull @@ -26,6 +27,11 @@ class SnackbarRelayManagerImpl : SnackbarRelayManager { } .filterNotNull() + @OptIn(ExperimentalCoroutinesApi::class) + override fun clearRelayBuffer(relay: SnackbarRelay) { + getSnackbarDataFlowInternal(relay).resetReplayCache() + } + private fun getSnackbarDataFlowInternal( relay: SnackbarRelay, ): MutableSharedFlow = diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/addedit/VaultAddEditScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/addedit/VaultAddEditScreen.kt index 2bf3d550c..23a778d30 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/addedit/VaultAddEditScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/addedit/VaultAddEditScreen.kt @@ -314,7 +314,7 @@ fun VaultAddEditScreen( text = stringResource(id = R.string.delete), onClick = { pendingDeleteCipher = true }, ) - .takeUnless { state.isAddItemMode }, + .takeUnless { state.isAddItemMode || !state.canDelete }, ), ) }, diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/addedit/VaultAddEditViewModel.kt b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/addedit/VaultAddEditViewModel.kt index fd7dfb4ae..c33374100 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/addedit/VaultAddEditViewModel.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/addedit/VaultAddEditViewModel.kt @@ -149,7 +149,9 @@ class VaultAddEditViewModel @Inject constructor( attestationOptions = fido2AttestationOptions, isIndividualVaultDisabled = isIndividualVaultDisabled, ) - ?: totpData?.toDefaultAddTypeContent(isIndividualVaultDisabled) + ?: totpData?.toDefaultAddTypeContent( + isIndividualVaultDisabled = isIndividualVaultDisabled, + ) ?: VaultAddEditState.ViewState.Content( common = VaultAddEditState.ViewState.Content.Common(), isIndividualVaultDisabled = isIndividualVaultDisabled, @@ -1589,6 +1591,16 @@ class VaultAddEditViewModel @Inject constructor( currentAccount = userData?.activeAccount, vaultAddEditType = vaultAddEditType, ) { currentAccount, cipherView -> + val canDelete = vaultData.collectionViewList + .none { + val itemIsInCollection = cipherView + ?.collectionIds + ?.contains(it.id) == true + + val canManageCollection = it.manage + + itemIsInCollection && !canManageCollection + } // Derive the view state from the current Cipher for Edit mode // or use the current state for Add (cipherView @@ -1598,6 +1610,7 @@ class VaultAddEditViewModel @Inject constructor( totpData = totpData, resourceManager = resourceManager, clock = clock, + canDelete = canDelete, ) ?: viewState) .appendFolderAndOwnerData( @@ -2026,6 +2039,15 @@ data class VaultAddEditState( */ val isCloneMode: Boolean get() = vaultAddEditType is VaultAddEditType.CloneItem + /** + * Helper to determine if the UI should allow deletion of this item. + */ + val canDelete: Boolean + get() = (viewState as? ViewState.Content) + ?.common + ?.canDelete + ?: false + /** * Enum representing the main type options for the vault, such as LOGIN, CARD, etc. * @@ -2085,6 +2107,7 @@ data class VaultAddEditState( * @property selectedOwnerId The ID of the owner associated with the item. * @property availableOwners A list of available owners. * @property hasOrganizations Indicates if the user is part of any organizations. + * @property canDelete Indicates whether the current user can delete the item. */ @Parcelize data class Common( @@ -2101,6 +2124,7 @@ data class VaultAddEditState( val selectedOwnerId: String? = null, val availableOwners: List = emptyList(), val hasOrganizations: Boolean = false, + val canDelete: Boolean = true, ) : Parcelable { /** diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/addedit/util/CipherViewExtensions.kt b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/addedit/util/CipherViewExtensions.kt index a68834588..c401ee77c 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/addedit/util/CipherViewExtensions.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/addedit/util/CipherViewExtensions.kt @@ -35,13 +35,14 @@ private const val PASSKEY_CREATION_TIME_PATTERN: String = "hh:mm a" /** * Transforms [CipherView] into [VaultAddEditState.ViewState]. */ -@Suppress("LongMethod") +@Suppress("LongMethod", "LongParameterList") fun CipherView.toViewState( isClone: Boolean, isIndividualVaultDisabled: Boolean, totpData: TotpData?, resourceManager: ResourceManager, clock: Clock, + canDelete: Boolean, ): VaultAddEditState.ViewState = VaultAddEditState.ViewState.Content( type = when (type) { @@ -108,6 +109,7 @@ fun CipherView.toViewState( availableOwners = emptyList(), hasOrganizations = false, customFieldData = this.fields.orEmpty().map { it.toCustomField() }, + canDelete = canDelete, ), isIndividualVaultDisabled = isIndividualVaultDisabled, ) diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/importlogins/ImportLoginsScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/importlogins/ImportLoginsScreen.kt index 4afe42fa8..e41ddeae4 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/importlogins/ImportLoginsScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/importlogins/ImportLoginsScreen.kt @@ -23,7 +23,6 @@ import androidx.compose.material3.rememberModalBottomSheetState import androidx.compose.material3.rememberTopAppBarState import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue -import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.input.nestedscroll.nestedScroll @@ -65,7 +64,6 @@ import com.x8bit.bitwarden.ui.vault.feature.importlogins.handlers.ImportLoginHan import com.x8bit.bitwarden.ui.vault.feature.importlogins.handlers.rememberImportLoginHandler import com.x8bit.bitwarden.ui.vault.feature.importlogins.model.InstructionStep import kotlinx.collections.immutable.persistentListOf -import kotlinx.coroutines.launch private const val IMPORT_HELP_URL = "https://bitwarden.com/help/import-data/" @@ -100,27 +98,15 @@ fun ImportLoginsScreen( } } - val sheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true) - val scope = rememberCoroutineScope() - val hideSheetAndExecuteCompleteImportLogins: () -> Unit = { - // This pattern mirrors the onDismissRequest handling in the material ModalBottomSheet - scope - .launch { - sheetState.hide() - } - .invokeOnCompletion { - handler.onSuccessfulSyncAcknowledged() - } - } BitwardenModalBottomSheet( showBottomSheet = state.showBottomSheet, sheetTitle = stringResource(R.string.bitwarden_tools), - onDismiss = hideSheetAndExecuteCompleteImportLogins, + onDismiss = handler.onSuccessfulSyncAcknowledged, sheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true), modifier = Modifier.statusBarsPadding(), - ) { paddingValues -> + ) { paddingValues, animatedOnDismiss -> ImportLoginsSuccessBottomSheetContent( - onCompleteImportLogins = hideSheetAndExecuteCompleteImportLogins, + onCompleteImportLogins = animatedOnDismiss, modifier = Modifier.padding(paddingValues), ) } diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/item/VaultItemScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/item/VaultItemScreen.kt index 63011234f..c16a9a3de 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/item/VaultItemScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/item/VaultItemScreen.kt @@ -226,7 +226,8 @@ fun VaultItemScreen( ) } }, - ), + ) + .takeIf { state.canDelete }, ), ) }, diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/item/VaultItemViewModel.kt b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/item/VaultItemViewModel.kt index b3623dbdc..29bb1affb 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/item/VaultItemViewModel.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/item/VaultItemViewModel.kt @@ -82,7 +82,8 @@ class VaultItemViewModel @Inject constructor( vaultRepository.getVaultItemStateFlow(state.vaultItemId), authRepository.userStateFlow, vaultRepository.getAuthCodeFlow(state.vaultItemId), - ) { cipherViewState, userState, authCodeState -> + vaultRepository.collectionsStateFlow, + ) { cipherViewState, userState, authCodeState, collectionsState -> val totpCodeData = authCodeState.data?.let { TotpCodeItemData( periodSeconds = it.periodSeconds, @@ -96,14 +97,30 @@ class VaultItemViewModel @Inject constructor( vaultDataState = combineDataStates( cipherViewState, authCodeState, - ) { _, _ -> + collectionsState, + ) { _, _, _ -> // We are only combining the DataStates to know the overall state, // we map it to the appropriate value below. } .mapNullable { + // Deletion is not allowed when the item is in a collection that the user + // does not have "manage" permission for. + val canDelete = collectionsState.data + ?.none { + val itemIsInCollection = cipherViewState.data + ?.collectionIds + ?.contains(it.id) == true + + val canManageCollection = it.manage + + itemIsInCollection && !canManageCollection + } + ?: true + VaultItemStateData( cipher = cipherViewState.data, totpCodeItemData = totpCodeData, + canDelete = canDelete, ) }, ) @@ -915,6 +932,7 @@ class VaultItemViewModel @Inject constructor( isPremiumUser = account.isPremium, hasMasterPassword = account.hasMasterPassword, totpCodeItemData = this.data?.totpCodeItemData, + canDelete = this.data?.canDelete == true, ) ?: VaultItemState.ViewState.Error(message = errorText) @@ -1153,6 +1171,14 @@ data class VaultItemState( ?.isNotEmpty() ?: false + /** + * Whether or not the cipher can be deleted. + */ + val canDelete: Boolean + get() = viewState.asContentOrNull() + ?.common + ?.canDelete == true + /** * The text to display on the deletion confirmation dialog. */ @@ -1216,6 +1242,7 @@ data class VaultItemState( @IgnoredOnParcel val currentCipher: CipherView? = null, val attachments: List?, + val canDelete: Boolean, ) : Parcelable { /** diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/item/model/VaultItemStateData.kt b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/item/model/VaultItemStateData.kt index 91d3ba2a5..1f7c9d43b 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/item/model/VaultItemStateData.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/item/model/VaultItemStateData.kt @@ -11,4 +11,5 @@ import com.bitwarden.vault.CipherView data class VaultItemStateData( val cipher: CipherView?, val totpCodeItemData: TotpCodeItemData?, + val canDelete: Boolean, ) diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/item/util/CipherViewExtensions.kt b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/item/util/CipherViewExtensions.kt index e4c46f592..565f600a9 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/item/util/CipherViewExtensions.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/item/util/CipherViewExtensions.kt @@ -32,13 +32,14 @@ private const val FIDO2_CREDENTIAL_CREATION_TIME_PATTERN: String = "h:mm a" /** * Transforms [VaultData] into [VaultState.ViewState]. */ -@Suppress("CyclomaticComplexMethod", "LongMethod") +@Suppress("CyclomaticComplexMethod", "LongMethod", "LongParameterList") fun CipherView.toViewState( previousState: VaultItemState.ViewState.Content?, isPremiumUser: Boolean, hasMasterPassword: Boolean, totpCodeItemData: TotpCodeItemData?, clock: Clock = Clock.systemDefaultZone(), + canDelete: Boolean, ): VaultItemState.ViewState = VaultItemState.ViewState.Content( common = VaultItemState.ViewState.Content.Common( @@ -79,6 +80,7 @@ fun CipherView.toViewState( } } .orEmpty(), + canDelete = canDelete, ), type = when (type) { CipherType.LOGIN -> { diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/vault/VaultScreen.kt b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/vault/VaultScreen.kt index 0bbded82d..04f3c078a 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/vault/VaultScreen.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/vault/VaultScreen.kt @@ -1,7 +1,5 @@ package com.x8bit.bitwarden.ui.vault.feature.vault -import android.Manifest -import android.annotation.SuppressLint import android.widget.Toast import androidx.compose.animation.AnimatedVisibility import androidx.compose.animation.scaleIn @@ -15,7 +13,6 @@ import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.TopAppBarDefaults import androidx.compose.material3.rememberTopAppBarState import androidx.compose.runtime.Composable -import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember @@ -61,11 +58,9 @@ import com.x8bit.bitwarden.ui.platform.components.snackbar.rememberBitwardenSnac import com.x8bit.bitwarden.ui.platform.components.util.rememberVectorPainter import com.x8bit.bitwarden.ui.platform.composition.LocalExitManager import com.x8bit.bitwarden.ui.platform.composition.LocalIntentManager -import com.x8bit.bitwarden.ui.platform.composition.LocalPermissionsManager import com.x8bit.bitwarden.ui.platform.feature.search.model.SearchType import com.x8bit.bitwarden.ui.platform.manager.exit.ExitManager import com.x8bit.bitwarden.ui.platform.manager.intent.IntentManager -import com.x8bit.bitwarden.ui.platform.manager.permissions.PermissionsManager import com.x8bit.bitwarden.ui.platform.manager.snackbar.SnackbarRelay import com.x8bit.bitwarden.ui.vault.feature.itemlisting.model.ListingItemOverflowAction import com.x8bit.bitwarden.ui.vault.feature.vault.handlers.VaultHandlers @@ -90,7 +85,6 @@ fun VaultScreen( onNavigateToImportLogins: (SnackbarRelay) -> Unit, exitManager: ExitManager = LocalExitManager.current, intentManager: IntentManager = LocalIntentManager.current, - permissionsManager: PermissionsManager = LocalPermissionsManager.current, ) { val state by viewModel.stateFlow.collectAsStateWithLifecycle() val context = LocalContext.current @@ -137,10 +131,6 @@ fun VaultScreen( } } val vaultHandlers = remember(viewModel) { VaultHandlers.create(viewModel) } - VaultScreenPushNotifications( - hideNotificationsDialog = state.hideNotificationsDialog, - permissionsManager = permissionsManager, - ) VaultScreenScaffold( state = state, pullToRefreshState = pullToRefreshState, @@ -150,28 +140,6 @@ fun VaultScreen( ) } -/** - * Handles the notifications permission request. - */ -@Composable -private fun VaultScreenPushNotifications( - hideNotificationsDialog: Boolean, - permissionsManager: PermissionsManager, -) { - if (hideNotificationsDialog) return - val launcher = permissionsManager.getLauncher { - // We do not actually care what the response is, we just need - // to give the user a chance to give us the permission. - } - LaunchedEffect(key1 = Unit) { - @SuppressLint("InlinedApi") - // We check the version code as part of the 'hideNotificationsDialog' property. - if (!permissionsManager.checkPermission(Manifest.permission.POST_NOTIFICATIONS)) { - launcher.launch(Manifest.permission.POST_NOTIFICATIONS) - } - } -} - /** * Scaffold for the [VaultScreen] */ diff --git a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/vault/VaultViewModel.kt b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/vault/VaultViewModel.kt index 879701c60..dff036ac9 100644 --- a/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/vault/VaultViewModel.kt +++ b/app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/vault/VaultViewModel.kt @@ -1,6 +1,5 @@ package com.x8bit.bitwarden.ui.vault.feature.vault -import android.os.Build import android.os.Parcelable import androidx.compose.ui.graphics.Color import androidx.lifecycle.viewModelScope @@ -19,8 +18,6 @@ import com.x8bit.bitwarden.data.platform.manager.model.OrganizationEvent import com.x8bit.bitwarden.data.platform.repository.SettingsRepository import com.x8bit.bitwarden.data.platform.repository.model.DataState import com.x8bit.bitwarden.data.platform.repository.util.baseIconUrl -import com.x8bit.bitwarden.data.platform.util.isBuildVersionBelow -import com.x8bit.bitwarden.data.platform.util.isFdroid import com.x8bit.bitwarden.data.vault.datasource.network.model.PolicyTypeJson import com.x8bit.bitwarden.data.vault.repository.VaultRepository import com.x8bit.bitwarden.data.vault.repository.model.GenerateTotpResult @@ -76,8 +73,8 @@ class VaultViewModel @Inject constructor( private val settingsRepository: SettingsRepository, private val vaultRepository: VaultRepository, private val firstTimeActionManager: FirstTimeActionManager, + private val snackbarRelayManager: SnackbarRelayManager, featureFlagManager: FeatureFlagManager, - snackbarRelayManager: SnackbarRelayManager, ) : BaseViewModel( initialState = run { val userState = requireNotNull(authRepository.userStateFlow.value) @@ -102,7 +99,6 @@ class VaultViewModel @Inject constructor( isPullToRefreshSettingEnabled = settingsRepository.getPullToRefreshEnabledFlow().value, baseIconUrl = userState.activeAccount.environment.environmentUrlData.baseIconUrl, hasMasterPassword = userState.activeAccount.hasMasterPassword, - hideNotificationsDialog = isBuildVersionBelow(Build.VERSION_CODES.TIRAMISU) || isFdroid, isRefreshing = false, showImportActionCard = false, showSshKeys = showSshKeys, @@ -287,6 +283,9 @@ class VaultViewModel @Inject constructor( SwitchAccountResult.AccountSwitched -> true SwitchAccountResult.NoChange -> false } + if (isSwitchingAccounts) { + snackbarRelayManager.clearRelayBuffer(SnackbarRelay.MY_VAULT_RELAY) + } mutableStateFlow.update { it.copy(isSwitchingAccounts = isSwitchingAccounts) } @@ -713,7 +712,6 @@ data class VaultState( private val isPullToRefreshSettingEnabled: Boolean, val baseIconUrl: String, val isIconLoadingDisabled: Boolean, - val hideNotificationsDialog: Boolean, val isRefreshing: Boolean, val showImportActionCard: Boolean, val showSshKeys: Boolean, diff --git a/app/src/main/res/drawable-night/img_2fa.xml b/app/src/main/res/drawable-night/img_2fa.xml new file mode 100644 index 000000000..2f2753f58 --- /dev/null +++ b/app/src/main/res/drawable-night/img_2fa.xml @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/drawable/img_2fa.xml b/app/src/main/res/drawable/img_2fa.xml new file mode 100644 index 000000000..735a3c4a7 --- /dev/null +++ b/app/src/main/res/drawable/img_2fa.xml @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/values-af-rZA/strings.xml b/app/src/main/res/values-af-rZA/strings.xml index 15fd6dcbb..e7e5b03df 100644 --- a/app/src/main/res/values-af-rZA/strings.xml +++ b/app/src/main/res/values-af-rZA/strings.xml @@ -1001,7 +1001,7 @@ Wil u na die rekening omskakel? Please restart registration or try logging in. You may already have an account. Restart registration Authenticator Sync - Allow Bitwarden Authenticator Syncing + Allow authenticator syncing There was an issue validating the registration token. Turn on autofill Use autofill to log into your accounts with a single tap. @@ -1040,8 +1040,8 @@ Wil u na die rekening omskakel? Step 1 of 3 Export your saved logins You’ll delete this file after import is complete. - On your computer, open a new browser tab and go to vault.bitwarden.com - go to vault.bitwarden.com + On your computer, open a new browser tab and go to %1$s + go to %1$s Log in to the Bitwarden web app. Step 2 of 3 Log in to Bitwarden @@ -1055,7 +1055,7 @@ Wil u na die rekening omskakel? then Done For your security, be sure to delete your saved password file. delete your saved password file. - Need help? Checkout out import help. + Need help? Check out import help. import help Save the exported file somewhere on your computer you can find easily. Save the exported file @@ -1073,4 +1073,12 @@ Wil u na die rekening omskakel? Bitwarden Tools Got it No logins were imported + Logins imported + Remember to delete your imported password file from your computer + SSH key + Public key + Private key + SSH keys + Copy public key + Copy fingerprint diff --git a/app/src/main/res/values-ar-rSA/strings.xml b/app/src/main/res/values-ar-rSA/strings.xml index 9498417d4..74a19059c 100644 --- a/app/src/main/res/values-ar-rSA/strings.xml +++ b/app/src/main/res/values-ar-rSA/strings.xml @@ -1001,7 +1001,7 @@ Please restart registration or try logging in. You may already have an account. Restart registration Authenticator Sync - Allow Bitwarden Authenticator Syncing + Allow authenticator syncing There was an issue validating the registration token. Turn on autofill Use autofill to log into your accounts with a single tap. @@ -1040,8 +1040,8 @@ Step 1 of 3 Export your saved logins You’ll delete this file after import is complete. - On your computer, open a new browser tab and go to vault.bitwarden.com - go to vault.bitwarden.com + On your computer, open a new browser tab and go to %1$s + go to %1$s Log in to the Bitwarden web app. Step 2 of 3 Log in to Bitwarden @@ -1055,7 +1055,7 @@ then Done For your security, be sure to delete your saved password file. delete your saved password file. - Need help? Checkout out import help. + Need help? Check out import help. import help Save the exported file somewhere on your computer you can find easily. Save the exported file @@ -1073,4 +1073,12 @@ Bitwarden Tools Got it No logins were imported + Logins imported + Remember to delete your imported password file from your computer + SSH key + Public key + Private key + SSH keys + Copy public key + Copy fingerprint diff --git a/app/src/main/res/values-az-rAZ/strings.xml b/app/src/main/res/values-az-rAZ/strings.xml index 6d8a6eab0..36f55ab01 100644 --- a/app/src/main/res/values-az-rAZ/strings.xml +++ b/app/src/main/res/values-az-rAZ/strings.xml @@ -1054,7 +1054,7 @@ Bu hesaba keçmək istəyirsiniz? \"Hazırdır\"a toxunun Təhlükəsizliyiniz üçün saxlanılmış parol faylınızı sildiyinizə əmin olun. saxlanılmış parol faylınızı silin. - Kömək lazımdır? Daxilə köçürmə üzrə kömək səhifəmizə baxın. + Kömək lazımdır? Daxilə köçürmə üzrə kömək səhifəmizə baxın. daxilə köçürmə üzrə kömək Xaricə köçürdüyünüz faylı kompüterinizdə rahatlıqla tapa biləcəyiniz yerdə saxlayın. Xaricə köçürülən faylı saxlayın @@ -1071,5 +1071,13 @@ Bu hesaba keçmək istəyirsiniz? Bitwarden-in veb və masaüstü alətləri ilə istənilən yerdən girişlərinizi idarə edin. Bitwarden Alətləri Anladım - No logins were imported + Heç bir giriş daxilə köçürülmədi + Girişlər daxilə köçürüldü + Kompüterinizdən daxilə köçürdüyünüz parol faylını silməyi unutmayın + SSH açarı + Public açar + Private açar + SSH açarları + Copy public key + Copy fingerprint diff --git a/app/src/main/res/values-be-rBY/strings.xml b/app/src/main/res/values-be-rBY/strings.xml index 974ea4585..64ba828fd 100644 --- a/app/src/main/res/values-be-rBY/strings.xml +++ b/app/src/main/res/values-be-rBY/strings.xml @@ -1000,7 +1000,7 @@ Please restart registration or try logging in. You may already have an account. Restart registration Authenticator Sync - Allow Bitwarden Authenticator Syncing + Allow authenticator syncing There was an issue validating the registration token. Turn on autofill Use autofill to log into your accounts with a single tap. @@ -1039,8 +1039,8 @@ Step 1 of 3 Export your saved logins You’ll delete this file after import is complete. - On your computer, open a new browser tab and go to vault.bitwarden.com - go to vault.bitwarden.com + On your computer, open a new browser tab and go to %1$s + go to %1$s Log in to the Bitwarden web app. Step 2 of 3 Log in to Bitwarden @@ -1054,7 +1054,7 @@ then Done For your security, be sure to delete your saved password file. delete your saved password file. - Need help? Checkout out import help. + Need help? Check out import help. import help Save the exported file somewhere on your computer you can find easily. Save the exported file @@ -1072,4 +1072,12 @@ Bitwarden Tools Got it No logins were imported + Logins imported + Remember to delete your imported password file from your computer + SSH key + Public key + Private key + SSH keys + Copy public key + Copy fingerprint diff --git a/app/src/main/res/values-bg-rBG/strings.xml b/app/src/main/res/values-bg-rBG/strings.xml index 0bcd52fdf..bfd48a34d 100644 --- a/app/src/main/res/values-bg-rBG/strings.xml +++ b/app/src/main/res/values-bg-rBG/strings.xml @@ -1055,22 +1055,30 @@ а след това натиснете Готово За по-сигурно изтрийте файла със запазените пароли. изтрийте файла със запазените пароли. - Имате ли нужда от помощ? Прегледайте помощта относно внасянето. + Имате ли нужда от помощ? Прегледайте помощта относно внасянето. помощта относно внасянето Запазете изнесения файл някъде в компютъра си, така че да може да го намерите лесно. Запазете изнесения файл Това не изглежда да е познат сървър на Битуорден. Може да се наложи да го проверите при доставчика си или да обновите сървъра си. Синхронизиране на елементите за вписване… SSH Key Cipher Item Types - Download the browser extension - Go to bitwarden.com/download to integrate Bitwarden into your favorite browser for a seamless experience. - Use the web app - Log in at bitwarden.com to easily manage your account and update settings. - Autofill passwords - Set up autofill on all your devices to login with a single tap anywhere. - Import Successful! - Manage your logins from anywhere with Bitwarden tools for web and desktop. - Bitwarden Tools - Got it - No logins were imported + Свалете добавката за браузър + Посетете bitwarden.com/download, за да вградите Битуорден в любимия си браузър и да използвате възможностите му по-лесно. + Използвайте приложението по уеб + Впишете се в bitwarden.com, където можете лесно да управлявате регистрацията си и да променяте настройки. + Автоматично попълване на пароли + Настройте автоматичното попълвана на всички свои устройства, за да се вписвате навсякъде с едно докосване. + Внасянето е успешно! + Управлявайте данните си за вписване, където и да се намирате, с инструментите на Битуорден налични в уеб и настолното приложение. + Инструменти на Битуорден + Разбрано + Не бяха внесени никакви елементи за вписване + Данните за вписване са внесени + Не забравяйте да изтриете файла с паролите за внасяне от компютъра си + SSH ключ + Публичен ключ + Частен ключ + SSH ключове + Copy public key + Copy fingerprint diff --git a/app/src/main/res/values-bn-rBD/strings.xml b/app/src/main/res/values-bn-rBD/strings.xml index 558ed5852..a8436edc9 100644 --- a/app/src/main/res/values-bn-rBD/strings.xml +++ b/app/src/main/res/values-bn-rBD/strings.xml @@ -1001,7 +1001,7 @@ Do you want to switch to this account? Please restart registration or try logging in. You may already have an account. Restart registration Authenticator Sync - Allow Bitwarden Authenticator Syncing + Allow authenticator syncing There was an issue validating the registration token. Turn on autofill Use autofill to log into your accounts with a single tap. @@ -1040,8 +1040,8 @@ Do you want to switch to this account? Step 1 of 3 Export your saved logins You’ll delete this file after import is complete. - On your computer, open a new browser tab and go to vault.bitwarden.com - go to vault.bitwarden.com + On your computer, open a new browser tab and go to %1$s + go to %1$s Log in to the Bitwarden web app. Step 2 of 3 Log in to Bitwarden @@ -1055,7 +1055,7 @@ Do you want to switch to this account? then Done For your security, be sure to delete your saved password file. delete your saved password file. - Need help? Checkout out import help. + Need help? Check out import help. import help Save the exported file somewhere on your computer you can find easily. Save the exported file @@ -1073,4 +1073,12 @@ Do you want to switch to this account? Bitwarden Tools Got it No logins were imported + Logins imported + Remember to delete your imported password file from your computer + SSH key + Public key + Private key + SSH keys + Copy public key + Copy fingerprint diff --git a/app/src/main/res/values-bs-rBA/strings.xml b/app/src/main/res/values-bs-rBA/strings.xml index 803e63b75..dee39d9fb 100644 --- a/app/src/main/res/values-bs-rBA/strings.xml +++ b/app/src/main/res/values-bs-rBA/strings.xml @@ -1000,7 +1000,7 @@ Skeniranje će biti izvršeno automatski. Please restart registration or try logging in. You may already have an account. Restart registration Authenticator Sync - Allow Bitwarden Authenticator Syncing + Allow authenticator syncing There was an issue validating the registration token. Turn on autofill Use autofill to log into your accounts with a single tap. @@ -1039,8 +1039,8 @@ Skeniranje će biti izvršeno automatski. Step 1 of 3 Export your saved logins You’ll delete this file after import is complete. - On your computer, open a new browser tab and go to vault.bitwarden.com - go to vault.bitwarden.com + On your computer, open a new browser tab and go to %1$s + go to %1$s Log in to the Bitwarden web app. Step 2 of 3 Log in to Bitwarden @@ -1054,7 +1054,7 @@ Skeniranje će biti izvršeno automatski. then Done For your security, be sure to delete your saved password file. delete your saved password file. - Need help? Checkout out import help. + Need help? Check out import help. import help Save the exported file somewhere on your computer you can find easily. Save the exported file @@ -1072,4 +1072,12 @@ Skeniranje će biti izvršeno automatski. Bitwarden Tools Got it No logins were imported + Logins imported + Remember to delete your imported password file from your computer + SSH key + Public key + Private key + SSH keys + Copy public key + Copy fingerprint diff --git a/app/src/main/res/values-ca-rES/strings.xml b/app/src/main/res/values-ca-rES/strings.xml index c57afd1ad..10bbf6901 100644 --- a/app/src/main/res/values-ca-rES/strings.xml +++ b/app/src/main/res/values-ca-rES/strings.xml @@ -1001,7 +1001,7 @@ Voleu canviar a aquest compte? Please restart registration or try logging in. You may already have an account. Restart registration Authenticator Sync - Allow Bitwarden Authenticator Syncing + Allow authenticator syncing There was an issue validating the registration token. Turn on autofill Use autofill to log into your accounts with a single tap. @@ -1040,8 +1040,8 @@ Voleu canviar a aquest compte? Step 1 of 3 Export your saved logins You’ll delete this file after import is complete. - On your computer, open a new browser tab and go to vault.bitwarden.com - go to vault.bitwarden.com + On your computer, open a new browser tab and go to %1$s + go to %1$s Log in to the Bitwarden web app. Step 2 of 3 Log in to Bitwarden @@ -1055,7 +1055,7 @@ Voleu canviar a aquest compte? then Done For your security, be sure to delete your saved password file. delete your saved password file. - Need help? Checkout out import help. + Need help? Check out import help. import help Save the exported file somewhere on your computer you can find easily. Save the exported file @@ -1073,4 +1073,12 @@ Voleu canviar a aquest compte? Bitwarden Tools Got it No logins were imported + Logins imported + Remember to delete your imported password file from your computer + SSH key + Public key + Private key + SSH keys + Copy public key + Copy fingerprint diff --git a/app/src/main/res/values-cs-rCZ/strings.xml b/app/src/main/res/values-cs-rCZ/strings.xml index 938ad0e3c..4960aa13f 100644 --- a/app/src/main/res/values-cs-rCZ/strings.xml +++ b/app/src/main/res/values-cs-rCZ/strings.xml @@ -207,7 +207,7 @@ Vypnuto Zapnuto Stav - Nejjednodušší způsob, jak přidat nové přihlašovací údaje do Vašeho trezoru, je služba automatického vyplňování Bitwardenu. Další informace o použití této služby naleznete na obrazovce \"Nastavení\". + Nejjednodušší způsob, jak přidat nové přihlašovací údaje do Vašeho trezoru, je služba automatického vyplňování Bitwarden. Další informace o použití této služby naleznete na obrazovce \"Nastavení\". Automatické vyplňování Chcete automaticky vyplnit nebo zobrazit tyto přihlašovací údaje? Opravdu chcete tyto přihlašovací údaje automaticky vyplnit? Nejsou úplně shodné s \"%1$s\". @@ -1040,7 +1040,7 @@ Chcete se přepnout na tento účet? Export Vašich uložených přihlášení Po dokončení importu tento soubor smažete. Na Vašem počítači otevřete novou kartu prohlížeče a přejděte na vault.bitwarden.com - přejděte na vault.bitwarden.com + přejděte na %1$s Přihlaste se do webové aplikace Bitwarden. Krok 2 ze 3 Přihlásit se do Bitwardenu @@ -1054,7 +1054,7 @@ Chcete se přepnout na tento účet? a poté klepněte na tlačítko Hotovo Z důvodu bezpečnosti nezapomeňte smazat soubor s uloženým heslem. smazat soubor s uloženým heslem. - Potřebujete pomoc? Podívejte se na nápovědu pro import. + Potřebujete pomoc? Podívejte se na nápovědu pro import. nápověda pro import Uložte exportovaný soubor někde na Vašem počítači, kde jej můžete snadno najít. Uložit exportovaný soubor @@ -1072,4 +1072,12 @@ Chcete se přepnout na tento účet? Nástroje Bitwarden Rozumím Nebyla importována žádná přihlášení + Přihlášení byla importována + Nezapomeňte smazat soubor importovaných hesel z Vašeho počítače + SSH klíč + Veřejný klíč + Soukromý klíč + SSH klíče + Kopírovat veřejný klíč + Kopírovat otisk prstu diff --git a/app/src/main/res/values-cy-rGB/strings.xml b/app/src/main/res/values-cy-rGB/strings.xml index 1222a610b..ceb653c72 100644 --- a/app/src/main/res/values-cy-rGB/strings.xml +++ b/app/src/main/res/values-cy-rGB/strings.xml @@ -1001,7 +1001,7 @@ Do you want to switch to this account? Please restart registration or try logging in. You may already have an account. Restart registration Authenticator Sync - Allow Bitwarden Authenticator Syncing + Allow authenticator syncing There was an issue validating the registration token. Turn on autofill Use autofill to log into your accounts with a single tap. @@ -1040,8 +1040,8 @@ Do you want to switch to this account? Step 1 of 3 Export your saved logins You’ll delete this file after import is complete. - On your computer, open a new browser tab and go to vault.bitwarden.com - go to vault.bitwarden.com + On your computer, open a new browser tab and go to %1$s + go to %1$s Log in to the Bitwarden web app. Step 2 of 3 Log in to Bitwarden @@ -1055,7 +1055,7 @@ Do you want to switch to this account? then Done For your security, be sure to delete your saved password file. delete your saved password file. - Need help? Checkout out import help. + Need help? Check out import help. import help Save the exported file somewhere on your computer you can find easily. Save the exported file @@ -1073,4 +1073,12 @@ Do you want to switch to this account? Bitwarden Tools Got it No logins were imported + Logins imported + Remember to delete your imported password file from your computer + SSH key + Public key + Private key + SSH keys + Copy public key + Copy fingerprint diff --git a/app/src/main/res/values-da-rDK/strings.xml b/app/src/main/res/values-da-rDK/strings.xml index 53b2ecdc3..9b6b9c22f 100644 --- a/app/src/main/res/values-da-rDK/strings.xml +++ b/app/src/main/res/values-da-rDK/strings.xml @@ -1055,7 +1055,7 @@ Skift til denne konto? dernæst Færdig Sørg af sikkerhedshensyn for at slette den gemte adgangskodefil. slet den gemte adgangskodefil. - Behov for hjælp? Tjek import-hjælp ud. + Behov for hjælp? Tjek import-hjælp ud. import-hjælp Gem den eksporterede fil et sted på computeren, hvor man nemt kan finde den. Gem den eksporterede fil @@ -1073,4 +1073,12 @@ Skift til denne konto? Bitwarden-værktøjer Forstået Ingen logins blev importeret + Logins importeret + Husk at slette den importerede adgangskodefil fra computeren + SSH-nøgle + Offentlig nøgle + Privat nøgle + SSH-nøgler + Copy public key + Copy fingerprint diff --git a/app/src/main/res/values-de-rDE/strings.xml b/app/src/main/res/values-de-rDE/strings.xml index 1563b55cf..b7f75c99f 100644 --- a/app/src/main/res/values-de-rDE/strings.xml +++ b/app/src/main/res/values-de-rDE/strings.xml @@ -1054,7 +1054,7 @@ Möchtest du zu diesem Konto wechseln? then Done Zu deiner eigenen Sicherheit solltest du deine gespeicherte Passwortdatei löschen. lösche deine gespeicherte Passwortdatei. - Brauchst du Hilfe? Schau dir die Importhilfe an. + Need help? Check out import help. Importhilfe Speichere die exportierte Datei irgendwo auf deinem Computer, so dass du sie leicht wiederfinden kannst. Speichere die exportierte Datei @@ -1072,4 +1072,12 @@ Möchtest du zu diesem Konto wechseln? Bitwarden-Werkzeuge Verstanden Es wurden keine Zugangsdaten importiert + Logins imported + Remember to delete your imported password file from your computer + SSH key + Public key + Private key + SSH keys + Copy public key + Copy fingerprint diff --git a/app/src/main/res/values-el-rGR/strings.xml b/app/src/main/res/values-el-rGR/strings.xml index d51826e03..af0f0bc10 100644 --- a/app/src/main/res/values-el-rGR/strings.xml +++ b/app/src/main/res/values-el-rGR/strings.xml @@ -1040,8 +1040,8 @@ Βήμα 1 από 3 Export your saved logins You’ll delete this file after import is complete. - On your computer, open a new browser tab and go to vault.bitwarden.com - go to vault.bitwarden.com + On your computer, open a new browser tab and go to %1$s + go to %1$s Log in to the Bitwarden web app. Βήμα 2 από 3 Σύνδεση στο Bitwarden @@ -1055,7 +1055,7 @@ then Done For your security, be sure to delete your saved password file. delete your saved password file. - Need help? Checkout out import help. + Need help? Check out import help. import help Save the exported file somewhere on your computer you can find easily. Save the exported file @@ -1073,4 +1073,12 @@ Bitwarden Tools Got it No logins were imported + Logins imported + Remember to delete your imported password file from your computer + Κλειδί SSH + Δημόσιο κλειδί + Ιδιωτικό κλειδί + Κλειδιά SSH + Copy public key + Copy fingerprint diff --git a/app/src/main/res/values-en-rGB/strings.xml b/app/src/main/res/values-en-rGB/strings.xml index 5c5b8363a..52d451a93 100644 --- a/app/src/main/res/values-en-rGB/strings.xml +++ b/app/src/main/res/values-en-rGB/strings.xml @@ -1055,7 +1055,7 @@ Do you want to switch to this account? then Done For your security, be sure to delete your saved password file. delete your saved password file. - Need help? Checkout out import help. + Need help? Check out import help. import help Save the exported file somewhere on your computer you can find easily. Save the exported file @@ -1073,4 +1073,12 @@ Do you want to switch to this account? Bitwarden Tools Got it No logins were imported + Logins imported + Remember to delete your imported password file from your computer + SSH key + Public key + Private key + SSH keys + Copy public key + Copy fingerprint diff --git a/app/src/main/res/values-en-rIN/strings.xml b/app/src/main/res/values-en-rIN/strings.xml index ad362346a..816fa9b2c 100644 --- a/app/src/main/res/values-en-rIN/strings.xml +++ b/app/src/main/res/values-en-rIN/strings.xml @@ -1055,7 +1055,7 @@ Do you want to switch to this account? then Done For your security, be sure to delete your saved password file. delete your saved password file. - Need help? Checkout out import help. + Need help? Check out import help. import help Save the exported file somewhere on your computer you can find easily. Save the exported file @@ -1073,4 +1073,12 @@ Do you want to switch to this account? Bitwarden Tools Got it No logins were imported + Logins imported + Remember to delete your imported password file from your computer + SSH key + Public key + Private key + SSH keys + Copy public key + Copy fingerprint diff --git a/app/src/main/res/values-es-rES/strings.xml b/app/src/main/res/values-es-rES/strings.xml index 84ca4ba60..e1ef7d37f 100644 --- a/app/src/main/res/values-es-rES/strings.xml +++ b/app/src/main/res/values-es-rES/strings.xml @@ -1002,7 +1002,7 @@ seleccione Agregar TOTP para almacenar la clave de forma segura Please restart registration or try logging in. You may already have an account. Restart registration Authenticator Sync - Allow Bitwarden Authenticator Syncing + Allow authenticator syncing There was an issue validating the registration token. Turn on autofill Use autofill to log into your accounts with a single tap. @@ -1041,8 +1041,8 @@ seleccione Agregar TOTP para almacenar la clave de forma segura Step 1 of 3 Export your saved logins You’ll delete this file after import is complete. - On your computer, open a new browser tab and go to vault.bitwarden.com - go to vault.bitwarden.com + On your computer, open a new browser tab and go to %1$s + go to %1$s Log in to the Bitwarden web app. Step 2 of 3 Log in to Bitwarden @@ -1056,7 +1056,7 @@ seleccione Agregar TOTP para almacenar la clave de forma segura then Done For your security, be sure to delete your saved password file. delete your saved password file. - Need help? Checkout out import help. + Need help? Check out import help. import help Save the exported file somewhere on your computer you can find easily. Save the exported file @@ -1074,4 +1074,12 @@ seleccione Agregar TOTP para almacenar la clave de forma segura Bitwarden Tools Got it No logins were imported + Logins imported + Remember to delete your imported password file from your computer + SSH key + Public key + Private key + SSH keys + Copy public key + Copy fingerprint diff --git a/app/src/main/res/values-et-rEE/strings.xml b/app/src/main/res/values-et-rEE/strings.xml index 8b9f65388..010d5ecb3 100644 --- a/app/src/main/res/values-et-rEE/strings.xml +++ b/app/src/main/res/values-et-rEE/strings.xml @@ -1001,7 +1001,7 @@ Soovid selle konto peale lülituda? Palun alusta uuesti registreerimist või proovi sisse logida. Sul võib olla konto juba olemas. Alusta registreerimist uuesti Authenticator Sync - Allow Bitwarden Authenticator Syncing + Allow authenticator syncing There was an issue validating the registration token. Turn on autofill Use autofill to log into your accounts with a single tap. @@ -1040,8 +1040,8 @@ Soovid selle konto peale lülituda? Step 1 of 3 Export your saved logins You’ll delete this file after import is complete. - On your computer, open a new browser tab and go to vault.bitwarden.com - go to vault.bitwarden.com + On your computer, open a new browser tab and go to %1$s + go to %1$s Log in to the Bitwarden web app. Step 2 of 3 Log in to Bitwarden @@ -1055,7 +1055,7 @@ Soovid selle konto peale lülituda? then Done For your security, be sure to delete your saved password file. delete your saved password file. - Need help? Checkout out import help. + Need help? Check out import help. import help Save the exported file somewhere on your computer you can find easily. Save the exported file @@ -1073,4 +1073,12 @@ Soovid selle konto peale lülituda? Bitwarden Tools Got it No logins were imported + Logins imported + Remember to delete your imported password file from your computer + SSH key + Public key + Private key + SSH keys + Copy public key + Copy fingerprint diff --git a/app/src/main/res/values-eu-rES/strings.xml b/app/src/main/res/values-eu-rES/strings.xml index b4ec404bc..ef0bb8504 100644 --- a/app/src/main/res/values-eu-rES/strings.xml +++ b/app/src/main/res/values-eu-rES/strings.xml @@ -999,7 +999,7 @@ Kontu honetara aldatu nahi duzu? Please restart registration or try logging in. You may already have an account. Restart registration Authenticator Sync - Allow Bitwarden Authenticator Syncing + Allow authenticator syncing There was an issue validating the registration token. Turn on autofill Use autofill to log into your accounts with a single tap. @@ -1038,8 +1038,8 @@ Kontu honetara aldatu nahi duzu? Step 1 of 3 Export your saved logins You’ll delete this file after import is complete. - On your computer, open a new browser tab and go to vault.bitwarden.com - go to vault.bitwarden.com + On your computer, open a new browser tab and go to %1$s + go to %1$s Log in to the Bitwarden web app. Step 2 of 3 Log in to Bitwarden @@ -1053,7 +1053,7 @@ Kontu honetara aldatu nahi duzu? then Done For your security, be sure to delete your saved password file. delete your saved password file. - Need help? Checkout out import help. + Need help? Check out import help. import help Save the exported file somewhere on your computer you can find easily. Save the exported file @@ -1071,4 +1071,12 @@ Kontu honetara aldatu nahi duzu? Bitwarden Tools Got it No logins were imported + Logins imported + Remember to delete your imported password file from your computer + SSH key + Public key + Private key + SSH keys + Copy public key + Copy fingerprint diff --git a/app/src/main/res/values-fa-rIR/strings.xml b/app/src/main/res/values-fa-rIR/strings.xml index 8b8dab534..186d51d67 100644 --- a/app/src/main/res/values-fa-rIR/strings.xml +++ b/app/src/main/res/values-fa-rIR/strings.xml @@ -1001,7 +1001,7 @@ Please restart registration or try logging in. You may already have an account. Restart registration Authenticator Sync - Allow Bitwarden Authenticator Syncing + Allow authenticator syncing There was an issue validating the registration token. Turn on autofill Use autofill to log into your accounts with a single tap. @@ -1040,8 +1040,8 @@ Step 1 of 3 Export your saved logins You’ll delete this file after import is complete. - On your computer, open a new browser tab and go to vault.bitwarden.com - go to vault.bitwarden.com + On your computer, open a new browser tab and go to %1$s + go to %1$s Log in to the Bitwarden web app. Step 2 of 3 Log in to Bitwarden @@ -1055,7 +1055,7 @@ then Done For your security, be sure to delete your saved password file. delete your saved password file. - Need help? Checkout out import help. + Need help? Check out import help. import help Save the exported file somewhere on your computer you can find easily. Save the exported file @@ -1073,4 +1073,12 @@ Bitwarden Tools Got it No logins were imported + Logins imported + Remember to delete your imported password file from your computer + SSH key + Public key + Private key + SSH keys + Copy public key + Copy fingerprint diff --git a/app/src/main/res/values-fi-rFI/strings.xml b/app/src/main/res/values-fi-rFI/strings.xml index ce0f10ead..b173c7897 100644 --- a/app/src/main/res/values-fi-rFI/strings.xml +++ b/app/src/main/res/values-fi-rFI/strings.xml @@ -321,7 +321,7 @@ Koodi skannataan automaattisesti. Titteli Postinumero Osoite - Erääntymisaika + Voimassaolo päättyy Näytä sivustokuvakkeet Näytä tunnistettava kuva jokaiselle kirjautumistiedolle. Kuvakepalvelimen URL @@ -573,7 +573,7 @@ Koodi skannataan automaattisesti. Send poistuu pysyvästi määritettynä ajankohtana. Odottaa poistoa Erääntymispäivä - Erääntymisaika + Voimassaolo päättyy Send erääntyy määritettynä ajankohtana. Erääntynyt Käyttökertojen enimmäismäärä @@ -1040,7 +1040,7 @@ Haluatko vaihtaa tähän tiliin? Vaihe 1/3 Vie tallennetut kirjautumistietosi Poistat tämän tiedoston, kun tuonti on valmis. - On your computer, open a new browser tab and go to vault.bitwarden.com + On your computer, open a new browser tab and go to %1$s mene osoitteeseen vault.bitwarden.com Kirjaudu Bitwarden-verkkosovellukseen. Vaihe 2/3 @@ -1055,22 +1055,30 @@ Haluatko vaihtaa tähän tiliin? then Done For your security, be sure to delete your saved password file. delete your saved password file. - Need help? Checkout out import help. + Need help? Check out import help. import help Save the exported file somewhere on your computer you can find easily. - Save the exported file + Tallenna viety tiedosto This is not a recognized Bitwarden server. You may need to check with your provider or update your server. - Syncing logins... + Synkronoidaan kirjautumistietoja... SSH Key Cipher Item Types - Download the browser extension + Lataa selaimen laajennus Go to bitwarden.com/download to integrate Bitwarden into your favorite browser for a seamless experience. - Use the web app + Käytä verkkosovellusta Log in at bitwarden.com to easily manage your account and update settings. - Autofill passwords + Automaattitäytä salasanoja Set up autofill on all your devices to login with a single tap anywhere. - Import Successful! + Tuonti onnistui! Manage your logins from anywhere with Bitwarden tools for web and desktop. - Bitwarden Tools - Got it - No logins were imported + Bitwarden-työkalut + Selvä + Kirjautumistietoja ei tuotu + Kirjautumistietoja tuotiin + Remember to delete your imported password file from your computer + SSH-avain + Julkinen avain + Yksityinen avain + SSH-avaimet + Copy public key + Copy fingerprint diff --git a/app/src/main/res/values-fil-rPH/strings.xml b/app/src/main/res/values-fil-rPH/strings.xml index b89531e10..f38c0d744 100644 --- a/app/src/main/res/values-fil-rPH/strings.xml +++ b/app/src/main/res/values-fil-rPH/strings.xml @@ -1001,7 +1001,7 @@ Gusto mo bang pumunta sa account na ito? Please restart registration or try logging in. You may already have an account. Restart registration Authenticator Sync - Allow Bitwarden Authenticator Syncing + Allow authenticator syncing There was an issue validating the registration token. Turn on autofill Use autofill to log into your accounts with a single tap. @@ -1040,8 +1040,8 @@ Gusto mo bang pumunta sa account na ito? Step 1 of 3 Export your saved logins You’ll delete this file after import is complete. - On your computer, open a new browser tab and go to vault.bitwarden.com - go to vault.bitwarden.com + On your computer, open a new browser tab and go to %1$s + go to %1$s Log in to the Bitwarden web app. Step 2 of 3 Log in to Bitwarden @@ -1055,7 +1055,7 @@ Gusto mo bang pumunta sa account na ito? then Done For your security, be sure to delete your saved password file. delete your saved password file. - Need help? Checkout out import help. + Need help? Check out import help. import help Save the exported file somewhere on your computer you can find easily. Save the exported file @@ -1073,4 +1073,12 @@ Gusto mo bang pumunta sa account na ito? Bitwarden Tools Got it No logins were imported + Logins imported + Remember to delete your imported password file from your computer + SSH key + Public key + Private key + SSH keys + Copy public key + Copy fingerprint diff --git a/app/src/main/res/values-fr-rFR/strings.xml b/app/src/main/res/values-fr-rFR/strings.xml index 2c1489787..e3348780e 100644 --- a/app/src/main/res/values-fr-rFR/strings.xml +++ b/app/src/main/res/values-fr-rFR/strings.xml @@ -1001,7 +1001,7 @@ Voulez-vous basculer vers ce compte ? Veuillez recommencer l\'inscription ou essayer de vous connecter. Vous avez peut-être déjà un compte. Recommencer l\'inscription Authenticator Sync - Allow Bitwarden Authenticator Syncing + Allow authenticator syncing Un problème est survenu lors de la validation du jeton d\'enregistrement. Activer le remplissage automatique Utilisez le remplissage automatique pour vous connecter à vos comptes en un seul clic. @@ -1040,8 +1040,8 @@ Voulez-vous basculer vers ce compte ? Step 1 of 3 Export your saved logins You’ll delete this file after import is complete. - On your computer, open a new browser tab and go to vault.bitwarden.com - go to vault.bitwarden.com + On your computer, open a new browser tab and go to %1$s + go to %1$s Log in to the Bitwarden web app. Step 2 of 3 Log in to Bitwarden @@ -1055,7 +1055,7 @@ Voulez-vous basculer vers ce compte ? then Done For your security, be sure to delete your saved password file. delete your saved password file. - Need help? Checkout out import help. + Need help? Check out import help. import help Save the exported file somewhere on your computer you can find easily. Save the exported file @@ -1073,4 +1073,12 @@ Voulez-vous basculer vers ce compte ? Bitwarden Tools Got it No logins were imported + Logins imported + Remember to delete your imported password file from your computer + SSH key + Public key + Private key + SSH keys + Copy public key + Copy fingerprint diff --git a/app/src/main/res/values-gl-rES/strings.xml b/app/src/main/res/values-gl-rES/strings.xml index 5de27233e..684b33a78 100644 --- a/app/src/main/res/values-gl-rES/strings.xml +++ b/app/src/main/res/values-gl-rES/strings.xml @@ -1001,7 +1001,7 @@ Do you want to switch to this account? Please restart registration or try logging in. You may already have an account. Restart registration Authenticator Sync - Allow Bitwarden Authenticator Syncing + Allow authenticator syncing There was an issue validating the registration token. Turn on autofill Use autofill to log into your accounts with a single tap. @@ -1040,8 +1040,8 @@ Do you want to switch to this account? Step 1 of 3 Export your saved logins You’ll delete this file after import is complete. - On your computer, open a new browser tab and go to vault.bitwarden.com - go to vault.bitwarden.com + On your computer, open a new browser tab and go to %1$s + go to %1$s Log in to the Bitwarden web app. Step 2 of 3 Log in to Bitwarden @@ -1055,7 +1055,7 @@ Do you want to switch to this account? then Done For your security, be sure to delete your saved password file. delete your saved password file. - Need help? Checkout out import help. + Need help? Check out import help. import help Save the exported file somewhere on your computer you can find easily. Save the exported file @@ -1073,4 +1073,12 @@ Do you want to switch to this account? Bitwarden Tools Got it No logins were imported + Logins imported + Remember to delete your imported password file from your computer + SSH key + Public key + Private key + SSH keys + Copy public key + Copy fingerprint diff --git a/app/src/main/res/values-hi-rIN/strings.xml b/app/src/main/res/values-hi-rIN/strings.xml index c206ca976..7199f3e93 100644 --- a/app/src/main/res/values-hi-rIN/strings.xml +++ b/app/src/main/res/values-hi-rIN/strings.xml @@ -1000,7 +1000,7 @@ Do you want to switch to this account? Please restart registration or try logging in. You may already have an account. Restart registration Authenticator Sync - Allow Bitwarden Authenticator Syncing + Allow authenticator syncing There was an issue validating the registration token. Turn on autofill Use autofill to log into your accounts with a single tap. @@ -1039,8 +1039,8 @@ Do you want to switch to this account? Step 1 of 3 Export your saved logins You’ll delete this file after import is complete. - On your computer, open a new browser tab and go to vault.bitwarden.com - go to vault.bitwarden.com + On your computer, open a new browser tab and go to %1$s + go to %1$s Log in to the Bitwarden web app. Step 2 of 3 Log in to Bitwarden @@ -1054,7 +1054,7 @@ Do you want to switch to this account? then Done For your security, be sure to delete your saved password file. delete your saved password file. - Need help? Checkout out import help. + Need help? Check out import help. import help Save the exported file somewhere on your computer you can find easily. Save the exported file @@ -1072,4 +1072,12 @@ Do you want to switch to this account? Bitwarden Tools Got it No logins were imported + Logins imported + Remember to delete your imported password file from your computer + SSH key + Public key + Private key + SSH keys + Copy public key + Copy fingerprint diff --git a/app/src/main/res/values-hr-rHR/strings.xml b/app/src/main/res/values-hr-rHR/strings.xml index 5e68727bd..07e05b423 100644 --- a/app/src/main/res/values-hr-rHR/strings.xml +++ b/app/src/main/res/values-hr-rHR/strings.xml @@ -1038,8 +1038,8 @@ Step 1 of 3 Export your saved logins You’ll delete this file after import is complete. - On your computer, open a new browser tab and go to vault.bitwarden.com - go to vault.bitwarden.com + On your computer, open a new browser tab and go to %1$s + go to %1$s Log in to the Bitwarden web app. Step 2 of 3 Log in to Bitwarden @@ -1053,7 +1053,7 @@ then Done For your security, be sure to delete your saved password file. delete your saved password file. - Need help? Checkout out import help. + Need help? Check out import help. import help Save the exported file somewhere on your computer you can find easily. Save the exported file @@ -1071,4 +1071,12 @@ Bitwarden Tools Got it No logins were imported + Logins imported + Remember to delete your imported password file from your computer + SSH key + Public key + Private key + SSH keys + Copy public key + Copy fingerprint diff --git a/app/src/main/res/values-hu-rHU/strings.xml b/app/src/main/res/values-hu-rHU/strings.xml index fe96cc9db..32fa6c68a 100644 --- a/app/src/main/res/values-hu-rHU/strings.xml +++ b/app/src/main/res/values-hu-rHU/strings.xml @@ -1054,7 +1054,7 @@ Szeretnénk átváltani erre a fiókra? majd Kész lehetőség A biztonság érdekében töröljük a mentett jelszó fájlt. a mentett jelszó fájl törlése. - Segítségre van szükség? Nézzük meg az importálás súgót. + Segítségre van szükség? Nézzük meg az importálás súgót. importálás súgó Mentsük el az exportált fájlt olyan helyre a számítógépen, ahol könnyen megtalálhatjuk. Exportált fájl mentése @@ -1072,4 +1072,12 @@ Szeretnénk átváltani erre a fiókra? Bitwarden eszközök Rendben Nem lett bejelentkezés importáva. + A bejelentkezések importálásra kerültek. + Ne felejtsük el törölni az importált jelszófájlt a számítógépről. + SSH kulcs + Nyilvános kulcs + Személyes kulcs + SSH kulcsok + Copy public key + Copy fingerprint diff --git a/app/src/main/res/values-in-rID/strings.xml b/app/src/main/res/values-in-rID/strings.xml index 847917e98..c61fc8b42 100644 --- a/app/src/main/res/values-in-rID/strings.xml +++ b/app/src/main/res/values-in-rID/strings.xml @@ -1001,7 +1001,7 @@ Do you want to switch to this account? Please restart registration or try logging in. You may already have an account. Restart registration Authenticator Sync - Allow Bitwarden Authenticator Syncing + Allow authenticator syncing There was an issue validating the registration token. Turn on autofill Use autofill to log into your accounts with a single tap. @@ -1040,8 +1040,8 @@ Do you want to switch to this account? Step 1 of 3 Export your saved logins You’ll delete this file after import is complete. - On your computer, open a new browser tab and go to vault.bitwarden.com - go to vault.bitwarden.com + On your computer, open a new browser tab and go to %1$s + go to %1$s Log in to the Bitwarden web app. Step 2 of 3 Log in to Bitwarden @@ -1055,7 +1055,7 @@ Do you want to switch to this account? then Done For your security, be sure to delete your saved password file. delete your saved password file. - Need help? Checkout out import help. + Need help? Check out import help. import help Save the exported file somewhere on your computer you can find easily. Save the exported file @@ -1073,4 +1073,12 @@ Do you want to switch to this account? Bitwarden Tools Got it No logins were imported + Logins imported + Remember to delete your imported password file from your computer + SSH key + Public key + Private key + SSH keys + Copy public key + Copy fingerprint diff --git a/app/src/main/res/values-it-rIT/strings.xml b/app/src/main/res/values-it-rIT/strings.xml index 400eb15d3..636db10e5 100644 --- a/app/src/main/res/values-it-rIT/strings.xml +++ b/app/src/main/res/values-it-rIT/strings.xml @@ -1039,8 +1039,8 @@ Vuoi passare a questo account? Step 1 of 3 Export your saved logins You’ll delete this file after import is complete. - On your computer, open a new browser tab and go to vault.bitwarden.com - go to vault.bitwarden.com + On your computer, open a new browser tab and go to %1$s + go to %1$s Log in to the Bitwarden web app. Step 2 of 3 Log in to Bitwarden @@ -1054,7 +1054,7 @@ Vuoi passare a questo account? then Done For your security, be sure to delete your saved password file. delete your saved password file. - Need help? Checkout out import help. + Need help? Check out import help. import help Save the exported file somewhere on your computer you can find easily. Save the exported file @@ -1072,4 +1072,12 @@ Vuoi passare a questo account? Bitwarden Tools Got it No logins were imported + Logins imported + Remember to delete your imported password file from your computer + SSH key + Public key + Private key + SSH keys + Copy public key + Copy fingerprint diff --git a/app/src/main/res/values-iw-rIL/strings.xml b/app/src/main/res/values-iw-rIL/strings.xml index debc4c8fd..03a310b3c 100644 --- a/app/src/main/res/values-iw-rIL/strings.xml +++ b/app/src/main/res/values-iw-rIL/strings.xml @@ -1004,7 +1004,7 @@ Do you want to switch to this account? Please restart registration or try logging in. You may already have an account. Restart registration Authenticator Sync - Allow Bitwarden Authenticator Syncing + Allow authenticator syncing There was an issue validating the registration token. Turn on autofill Use autofill to log into your accounts with a single tap. @@ -1043,8 +1043,8 @@ Do you want to switch to this account? Step 1 of 3 Export your saved logins You’ll delete this file after import is complete. - On your computer, open a new browser tab and go to vault.bitwarden.com - go to vault.bitwarden.com + On your computer, open a new browser tab and go to %1$s + go to %1$s Log in to the Bitwarden web app. Step 2 of 3 Log in to Bitwarden @@ -1058,7 +1058,7 @@ Do you want to switch to this account? then Done For your security, be sure to delete your saved password file. delete your saved password file. - Need help? Checkout out import help. + Need help? Check out import help. import help Save the exported file somewhere on your computer you can find easily. Save the exported file @@ -1076,4 +1076,12 @@ Do you want to switch to this account? Bitwarden Tools Got it No logins were imported + Logins imported + Remember to delete your imported password file from your computer + SSH key + Public key + Private key + SSH keys + Copy public key + Copy fingerprint diff --git a/app/src/main/res/values-ja-rJP/strings.xml b/app/src/main/res/values-ja-rJP/strings.xml index c58f0bc3c..7f1733249 100644 --- a/app/src/main/res/values-ja-rJP/strings.xml +++ b/app/src/main/res/values-ja-rJP/strings.xml @@ -1040,8 +1040,8 @@ Step 1 of 3 Export your saved logins You’ll delete this file after import is complete. - On your computer, open a new browser tab and go to vault.bitwarden.com - go to vault.bitwarden.com + On your computer, open a new browser tab and go to %1$s + go to %1$s Log in to the Bitwarden web app. Step 2 of 3 Log in to Bitwarden @@ -1055,7 +1055,7 @@ then Done For your security, be sure to delete your saved password file. delete your saved password file. - Need help? Checkout out import help. + Need help? Check out import help. import help Save the exported file somewhere on your computer you can find easily. Save the exported file @@ -1073,4 +1073,12 @@ Bitwarden Tools Got it No logins were imported + Logins imported + Remember to delete your imported password file from your computer + SSH key + Public key + Private key + SSH keys + Copy public key + Copy fingerprint diff --git a/app/src/main/res/values-ka-rGE/strings.xml b/app/src/main/res/values-ka-rGE/strings.xml index 8df7b6fa1..1263eba5d 100644 --- a/app/src/main/res/values-ka-rGE/strings.xml +++ b/app/src/main/res/values-ka-rGE/strings.xml @@ -1001,7 +1001,7 @@ Do you want to switch to this account? Please restart registration or try logging in. You may already have an account. Restart registration Authenticator Sync - Allow Bitwarden Authenticator Syncing + Allow authenticator syncing There was an issue validating the registration token. Turn on autofill Use autofill to log into your accounts with a single tap. @@ -1040,8 +1040,8 @@ Do you want to switch to this account? Step 1 of 3 Export your saved logins You’ll delete this file after import is complete. - On your computer, open a new browser tab and go to vault.bitwarden.com - go to vault.bitwarden.com + On your computer, open a new browser tab and go to %1$s + go to %1$s Log in to the Bitwarden web app. Step 2 of 3 Log in to Bitwarden @@ -1055,7 +1055,7 @@ Do you want to switch to this account? then Done For your security, be sure to delete your saved password file. delete your saved password file. - Need help? Checkout out import help. + Need help? Check out import help. import help Save the exported file somewhere on your computer you can find easily. Save the exported file @@ -1073,4 +1073,12 @@ Do you want to switch to this account? Bitwarden Tools Got it No logins were imported + Logins imported + Remember to delete your imported password file from your computer + SSH key + Public key + Private key + SSH keys + Copy public key + Copy fingerprint diff --git a/app/src/main/res/values-kn-rIN/strings.xml b/app/src/main/res/values-kn-rIN/strings.xml index 9379b27ad..d95418c9c 100644 --- a/app/src/main/res/values-kn-rIN/strings.xml +++ b/app/src/main/res/values-kn-rIN/strings.xml @@ -1001,7 +1001,7 @@ Do you want to switch to this account? Please restart registration or try logging in. You may already have an account. Restart registration Authenticator Sync - Allow Bitwarden Authenticator Syncing + Allow authenticator syncing There was an issue validating the registration token. Turn on autofill Use autofill to log into your accounts with a single tap. @@ -1040,8 +1040,8 @@ Do you want to switch to this account? Step 1 of 3 Export your saved logins You’ll delete this file after import is complete. - On your computer, open a new browser tab and go to vault.bitwarden.com - go to vault.bitwarden.com + On your computer, open a new browser tab and go to %1$s + go to %1$s Log in to the Bitwarden web app. Step 2 of 3 Log in to Bitwarden @@ -1055,7 +1055,7 @@ Do you want to switch to this account? then Done For your security, be sure to delete your saved password file. delete your saved password file. - Need help? Checkout out import help. + Need help? Check out import help. import help Save the exported file somewhere on your computer you can find easily. Save the exported file @@ -1073,4 +1073,12 @@ Do you want to switch to this account? Bitwarden Tools Got it No logins were imported + Logins imported + Remember to delete your imported password file from your computer + SSH key + Public key + Private key + SSH keys + Copy public key + Copy fingerprint diff --git a/app/src/main/res/values-ko-rKR/strings.xml b/app/src/main/res/values-ko-rKR/strings.xml index 6ac153be9..716b1e3a8 100644 --- a/app/src/main/res/values-ko-rKR/strings.xml +++ b/app/src/main/res/values-ko-rKR/strings.xml @@ -1001,7 +1001,7 @@ Please restart registration or try logging in. You may already have an account. Restart registration Authenticator Sync - Allow Bitwarden Authenticator Syncing + Allow authenticator syncing There was an issue validating the registration token. Turn on autofill Use autofill to log into your accounts with a single tap. @@ -1040,8 +1040,8 @@ Step 1 of 3 Export your saved logins You’ll delete this file after import is complete. - On your computer, open a new browser tab and go to vault.bitwarden.com - go to vault.bitwarden.com + On your computer, open a new browser tab and go to %1$s + go to %1$s Log in to the Bitwarden web app. Step 2 of 3 Log in to Bitwarden @@ -1055,7 +1055,7 @@ then Done For your security, be sure to delete your saved password file. delete your saved password file. - Need help? Checkout out import help. + Need help? Check out import help. import help Save the exported file somewhere on your computer you can find easily. Save the exported file @@ -1073,4 +1073,12 @@ Bitwarden Tools Got it No logins were imported + Logins imported + Remember to delete your imported password file from your computer + SSH key + Public key + Private key + SSH keys + Copy public key + Copy fingerprint diff --git a/app/src/main/res/values-lt-rLT/strings.xml b/app/src/main/res/values-lt-rLT/strings.xml index a1b3ddd0f..247729907 100644 --- a/app/src/main/res/values-lt-rLT/strings.xml +++ b/app/src/main/res/values-lt-rLT/strings.xml @@ -1001,7 +1001,7 @@ Ar norite pereiti prie šios paskyros? Please restart registration or try logging in. You may already have an account. Restart registration Authenticator Sync - Allow Bitwarden Authenticator Syncing + Allow authenticator syncing There was an issue validating the registration token. Turn on autofill Use autofill to log into your accounts with a single tap. @@ -1040,8 +1040,8 @@ Ar norite pereiti prie šios paskyros? Step 1 of 3 Export your saved logins You’ll delete this file after import is complete. - On your computer, open a new browser tab and go to vault.bitwarden.com - go to vault.bitwarden.com + On your computer, open a new browser tab and go to %1$s + go to %1$s Log in to the Bitwarden web app. Step 2 of 3 Log in to Bitwarden @@ -1055,7 +1055,7 @@ Ar norite pereiti prie šios paskyros? then Done For your security, be sure to delete your saved password file. delete your saved password file. - Need help? Checkout out import help. + Need help? Check out import help. import help Save the exported file somewhere on your computer you can find easily. Save the exported file @@ -1073,4 +1073,12 @@ Ar norite pereiti prie šios paskyros? Bitwarden Tools Got it No logins were imported + Logins imported + Remember to delete your imported password file from your computer + SSH key + Public key + Private key + SSH keys + Copy public key + Copy fingerprint diff --git a/app/src/main/res/values-lv-rLV/strings.xml b/app/src/main/res/values-lv-rLV/strings.xml index c1dbeec30..929beda00 100644 --- a/app/src/main/res/values-lv-rLV/strings.xml +++ b/app/src/main/res/values-lv-rLV/strings.xml @@ -1055,7 +1055,7 @@ Vai pārslēgties uz šo kontu? tad \"Darīts\" Drošības dēļ jānodrošina, ka paroļu datne tiek izdzēsta. jāizdzēš sava salgabātā paroļu datne. - Nepieciešama palīdzība? Ir vērts ieskatīties ievietošanas palīdzībā. + Nepieciešama palīdzība? Ir vērts ieskatīties ievietošanas palīdzībā. ievietošanas palīdzība Izgūtā datne jāsaglabā kaut kur viegli atrodamā vietā datorā. Izgūtā datne jāsaglabā @@ -1073,4 +1073,12 @@ Vai pārslēgties uz šo kontu? Bitwarden rīki Sapratu Netika ievietots neviens pieteikšanās vienums + Pieteikšanās vienumi ievietoti + Jāatceras datorā izdzēst savu ievietoto paroļu datni + SSH atslēga + Publiskā atslēga + Privātā atslēga + SSH atslēgas + Copy public key + Copy fingerprint diff --git a/app/src/main/res/values-ml-rIN/strings.xml b/app/src/main/res/values-ml-rIN/strings.xml index 2d070aa59..e60279a5d 100644 --- a/app/src/main/res/values-ml-rIN/strings.xml +++ b/app/src/main/res/values-ml-rIN/strings.xml @@ -1001,7 +1001,7 @@ Do you want to switch to this account? Please restart registration or try logging in. You may already have an account. Restart registration Authenticator Sync - Allow Bitwarden Authenticator Syncing + Allow authenticator syncing There was an issue validating the registration token. Turn on autofill Use autofill to log into your accounts with a single tap. @@ -1040,8 +1040,8 @@ Do you want to switch to this account? Step 1 of 3 Export your saved logins You’ll delete this file after import is complete. - On your computer, open a new browser tab and go to vault.bitwarden.com - go to vault.bitwarden.com + On your computer, open a new browser tab and go to %1$s + go to %1$s Log in to the Bitwarden web app. Step 2 of 3 Log in to Bitwarden @@ -1055,7 +1055,7 @@ Do you want to switch to this account? then Done For your security, be sure to delete your saved password file. delete your saved password file. - Need help? Checkout out import help. + Need help? Check out import help. import help Save the exported file somewhere on your computer you can find easily. Save the exported file @@ -1073,4 +1073,12 @@ Do you want to switch to this account? Bitwarden Tools Got it No logins were imported + Logins imported + Remember to delete your imported password file from your computer + SSH key + Public key + Private key + SSH keys + Copy public key + Copy fingerprint diff --git a/app/src/main/res/values-mr-rIN/strings.xml b/app/src/main/res/values-mr-rIN/strings.xml index 0a24ad5b4..b2a8cba26 100644 --- a/app/src/main/res/values-mr-rIN/strings.xml +++ b/app/src/main/res/values-mr-rIN/strings.xml @@ -1001,7 +1001,7 @@ Do you want to switch to this account? Please restart registration or try logging in. You may already have an account. Restart registration Authenticator Sync - Allow Bitwarden Authenticator Syncing + Allow authenticator syncing There was an issue validating the registration token. Turn on autofill Use autofill to log into your accounts with a single tap. @@ -1040,8 +1040,8 @@ Do you want to switch to this account? Step 1 of 3 Export your saved logins You’ll delete this file after import is complete. - On your computer, open a new browser tab and go to vault.bitwarden.com - go to vault.bitwarden.com + On your computer, open a new browser tab and go to %1$s + go to %1$s Log in to the Bitwarden web app. Step 2 of 3 Log in to Bitwarden @@ -1055,7 +1055,7 @@ Do you want to switch to this account? then Done For your security, be sure to delete your saved password file. delete your saved password file. - Need help? Checkout out import help. + Need help? Check out import help. import help Save the exported file somewhere on your computer you can find easily. Save the exported file @@ -1073,4 +1073,12 @@ Do you want to switch to this account? Bitwarden Tools Got it No logins were imported + Logins imported + Remember to delete your imported password file from your computer + SSH key + Public key + Private key + SSH keys + Copy public key + Copy fingerprint diff --git a/app/src/main/res/values-my-rMM/strings.xml b/app/src/main/res/values-my-rMM/strings.xml index 8df7b6fa1..1263eba5d 100644 --- a/app/src/main/res/values-my-rMM/strings.xml +++ b/app/src/main/res/values-my-rMM/strings.xml @@ -1001,7 +1001,7 @@ Do you want to switch to this account? Please restart registration or try logging in. You may already have an account. Restart registration Authenticator Sync - Allow Bitwarden Authenticator Syncing + Allow authenticator syncing There was an issue validating the registration token. Turn on autofill Use autofill to log into your accounts with a single tap. @@ -1040,8 +1040,8 @@ Do you want to switch to this account? Step 1 of 3 Export your saved logins You’ll delete this file after import is complete. - On your computer, open a new browser tab and go to vault.bitwarden.com - go to vault.bitwarden.com + On your computer, open a new browser tab and go to %1$s + go to %1$s Log in to the Bitwarden web app. Step 2 of 3 Log in to Bitwarden @@ -1055,7 +1055,7 @@ Do you want to switch to this account? then Done For your security, be sure to delete your saved password file. delete your saved password file. - Need help? Checkout out import help. + Need help? Check out import help. import help Save the exported file somewhere on your computer you can find easily. Save the exported file @@ -1073,4 +1073,12 @@ Do you want to switch to this account? Bitwarden Tools Got it No logins were imported + Logins imported + Remember to delete your imported password file from your computer + SSH key + Public key + Private key + SSH keys + Copy public key + Copy fingerprint diff --git a/app/src/main/res/values-nb-rNO/strings.xml b/app/src/main/res/values-nb-rNO/strings.xml index cb30f13ff..b0d66db41 100644 --- a/app/src/main/res/values-nb-rNO/strings.xml +++ b/app/src/main/res/values-nb-rNO/strings.xml @@ -1001,7 +1001,7 @@ Vil du bytte til denne kontoen? Please restart registration or try logging in. You may already have an account. Restart registration Authenticator Sync - Allow Bitwarden Authenticator Syncing + Allow authenticator syncing There was an issue validating the registration token. Turn on autofill Use autofill to log into your accounts with a single tap. @@ -1040,8 +1040,8 @@ Vil du bytte til denne kontoen? Step 1 of 3 Export your saved logins You’ll delete this file after import is complete. - On your computer, open a new browser tab and go to vault.bitwarden.com - go to vault.bitwarden.com + On your computer, open a new browser tab and go to %1$s + go to %1$s Log in to the Bitwarden web app. Step 2 of 3 Log in to Bitwarden @@ -1055,7 +1055,7 @@ Vil du bytte til denne kontoen? then Done For your security, be sure to delete your saved password file. delete your saved password file. - Need help? Checkout out import help. + Need help? Check out import help. import help Save the exported file somewhere on your computer you can find easily. Save the exported file @@ -1073,4 +1073,12 @@ Vil du bytte til denne kontoen? Bitwarden Tools Got it No logins were imported + Logins imported + Remember to delete your imported password file from your computer + SSH key + Public key + Private key + SSH keys + Copy public key + Copy fingerprint diff --git a/app/src/main/res/values-ne-rNP/strings.xml b/app/src/main/res/values-ne-rNP/strings.xml index 8df7b6fa1..1263eba5d 100644 --- a/app/src/main/res/values-ne-rNP/strings.xml +++ b/app/src/main/res/values-ne-rNP/strings.xml @@ -1001,7 +1001,7 @@ Do you want to switch to this account? Please restart registration or try logging in. You may already have an account. Restart registration Authenticator Sync - Allow Bitwarden Authenticator Syncing + Allow authenticator syncing There was an issue validating the registration token. Turn on autofill Use autofill to log into your accounts with a single tap. @@ -1040,8 +1040,8 @@ Do you want to switch to this account? Step 1 of 3 Export your saved logins You’ll delete this file after import is complete. - On your computer, open a new browser tab and go to vault.bitwarden.com - go to vault.bitwarden.com + On your computer, open a new browser tab and go to %1$s + go to %1$s Log in to the Bitwarden web app. Step 2 of 3 Log in to Bitwarden @@ -1055,7 +1055,7 @@ Do you want to switch to this account? then Done For your security, be sure to delete your saved password file. delete your saved password file. - Need help? Checkout out import help. + Need help? Check out import help. import help Save the exported file somewhere on your computer you can find easily. Save the exported file @@ -1073,4 +1073,12 @@ Do you want to switch to this account? Bitwarden Tools Got it No logins were imported + Logins imported + Remember to delete your imported password file from your computer + SSH key + Public key + Private key + SSH keys + Copy public key + Copy fingerprint diff --git a/app/src/main/res/values-nl-rNL/strings.xml b/app/src/main/res/values-nl-rNL/strings.xml index 4df2132e2..4e0bd115b 100644 --- a/app/src/main/res/values-nl-rNL/strings.xml +++ b/app/src/main/res/values-nl-rNL/strings.xml @@ -1055,7 +1055,7 @@ Wilt u naar dit account wisselen? dan Klaar Voor je eigen veiligheid, verwijder je opgeslagen wachtwoordbestand. verwijder je opgeslagen wachtwoordbestand. - Hulp nodig? Bekijk importhulp. + Hulp nodig? Bekijk importhulp. importhulp Sla het geëxporteerde bestand ergens op je computer waar je deze gemakkelijk kunt vinden. Exportbestand opslaan @@ -1073,4 +1073,12 @@ Wilt u naar dit account wisselen? Bitwarden-hulpmiddelen Ik snap het Er zijn geen logins geïmporteerd + Inloggegevens geïmporteerd + Vergeet niet het geïmporteerde wachtwoordbestand van je computer te verwijderen + SSH-sleutel + Publieke sleutel + Privésleutel + SSH-sleutels + Copy public key + Copy fingerprint diff --git a/app/src/main/res/values-nn-rNO/strings.xml b/app/src/main/res/values-nn-rNO/strings.xml index 05d3c947b..0312c6bca 100644 --- a/app/src/main/res/values-nn-rNO/strings.xml +++ b/app/src/main/res/values-nn-rNO/strings.xml @@ -1001,7 +1001,7 @@ Do you want to switch to this account? Please restart registration or try logging in. You may already have an account. Restart registration Authenticator Sync - Allow Bitwarden Authenticator Syncing + Allow authenticator syncing Det oppstod eit problem under validering av registreringsnøkkelen. Turn on autofill Use autofill to log into your accounts with a single tap. @@ -1040,8 +1040,8 @@ Do you want to switch to this account? Step 1 of 3 Export your saved logins You’ll delete this file after import is complete. - On your computer, open a new browser tab and go to vault.bitwarden.com - go to vault.bitwarden.com + On your computer, open a new browser tab and go to %1$s + go to %1$s Log in to the Bitwarden web app. Step 2 of 3 Log in to Bitwarden @@ -1055,7 +1055,7 @@ Do you want to switch to this account? then Done For your security, be sure to delete your saved password file. delete your saved password file. - Need help? Checkout out import help. + Need help? Check out import help. import help Save the exported file somewhere on your computer you can find easily. Save the exported file @@ -1073,4 +1073,12 @@ Do you want to switch to this account? Bitwarden Tools Got it No logins were imported + Logins imported + Remember to delete your imported password file from your computer + SSH key + Public key + Private key + SSH keys + Copy public key + Copy fingerprint diff --git a/app/src/main/res/values-or-rIN/strings.xml b/app/src/main/res/values-or-rIN/strings.xml index e8bc4d7dd..ba1c28ead 100644 --- a/app/src/main/res/values-or-rIN/strings.xml +++ b/app/src/main/res/values-or-rIN/strings.xml @@ -1001,7 +1001,7 @@ Do you want to switch to this account? Please restart registration or try logging in. You may already have an account. Restart registration Authenticator Sync - Allow Bitwarden Authenticator Syncing + Allow authenticator syncing There was an issue validating the registration token. Turn on autofill Use autofill to log into your accounts with a single tap. @@ -1040,8 +1040,8 @@ Do you want to switch to this account? Step 1 of 3 Export your saved logins You’ll delete this file after import is complete. - On your computer, open a new browser tab and go to vault.bitwarden.com - go to vault.bitwarden.com + On your computer, open a new browser tab and go to %1$s + go to %1$s Log in to the Bitwarden web app. Step 2 of 3 Log in to Bitwarden @@ -1055,7 +1055,7 @@ Do you want to switch to this account? then Done For your security, be sure to delete your saved password file. delete your saved password file. - Need help? Checkout out import help. + Need help? Check out import help. import help Save the exported file somewhere on your computer you can find easily. Save the exported file @@ -1073,4 +1073,12 @@ Do you want to switch to this account? Bitwarden Tools Got it No logins were imported + Logins imported + Remember to delete your imported password file from your computer + SSH key + Public key + Private key + SSH keys + Copy public key + Copy fingerprint diff --git a/app/src/main/res/values-pl-rPL/strings.xml b/app/src/main/res/values-pl-rPL/strings.xml index 493b56ab0..c109c5f8d 100644 --- a/app/src/main/res/values-pl-rPL/strings.xml +++ b/app/src/main/res/values-pl-rPL/strings.xml @@ -1001,7 +1001,7 @@ Czy chcesz przełączyć się na to konto? Zacznij rejestrację od początku lub spróbuj się zalogować. Możesz mieć już konto. Zacznij rejestrację od początku Authenticator Sync - Allow Bitwarden Authenticator Syncing + Allow authenticator syncing Wystąpił błąd podczas sprawdzania poprawności tokenu rejestracyjnego. Włącz autouzupełnienie Użyj autouzupełniania, aby zalogować się na swoje konta jednym dotknięciem. @@ -1040,8 +1040,8 @@ Czy chcesz przełączyć się na to konto? Step 1 of 3 Export your saved logins You’ll delete this file after import is complete. - On your computer, open a new browser tab and go to vault.bitwarden.com - go to vault.bitwarden.com + On your computer, open a new browser tab and go to %1$s + go to %1$s Log in to the Bitwarden web app. Step 2 of 3 Log in to Bitwarden @@ -1055,7 +1055,7 @@ Czy chcesz przełączyć się na to konto? then Done For your security, be sure to delete your saved password file. delete your saved password file. - Need help? Checkout out import help. + Need help? Check out import help. import help Save the exported file somewhere on your computer you can find easily. Save the exported file @@ -1073,4 +1073,12 @@ Czy chcesz przełączyć się na to konto? Bitwarden Tools Got it No logins were imported + Logins imported + Remember to delete your imported password file from your computer + SSH key + Public key + Private key + SSH keys + Copy public key + Copy fingerprint diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index 521bd17bb..e703f5e59 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -1029,7 +1029,7 @@ Você deseja mudar para esta conta? Importar Logins A partir do seu computador, siga estas instruções para exportar senhas salvas do seu navegador ou de outro gerenciador de senhas. Em seguida, importe-as com segurança para o Bitwarden. Dê ao seu cofre uma entrada de cabeça - Unlock with biometrics requires strong biometric authentication and may not be compatible with all biometric options on this device. + O desbloqueio com dados biométricos requer uma autenticação biométrica forte e pode não ser compatível com todas as opções biométricas deste dispositivo. Unlock with biometrics requires strong biometric authentication and is not compatible with the biometrics options available on this device. On your computer, log in to your current browser or password manager. log in to your current browser or password manager. @@ -1055,7 +1055,7 @@ Você deseja mudar para esta conta? then Done For your security, be sure to delete your saved password file. delete your saved password file. - Need help? Checkout out import help. + Need help? Check out import help. import help Save the exported file somewhere on your computer you can find easily. Save the exported file @@ -1073,4 +1073,12 @@ Você deseja mudar para esta conta? Bitwarden Tools Got it No logins were imported + Logins imported + Remember to delete your imported password file from your computer + SSH key + Public key + Private key + SSH keys + Copy public key + Copy fingerprint diff --git a/app/src/main/res/values-pt-rPT/strings.xml b/app/src/main/res/values-pt-rPT/strings.xml index eee168eb9..e331bc773 100644 --- a/app/src/main/res/values-pt-rPT/strings.xml +++ b/app/src/main/res/values-pt-rPT/strings.xml @@ -1055,7 +1055,7 @@ Anule a subscrição em qualquer altura. em seguida, Concluído Para sua segurança, certifique-se de que elimina o ficheiro de palavras-passe guardadas. elimine o seu ficheiro de palavras-passe guardadas. - Precisa de ajuda? Consulte a ajuda com a importação. + Precisa de ajuda? Consulte a ajuda com a importação. ajuda com a importação Guarde o ficheiro exportado num local do seu computador que possa encontrar facilmente. Guarde o ficheiro exportado @@ -1073,4 +1073,12 @@ Anule a subscrição em qualquer altura. Ferramentas do Bitwarden Percebido Não foram importadas credenciais + Credenciais importadas + Lembre-se de eliminar o ficheiro da palavra-passe importada do seu computador + Chave SSH + Chave pública + Chave privada + Chaves SSH + Copy public key + Copy fingerprint diff --git a/app/src/main/res/values-ro-rRO/strings.xml b/app/src/main/res/values-ro-rRO/strings.xml index bde2629ba..9137f995b 100644 --- a/app/src/main/res/values-ro-rRO/strings.xml +++ b/app/src/main/res/values-ro-rRO/strings.xml @@ -1001,7 +1001,7 @@ Doriți să comutați la acest cont? Please restart registration or try logging in. You may already have an account. Restart registration Authenticator Sync - Allow Bitwarden Authenticator Syncing + Allow authenticator syncing There was an issue validating the registration token. Activează completarea automată Use autofill to log into your accounts with a single tap. @@ -1040,8 +1040,8 @@ Doriți să comutați la acest cont? Step 1 of 3 Export your saved logins You’ll delete this file after import is complete. - On your computer, open a new browser tab and go to vault.bitwarden.com - go to vault.bitwarden.com + On your computer, open a new browser tab and go to %1$s + go to %1$s Log in to the Bitwarden web app. Step 2 of 3 Log in to Bitwarden @@ -1055,7 +1055,7 @@ Doriți să comutați la acest cont? then Done For your security, be sure to delete your saved password file. delete your saved password file. - Need help? Checkout out import help. + Need help? Check out import help. import help Save the exported file somewhere on your computer you can find easily. Save the exported file @@ -1073,4 +1073,12 @@ Doriți să comutați la acest cont? Bitwarden Tools Got it No logins were imported + Logins imported + Remember to delete your imported password file from your computer + SSH key + Public key + Private key + SSH keys + Copy public key + Copy fingerprint diff --git a/app/src/main/res/values-ru-rRU/strings.xml b/app/src/main/res/values-ru-rRU/strings.xml index 639039fd1..0335848f0 100644 --- a/app/src/main/res/values-ru-rRU/strings.xml +++ b/app/src/main/res/values-ru-rRU/strings.xml @@ -1057,22 +1057,30 @@ затем Готово В целях безопасности не забудьте удалить сохраненный файл с паролями. удалите файл с сохраненными паролями. - Нужна помощь? Ознакомьтесь с помощью по импорту. + Нужна помощь? Ознакомьтесь с помощью по импорту. помощь по импорту Сохраните экспортированный файл на компьютере, где его можно будет легко найти. Сохранить экспортированный файл Этот сервер Bitwarden не распознан. Возможно вам следует связаться с провайдером или изменить свой сервер. Синхронизация логинов... - SSH Key Cipher Item Types - Download the browser extension - Go to bitwarden.com/download to integrate Bitwarden into your favorite browser for a seamless experience. - Use the web app - Log in at bitwarden.com to easily manage your account and update settings. - Autofill passwords - Set up autofill on all your devices to login with a single tap anywhere. - Import Successful! - Manage your logins from anywhere with Bitwarden tools for web and desktop. - Bitwarden Tools - Got it - No logins were imported + Типы элементов ключей шифрования SSH + Скачать расширение браузера + Перейдите на bitwarden.com/download для интеграции Bitwarden в ваш любимый браузер для удобной работы. + Использовать веб-приложение + Войдите на bitwarden.com для простого управления вашим аккаунтом и обновления настроек. + Автозаполнение паролей + Настройте автозаполнение на всех своих устройствах, чтобы авторизоваться одним кликом везде. + Импорт выполнен успешно! + Управляйте своими логинами из любого места с помощью инструментов Bitwarden в интернете и с компьютера. + Инструменты Bitwarden + Понятно + Ни один логин не был импортирован + Логины импортированы + Не забудьте удалить файл импортированных паролей с компьютера + Ключ SSH + Публичный ключ + Приватный ключ + Ключи SSH + Copy public key + Copy fingerprint diff --git a/app/src/main/res/values-si-rLK/strings.xml b/app/src/main/res/values-si-rLK/strings.xml index c94b50eb0..98907381d 100644 --- a/app/src/main/res/values-si-rLK/strings.xml +++ b/app/src/main/res/values-si-rLK/strings.xml @@ -1001,7 +1001,7 @@ Do you want to switch to this account? Please restart registration or try logging in. You may already have an account. Restart registration Authenticator Sync - Allow Bitwarden Authenticator Syncing + Allow authenticator syncing There was an issue validating the registration token. Turn on autofill Use autofill to log into your accounts with a single tap. @@ -1040,8 +1040,8 @@ Do you want to switch to this account? Step 1 of 3 Export your saved logins You’ll delete this file after import is complete. - On your computer, open a new browser tab and go to vault.bitwarden.com - go to vault.bitwarden.com + On your computer, open a new browser tab and go to %1$s + go to %1$s Log in to the Bitwarden web app. Step 2 of 3 Log in to Bitwarden @@ -1055,7 +1055,7 @@ Do you want to switch to this account? then Done For your security, be sure to delete your saved password file. delete your saved password file. - Need help? Checkout out import help. + Need help? Check out import help. import help Save the exported file somewhere on your computer you can find easily. Save the exported file @@ -1073,4 +1073,12 @@ Do you want to switch to this account? Bitwarden Tools Got it No logins were imported + Logins imported + Remember to delete your imported password file from your computer + SSH key + Public key + Private key + SSH keys + Copy public key + Copy fingerprint diff --git a/app/src/main/res/values-sk-rSK/strings.xml b/app/src/main/res/values-sk-rSK/strings.xml index 453b44720..fc2d6e88a 100644 --- a/app/src/main/res/values-sk-rSK/strings.xml +++ b/app/src/main/res/values-sk-rSK/strings.xml @@ -1055,7 +1055,7 @@ Chcete prepnúť na tento účet? potom Hotovo V záujme vašej bezpečnosti nezabudnite odstrániť uložený súbor s heslami. odstrániť súbor s uloženými heslami. - Potrebujete pomoc? Pozrite si pomoc pre importovanie. + Potrebujete pomoc? Pozrite si pomoc pre importovanie. pomoc pre importovanie Uložte exportovaný súbor na miesto v počítači, ktoré ľahko nájdete. Uložte exportovaný súbor @@ -1073,4 +1073,12 @@ Chcete prepnúť na tento účet? Nástroje Bitwardenu Chápem Neboli importované žiadne prihlasovacie údaje + Prihlasovacie údaje boli importované + Nezabudnite z počítača odstrániť importovaný súbor s heslami + SSH kľúč + Verejný kľúč + Súkromný kľúč + SSH kľúče + Copy public key + Copy fingerprint diff --git a/app/src/main/res/values-sl-rSI/strings.xml b/app/src/main/res/values-sl-rSI/strings.xml index 41060c01b..2b43f3791 100644 --- a/app/src/main/res/values-sl-rSI/strings.xml +++ b/app/src/main/res/values-sl-rSI/strings.xml @@ -1001,7 +1001,7 @@ Do you want to switch to this account? Please restart registration or try logging in. You may already have an account. Restart registration Authenticator Sync - Allow Bitwarden Authenticator Syncing + Allow authenticator syncing There was an issue validating the registration token. Turn on autofill Use autofill to log into your accounts with a single tap. @@ -1040,8 +1040,8 @@ Do you want to switch to this account? Step 1 of 3 Export your saved logins You’ll delete this file after import is complete. - On your computer, open a new browser tab and go to vault.bitwarden.com - go to vault.bitwarden.com + On your computer, open a new browser tab and go to %1$s + go to %1$s Log in to the Bitwarden web app. Step 2 of 3 Log in to Bitwarden @@ -1055,7 +1055,7 @@ Do you want to switch to this account? then Done For your security, be sure to delete your saved password file. delete your saved password file. - Need help? Checkout out import help. + Need help? Check out import help. import help Save the exported file somewhere on your computer you can find easily. Save the exported file @@ -1073,4 +1073,12 @@ Do you want to switch to this account? Bitwarden Tools Got it No logins were imported + Logins imported + Remember to delete your imported password file from your computer + SSH key + Public key + Private key + SSH keys + Copy public key + Copy fingerprint diff --git a/app/src/main/res/values-sr-rSP/strings.xml b/app/src/main/res/values-sr-rSP/strings.xml index fb7f9cc92..c7340a14b 100644 --- a/app/src/main/res/values-sr-rSP/strings.xml +++ b/app/src/main/res/values-sr-rSP/strings.xml @@ -1002,7 +1002,7 @@ Поново покрените регистрацију или покушајте да се пријавите. Можда већ имате налог. Поново покрените регистрацију Authenticator Sync - Allow Bitwarden Authenticator Syncing + Allow authenticator syncing Дошло је до проблема са валидацијом регистрационог токена. Омогућите ауто-пуњење Користите ауто-пуњење да бисте се пријавили на своје налоге једним додиром. @@ -1056,7 +1056,7 @@ и после Заврши Ради ваше безбедности, обавезно избришите своју сачувану датотеку лозинке. избришите своју сачувану датотеку лозинке. - Треба вам помоћ? Проверите помоћ за увоз. + Need help? Check out import help. помоћ за увоз Сачувајте извезену датотеку негде на рачунару где можете лако да пронађете. Сачувајте извезену датотеку @@ -1074,4 +1074,12 @@ Bitwarden Tools Got it No logins were imported + Logins imported + Remember to delete your imported password file from your computer + SSH key + Public key + Private key + SSH keys + Copy public key + Copy fingerprint diff --git a/app/src/main/res/values-sv-rSE/strings.xml b/app/src/main/res/values-sv-rSE/strings.xml index b1d6ae0bd..78afa60f5 100644 --- a/app/src/main/res/values-sv-rSE/strings.xml +++ b/app/src/main/res/values-sv-rSE/strings.xml @@ -196,7 +196,7 @@ Objekt för %1$s Det finns inga objekt i ditt valv för %1$s. There are no items in your vault that match “%1$s” - Search for a login or add a new login + Sök efter eller lägg till en ny inloggning När du väljer ett inmatningsfält och ser en ruta för automatisk ifyllnad från Bitwarden, kan du trycka på den för att starta tjänsten för automatisk ifyllnad. Tryck på den här aviseringen för att automatiskt fylla i en inloggning från ditt valv. Öppna tillgänglighetsinställningar @@ -1002,7 +1002,7 @@ Vill du byta till detta konto? Please restart registration or try logging in. You may already have an account. Restart registration Authenticator Sync - Allow Bitwarden Authenticator Syncing + Allow authenticator syncing There was an issue validating the registration token. Slå på Autofyll Använd autofyll för att logga in på dina konton med ett tryck. @@ -1015,12 +1015,12 @@ Vill du byta till detta konto? Huvudlösenordsledtråd Viktigt: Ditt huvudlösenord kan inte återställas om du glömmer det! Minst 12 tecken. Kom igång - Save and protect your data + Spara och skydda din data The vault protects more than just passwords. Store secure logins, IDs, cards and notes securely here. - New login + Ny inloggning Share files and data securely with anyone, on any platform. Your information will remain end-to-end encrypted while limiting exposure. Send sensitive information, safely - Import saved logins + Importera sparade inloggningar Use a computer to import logins from an existing password manager You can return to complete this step anytime in Vault Settings. Import logins later @@ -1038,16 +1038,16 @@ Vill du byta till detta konto? Export your passwords. Select Import data in the web app, then Done to finish syncing. Select Import data - Step 1 of 3 + Steg 1 av 3 Export your saved logins You’ll delete this file after import is complete. - On your computer, open a new browser tab and go to vault.bitwarden.com - go to vault.bitwarden.com + On your computer, open a new browser tab and go to %1$s + gå till vault.bitwarden.com Log in to the Bitwarden web app. - Step 2 of 3 - Log in to Bitwarden - Step 3 of 3 - Import logins to Bitwarden + Steg 2 av 3 + Logga in på Bitwarden + Steg 3 av 3 + Importera inloggningar till Bitwarden In the Bitwarden navigation, find the Tools option and select Import data. find the Tools select Import data. @@ -1056,7 +1056,7 @@ Vill du byta till detta konto? then Done For your security, be sure to delete your saved password file. delete your saved password file. - Need help? Checkout out import help. + Need help? Check out import help. import help Save the exported file somewhere on your computer you can find easily. Save the exported file @@ -1067,11 +1067,19 @@ Vill du byta till detta konto? Go to bitwarden.com/download to integrate Bitwarden into your favorite browser for a seamless experience. Use the web app Log in at bitwarden.com to easily manage your account and update settings. - Autofill passwords + Autofyll lösenord Set up autofill on all your devices to login with a single tap anywhere. Import Successful! Manage your logins from anywhere with Bitwarden tools for web and desktop. Bitwarden Tools Got it - No logins were imported + Inga inloggningar importerades + Logins imported + Remember to delete your imported password file from your computer + SSH-nyckel + Public key + Privat nyckel + SSH-nycklar + Copy public key + Kopiera fingeravtryck diff --git a/app/src/main/res/values-ta-rIN/strings.xml b/app/src/main/res/values-ta-rIN/strings.xml index 35414cf18..c52d5f0d9 100644 --- a/app/src/main/res/values-ta-rIN/strings.xml +++ b/app/src/main/res/values-ta-rIN/strings.xml @@ -41,7 +41,7 @@ செல்லாத கடவெண். மீண்டும் முயலவும். ஏவு உள்நுழை - Log in + உள்நுழை உள்நுழைவு வெளியேறு நிச்சயமாக வெளியேற விரும்புகிறீரா? @@ -50,7 +50,7 @@ கணக்கு ஏற்கனவே சேர்க்கப்பட்டது அதற்கு இப்போது நிலைமாற விரும்புகிறீரா? பிரதான கடவுச்சொல் - Master password (required) + பிரதான கடவுச்சொல் (தேவை) மேலும் என் பெட்டகம் அங்கீகரிப்பாளர் @@ -84,12 +84,12 @@ ஆம் கணக்கு உங்கள் புது கணக்கு உருவாக்கப்பட்டது, நீங்கள் இப்போது உள்நுழையலாம். - Your new account has been created! + உமது புது கணக்கு உருவாக்கப்பட்டது! ஓர் உருப்படியைச் சேர் செயலி நீட்டிப்பு செயலிகள் மற்றும் இணையம் முழுதுமுள்ள உமது உள்நுழைவுகளைத் தன்னிரப்ப Bitwarden அணுகல்தன்மை சேவையைப் பயன்படுத்து. தன்னிரப்பி சேவை - Set Bitwarden as your passkey provider in device settings. + Bitwarden-ஐ உமது கடவுவிசை வழங்குநராகச் சாதன அமைவுகளில் அமை. தெளிவற்ற எழுத்துக்களைத் தவிர் Bitwarden செயலி நீட்டிப்பு உம் பெட்டகத்திற்கு புதிய உள்நுழைவுகளைச் சேர்ப்பதற்கான மிக எளிய வழி பிட்வார்டன் செயலி நீட்டிப்பிலிருந்தே. \"அமைப்புகள்\" திரைக்குச் சென்று பிட்வார்டன் செயலி நீட்டிப்பைப் பயன்படுத்துவது பற்றி மேலுமறிக. @@ -151,7 +151,7 @@ உங்கள் பெட்டகத்தில் பிடித்தவை எவையுமில்லை. உம் பெட்டகத்தில் உருப்படிகள் ஏதுமில்லை. உம் பெட்டகத்தில் இவ்வலைத்தளம்/செயலிக்கான உருப்படிகள் இல்லை. ஒன்றைச் சேர்க்க தட்டுக. - No Username + பயனர்பெயர் இல்லை இவ்வுள்நுழைவில் பயனர்பெயர் அ கடவுச்சொல் கட்டமைக்கப்படவில்லை. சரி, புரிந்தது! விருப்ப இயல்புநிலைகள் முதன்மை Bitwarden செயலியின் கடவுச்சொல் உருவாக்கி கருவியிலிருந்து அமைக்கப்படுகிறது. @@ -167,7 +167,7 @@ ஒரு நல்ல விமர்சனம் மூலம் எங்களுக்கு உதவ தயவுசெய்து கருதுங்கள்! கடவுச்சொல்லை மீண்டுமுருவாக்கு பிரதான கடவுச்சொல்லை மீண்டும் தட்டு - Re-type master password (required) + பிரதான கடவுச்சொல்லை மீண்டும் உள்ளிடு (தேவை) பெட்டகத்தைத் தேடுக பாதுகாப்பு தேர்ந்தெடு @@ -195,8 +195,8 @@ மொழிபெயர்ப்புகள் %1$s க்கான உருப்படிகள் உம் பெட்டகத்தில் %1$s க்கான உருப்படிகள் ஏதுமில்லை. - There are no items in your vault that match “%1$s” - Search for a login or add a new login + உம் பெட்டகத்தில் “%1$s”-உடன் பொருந்தும் உருப்படிகள் இல்லை + உள்நுழைவைத் தேடு அல்லது புது உள்நுழைவைச் சேர் நீங்கள் ஓர் உள்ளீடு புலத்தை தேர்ந்து Bitwarden தன்னிரப்பி மேலடுக்கை பார்க்கும்போது, தன்னிரப்பி சேவையை தொடங்க நீங்கள் அதை தட்டலாம். உங்கள் பெட்டகத்திலிருந்து உருப்படியைத் தானாக-நிரப்ப இந்த அறிவிப்பைத் தட்டவும். அணுகல்தன்மை அமைவுகளைத் திற @@ -333,7 +333,7 @@ இக்கோப்புறையில் உருப்படிகள் ஏதுமில்லை. இக்குப்பையில் உருப்படிகள் ஏதுமில்லை. தன்னிரப்பி அணுகல்தன்மை சேவை - Assist with filling username and password fields in other apps and on the web. + பிற செயலிகளிலும் வலையிலும் பயனர்பெயர் மற்றும் கடவுச்சொல் புலங்களை நிரப்ப உதவு. Bitwarden தன்னிரப்பி சேவை உள்நுழைவு தகவலை உம் சாதனத்திலிருக்கும் பிற செயலிகளினுள்ளே நிரப்ப உதவ Android தன்னிரப்பி சட்டகத்தைப் பயன்படுத்துகிறது. பிற செயலிகளினுள்ளே உள்நுழைவு தகவலை நிரப்ப Bitwarden தன்னிரப்பி சேவை பயன்படுத்து. தன்னிரப்பல் அமைவுகளைத் திற @@ -458,7 +458,7 @@ குறிப்பை நகலெடு வெளியேறு Bitwarden இலிருந்து வெளியேற விரும்புகிறீர்களா? - Require master password on app restart? + செயலி மறுதுவக்கத்தில் பிரதான கடவுச்சொல் கேட்கவா? செயலி மறுதுவக்கத்தில் பூட்டவிழ்க்க உங்கள் பிரதான கடவுச்சொல்லை கோர வேண்டுமா? கருப்பு நார்ட் @@ -538,7 +538,7 @@ சேவை விதிமுறைகள் தனியுரிமை கொள்கை Bitwardenக்கு கவனம் தேவை - Bitwarden அமைப்புகளிலிருந்து \"தன்னிரப்பி சேவைகள்\"-இல் \"மேலே-வரைதல்\"-ஐ இயக்குக - Passkey management + கடவுவிசை நிர்வகிப்பு தன்னிரப்பி சேவைகள் உள்ளக தன்னிரப்பி பயன்படுத்து உம் தேர்ந்தெடுத்த IME (விசைப்பலகை) ஆதரித்தால் உள்வரி தன்னிரப்பி பயன்படுத்துக. உம் உள்ளமைவு ஆதரிக்கப்படவில்லையெனில் (அ இவ்விருப்பம் முடங்கியிருப்பின்), இயல்பிருப்பு தன்னிரப்பி மேலடுக்கு பயன்படுத்தப்படும். @@ -547,7 +547,7 @@ செயலிகளிலும் இணையம் முழுதுமுள்ள உமது உள்நுழைவுகளைத் தன்னிரப்ப Bitwarden அணுகல்தன்மை சேவை பயன்படுத்து. (மேலே-வரைதலும் இயங்க வேண்டும்) தன்னிரப்பு விரைவுச்செயல் ஓடு பயன்படுத்த மற்றும்/அல்லது மேலே-வரைதல்(இயங்கினால்) கொண்டு popup காட்ட Bitwarden அணுகல்தன்மை சேவை பயன்படுத்து. தன்னிரப்பு விரைவுச்செயல் ஓடு பயன்படுத்தவோ மேலே-வரைதல்(இயங்கினால்) கொண்டு தன்னிரப்பிச் சேவையை ஆதரவுமிகுதியாக்கவோ தேவைப்படுகிறது. - Required to use the Autofill Quick-Action Tile. + தன்னிரப்பு விரைவுச்செயல் ஓடு பயன்படுத்தத் தேவை. மேலே-வரைதல் பயன்படுத்து இயக்கினால், உள்நுழைவு புலங்கள் தேர்ந்தெடுக்கப்படும்போது ஒரு popup காண்பிக்க Bitwarden அணுகல்தன்மை சேவையை அனுமதிக்கிறது. இயக்கினால், உள்நுழைவு புலங்கள் தேர்ந்தெடுக்கப்படும்போது உமது உள்நுழைவுகளைத் தன்னிரப்ப உதவ Bitwarden அணுகல்தன்மை சேவை ஒரு popup காண்பிக்கும். @@ -556,7 +556,7 @@ ஒரு நிறுவன கொள்கை உம் உரிமை விருப்பங்களைப் பாதிக்கிறது. Send எல்லா Sends - Sends + Sendகள் இந்த Send ஐ விளக்க ஒரு நட்பார்ந்த பெயர். சொற்சரம் சொற்சரம் @@ -802,7 +802,7 @@ இடம் Your master password does not meet one or more of your organization policies. In order to access the vault, you must update your master password now. Proceeding will log you out of your current session, requiring you to log back in. Active sessions on other devices may continue to remain active for up to one hour. Current master password - Logged in! + உள்நுழைந்தீர்! எனது மற்றொரு சாதனத்துடன் ஒப்புதலளி நிர்வாகி ஒப்புதல் கோரு பிரதான கடவுச்சொலுடன் ஒப்புக்கொள் @@ -887,10 +887,10 @@ Your organization permissions were updated, requiring you to set a master password. Your organization requires you to set a master password. Set up an unlock option to change your vault timeout action. - Choose a login to save this passkey to - Save passkey as new login - Save passkey - Passkeys for %1$s + கடவுவிசையைச் சேமிக்க உள்நுழைவைத் தேர்ந்தெடு + கடவுவிசையைப் புதிய உள்நுழைவாகச் சேமி + கடவுவிசையைச் சேமி + %1$s-க்கானக் கடவுவிசைகள் Passwords for %1$s Overwrite passkey? This item already contains a passkey. Are you sure you want to overwrite the current passkey? @@ -1001,7 +1001,7 @@ Please restart registration or try logging in. You may already have an account. Restart registration Authenticator Sync - Allow Bitwarden Authenticator Syncing + Allow authenticator syncing There was an issue validating the registration token. Turn on autofill Use autofill to log into your accounts with a single tap. @@ -1040,8 +1040,8 @@ Step 1 of 3 Export your saved logins You’ll delete this file after import is complete. - On your computer, open a new browser tab and go to vault.bitwarden.com - go to vault.bitwarden.com + On your computer, open a new browser tab and go to %1$s + go to %1$s Log in to the Bitwarden web app. Step 2 of 3 Log in to Bitwarden @@ -1055,7 +1055,7 @@ then Done For your security, be sure to delete your saved password file. delete your saved password file. - Need help? Checkout out import help. + Need help? Check out import help. import help Save the exported file somewhere on your computer you can find easily. Save the exported file @@ -1073,4 +1073,12 @@ Bitwarden Tools Got it No logins were imported + Logins imported + Remember to delete your imported password file from your computer + SSH key + Public key + Private key + SSH keys + Copy public key + Copy fingerprint diff --git a/app/src/main/res/values-te-rIN/strings.xml b/app/src/main/res/values-te-rIN/strings.xml index 8df7b6fa1..1263eba5d 100644 --- a/app/src/main/res/values-te-rIN/strings.xml +++ b/app/src/main/res/values-te-rIN/strings.xml @@ -1001,7 +1001,7 @@ Do you want to switch to this account? Please restart registration or try logging in. You may already have an account. Restart registration Authenticator Sync - Allow Bitwarden Authenticator Syncing + Allow authenticator syncing There was an issue validating the registration token. Turn on autofill Use autofill to log into your accounts with a single tap. @@ -1040,8 +1040,8 @@ Do you want to switch to this account? Step 1 of 3 Export your saved logins You’ll delete this file after import is complete. - On your computer, open a new browser tab and go to vault.bitwarden.com - go to vault.bitwarden.com + On your computer, open a new browser tab and go to %1$s + go to %1$s Log in to the Bitwarden web app. Step 2 of 3 Log in to Bitwarden @@ -1055,7 +1055,7 @@ Do you want to switch to this account? then Done For your security, be sure to delete your saved password file. delete your saved password file. - Need help? Checkout out import help. + Need help? Check out import help. import help Save the exported file somewhere on your computer you can find easily. Save the exported file @@ -1073,4 +1073,12 @@ Do you want to switch to this account? Bitwarden Tools Got it No logins were imported + Logins imported + Remember to delete your imported password file from your computer + SSH key + Public key + Private key + SSH keys + Copy public key + Copy fingerprint diff --git a/app/src/main/res/values-th-rTH/strings.xml b/app/src/main/res/values-th-rTH/strings.xml index 5ab26038e..167b78c7c 100644 --- a/app/src/main/res/values-th-rTH/strings.xml +++ b/app/src/main/res/values-th-rTH/strings.xml @@ -1001,7 +1001,7 @@ Do you want to switch to this account? Please restart registration or try logging in. You may already have an account. Restart registration Authenticator Sync - Allow Bitwarden Authenticator Syncing + Allow authenticator syncing There was an issue validating the registration token. Turn on autofill Use autofill to log into your accounts with a single tap. @@ -1040,8 +1040,8 @@ Do you want to switch to this account? Step 1 of 3 Export your saved logins You’ll delete this file after import is complete. - On your computer, open a new browser tab and go to vault.bitwarden.com - go to vault.bitwarden.com + On your computer, open a new browser tab and go to %1$s + go to %1$s Log in to the Bitwarden web app. Step 2 of 3 Log in to Bitwarden @@ -1055,7 +1055,7 @@ Do you want to switch to this account? then Done For your security, be sure to delete your saved password file. delete your saved password file. - Need help? Checkout out import help. + Need help? Check out import help. import help Save the exported file somewhere on your computer you can find easily. Save the exported file @@ -1073,4 +1073,12 @@ Do you want to switch to this account? Bitwarden Tools Got it No logins were imported + Logins imported + Remember to delete your imported password file from your computer + SSH key + Public key + Private key + SSH keys + Copy public key + Copy fingerprint diff --git a/app/src/main/res/values-tr-rTR/strings.xml b/app/src/main/res/values-tr-rTR/strings.xml index 981406d4e..4752f9a29 100644 --- a/app/src/main/res/values-tr-rTR/strings.xml +++ b/app/src/main/res/values-tr-rTR/strings.xml @@ -1000,7 +1000,7 @@ Bu hesaba geçmek ister misiniz? Lütfen kaydı yeniden başlatın veya giriş yapmayı deneyin. Mevcut bir hesabınız olabilir. Kaydı yeniden başlat Authenticator Sync - Allow Bitwarden Authenticator Syncing + Allow authenticator syncing There was an issue validating the registration token. Otomatik doldurmayı etkinleştir Hesaplarınıza tek dokunuşla giriş yapmak için otomatik doldurmayı kullanabilirsiniz. @@ -1039,8 +1039,8 @@ Bu hesaba geçmek ister misiniz? Step 1 of 3 Export your saved logins You’ll delete this file after import is complete. - On your computer, open a new browser tab and go to vault.bitwarden.com - go to vault.bitwarden.com + On your computer, open a new browser tab and go to %1$s + go to %1$s Log in to the Bitwarden web app. Step 2 of 3 Log in to Bitwarden @@ -1054,7 +1054,7 @@ Bu hesaba geçmek ister misiniz? then Done For your security, be sure to delete your saved password file. delete your saved password file. - Need help? Checkout out import help. + Yardıma mı ihtiyacınız var? İçe aktarma yardımına göz atın. import help Save the exported file somewhere on your computer you can find easily. Save the exported file @@ -1072,4 +1072,12 @@ Bu hesaba geçmek ister misiniz? Bitwarden Araçları Anladım Hiç hesap aktarılmadı + Hesaplar içe aktarıldı + İçe aktardığınız parola dosyasını bilgisayarınızdan silmeyi unutmayın + SSH anahtarı + Ortak anahtar + Özel anahtar + SSH anahtarları + Ortak anahtarı kopyala + Parmak izini kopyala diff --git a/app/src/main/res/values-uk-rUA/strings.xml b/app/src/main/res/values-uk-rUA/strings.xml index 3ff61b3c5..346af8668 100644 --- a/app/src/main/res/values-uk-rUA/strings.xml +++ b/app/src/main/res/values-uk-rUA/strings.xml @@ -1055,22 +1055,30 @@ потім натисніть Виконано З міркувань безпеки, обов\'язково видаліть збережений файл із паролями. видаліть збережений файл із паролями. - Потрібна допомога? Перегляньте довідку щодо імпорту. + Need help? Check out import help. довідка щодо імпорту Збережіть експортований файл у легкодоступному місці на цьому комп\'ютері. Збережіть експортований файл Це не розпізнаний сервер Bitwarden. Можливо, вам необхідно перевірити параметри свого провайдера або оновити свій сервер. Синхронізація записів... - SSH Key Cipher Item Types - Download the browser extension - Go to bitwarden.com/download to integrate Bitwarden into your favorite browser for a seamless experience. - Use the web app - Log in at bitwarden.com to easily manage your account and update settings. - Autofill passwords - Set up autofill on all your devices to login with a single tap anywhere. - Import Successful! - Manage your logins from anywhere with Bitwarden tools for web and desktop. - Bitwarden Tools - Got it - No logins were imported + Типи елементів ключів шифрування SSH + Завантажити розширення браузера + Відкрийте bitwarden.com/download, щоб інтегрувати Bitwarden у свій браузер для найкращої продуктивності. + Використовувати веб-застосунок + Увійдіть на bitwarden.com, щоб легко керувати обліковим записом і змінювати налаштування. + Автозаповнення паролів + Налаштуйте автозаповнення на всіх пристроях для входу одним дотиком. + Успішно імпортовано! + Керуйте своїми паролями звідусіль за допомогою вебінструментів та програм Bitwarden. + Інструменти Bitwarden + Зрозуміло + Жодного запису не імпортовано + Logins imported + Remember to delete your imported password file from your computer + SSH key + Public key + Private key + SSH keys + Copy public key + Copy fingerprint diff --git a/app/src/main/res/values-vi-rVN/strings.xml b/app/src/main/res/values-vi-rVN/strings.xml index b66ad1bc6..a13f820d1 100644 --- a/app/src/main/res/values-vi-rVN/strings.xml +++ b/app/src/main/res/values-vi-rVN/strings.xml @@ -1055,22 +1055,30 @@ Bạn có muốn chuyển sang tài khoản này không? rồi Xong Để bảo mật, hãy xóa file mật khẩu đã lưu. xóa file mật khẩu đã lưu. - Cần trợ giúp? Xem trợ giúp nhập. + Cần trợ giúp? Xem trợ giúp nhập. trợ giúp nhập Lưu file đã xuất trên máy tính để tìm dễ hơn. Lưu file đã xuất Đây là một máy chủ Bitwarden chưa rõ. Bạn có thể cần kiểm tra với nhà cung cấp hoặc cập nhật máy chủ của mình. Đang đồng bộ... SSH Key Cipher Item Types - Download the browser extension - Go to bitwarden.com/download to integrate Bitwarden into your favorite browser for a seamless experience. - Use the web app - Log in at bitwarden.com to easily manage your account and update settings. - Autofill passwords - Set up autofill on all your devices to login with a single tap anywhere. - Import Successful! - Manage your logins from anywhere with Bitwarden tools for web and desktop. - Bitwarden Tools - Got it - No logins were imported + Tải tiện ích trình duyệt + Truy cập bitwarden.com/download để tích hợp Bitwarden vào trình duyệt yêu thích của bạn. + Dùng bản web + Đăng nhập bitwarden.com để quản lý tài khoản và cập nhật thiết lập dễ dàng. + Tự động điền mật khẩu + Thiết lập tính năng tự động điền trên mọi thiết bị của bạn để đăng nhập chỉ bằng một lần chạm ở bất kỳ đâu. + Nhập thành công! + Quản lý thông tin đăng nhập của bạn từ mọi nơi bằng công cụ Bitwarden dành cho web và máy tính để bàn. + Công cụ Bitwarden + Đã hiểu + Chưa nhập lượt đăng nhập nào + Đã nhập lượt đăng nhập + Nhớ xóa file mật khẩu đã nhập khỏi máy tính + Khóa SSH + Khóa công khai + Khóa riêng tư + Khóa SSH + Copy public key + Copy fingerprint diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 4e8d5b9d3..e0fab051b 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -1055,7 +1055,7 @@ 然后「完成」 为了您的安全,请务必删除已保存的密码文件。 删除已保存的密码文件。 - 需要帮助吗?查看导入帮助。 + Need help? Check out import help. 导入帮助 将导出的文件保存到您可以在计算机上轻松找到的地方。 保存导出的文件 @@ -1073,4 +1073,12 @@ Bitwarden Tools Got it No logins were imported + Logins imported + Remember to delete your imported password file from your computer + SSH key + Public key + Private key + SSH keys + Copy public key + Copy fingerprint diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index a091e0b43..d485e0ed0 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -1001,7 +1001,7 @@ Please restart registration or try logging in. You may already have an account. Restart registration Authenticator Sync - Allow Bitwarden Authenticator Syncing + Allow authenticator syncing There was an issue validating the registration token. Turn on autofill Use autofill to log into your accounts with a single tap. @@ -1040,8 +1040,8 @@ Step 1 of 3 Export your saved logins You’ll delete this file after import is complete. - On your computer, open a new browser tab and go to vault.bitwarden.com - go to vault.bitwarden.com + On your computer, open a new browser tab and go to %1$s + go to %1$s Log in to the Bitwarden web app. Step 2 of 3 Log in to Bitwarden @@ -1055,7 +1055,7 @@ then Done For your security, be sure to delete your saved password file. delete your saved password file. - Need help? Checkout out import help. + Need help? Check out import help. import help Save the exported file somewhere on your computer you can find easily. Save the exported file @@ -1073,4 +1073,12 @@ Bitwarden Tools Got it No logins were imported + Logins imported + Remember to delete your imported password file from your computer + SSH key + Public key + Private key + SSH keys + Copy public key + Copy fingerprint diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 5c817e004..efd7faf15 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1073,6 +1073,7 @@ Do you want to switch to this account? Bitwarden Tools Got it No logins were imported + Verified SSO Domain Endpoint Logins imported Remember to delete your imported password file from your computer SSH key @@ -1081,4 +1082,8 @@ Do you want to switch to this account? SSH keys Copy public key Copy fingerprint + Enable notifications + Log in quickly and easily across devices + Bitwarden can notify you each time you receive a new login request from another device. + Skip for now diff --git a/app/src/test/java/com/x8bit/bitwarden/data/auth/datasource/network/service/OrganizationServiceTest.kt b/app/src/test/java/com/x8bit/bitwarden/data/auth/datasource/network/service/OrganizationServiceTest.kt index 8c3e0f549..aea0efb7d 100644 --- a/app/src/test/java/com/x8bit/bitwarden/data/auth/datasource/network/service/OrganizationServiceTest.kt +++ b/app/src/test/java/com/x8bit/bitwarden/data/auth/datasource/network/service/OrganizationServiceTest.kt @@ -5,6 +5,7 @@ import com.x8bit.bitwarden.data.auth.datasource.network.api.UnauthenticatedOrgan import com.x8bit.bitwarden.data.auth.datasource.network.model.OrganizationAutoEnrollStatusResponseJson import com.x8bit.bitwarden.data.auth.datasource.network.model.OrganizationDomainSsoDetailsResponseJson import com.x8bit.bitwarden.data.auth.datasource.network.model.OrganizationKeysResponseJson +import com.x8bit.bitwarden.data.auth.datasource.network.model.VerifiedOrganizationDomainSsoDetailsResponse import com.x8bit.bitwarden.data.platform.base.BaseServiceTest import com.x8bit.bitwarden.data.platform.util.asSuccess import kotlinx.coroutines.test.runTest @@ -13,6 +14,7 @@ import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.Test import retrofit2.create +import java.time.ZonedDateTime class OrganizationServiceTest : BaseServiceTest() { private val authenticatedOrganizationApi: AuthenticatedOrganizationApi = retrofit.create() @@ -55,7 +57,9 @@ class OrganizationServiceTest : BaseServiceTest() { runTest { val email = "test@gmail.com" server.enqueue( - MockResponse().setResponseCode(200).setBody(ORGANIZATION_DOMAIN_SSO_DETAILS_JSON), + MockResponse() + .setResponseCode(200) + .setBody(ORGANIZATION_DOMAIN_SSO_DETAILS_JSON), ) val result = organizationService.getOrganizationDomainSsoDetails(email) assertEquals(ORGANIZATION_DOMAIN_SSO_BODY.asSuccess(), result) @@ -74,7 +78,9 @@ class OrganizationServiceTest : BaseServiceTest() { fun `getOrganizationAutoEnrollStatus when response is success should return valid response`() = runTest { server.enqueue( - MockResponse().setResponseCode(200).setBody(ORGANIZATION_AUTO_ENROLL_STATUS_JSON), + MockResponse() + .setResponseCode(200) + .setBody(ORGANIZATION_AUTO_ENROLL_STATUS_JSON), ) val result = organizationService.getOrganizationAutoEnrollStatus("orgId") assertEquals(ORGANIZATION_AUTO_ENROLL_STATUS_RESPONSE.asSuccess(), result) @@ -91,7 +97,9 @@ class OrganizationServiceTest : BaseServiceTest() { @Test fun `getOrganizationKeys when response is success should return valid response`() = runTest { server.enqueue( - MockResponse().setResponseCode(200).setBody(ORGANIZATION_KEYS_JSON), + MockResponse() + .setResponseCode(200) + .setBody(ORGANIZATION_KEYS_JSON), ) val result = organizationService.getOrganizationKeys("orgId") assertEquals(ORGANIZATION_KEYS_RESPONSE.asSuccess(), result) @@ -103,6 +111,30 @@ class OrganizationServiceTest : BaseServiceTest() { val result = organizationService.getOrganizationKeys("orgId") assertTrue(result.isFailure) } + + @Suppress("MaxLineLength") + @Test + fun `getVerifiedOrganizationDomainSsoDetails when response is success should return valid response`() = + runTest { + server.enqueue( + MockResponse() + .setResponseCode(200) + .setBody(ORGANIZATION_VERIFIED_DOMAIN_SSO_DETAILS_JSON), + ) + val result = + organizationService.getVerifiedOrganizationDomainSsoDetails("example@bitwarden.com") + assertEquals(ORGANIZATION_VERIFIED_DOMAIN_SSO_DETAILS_RESPONSE.asSuccess(), result) + } + + @Suppress("MaxLineLength") + @Test + fun `getVerifiedOrganizationDomainSsoDetails when response is an error should return an error`() = + runTest { + server.enqueue(MockResponse().setResponseCode(400)) + val result = + organizationService.getVerifiedOrganizationDomainSsoDetails("example@bitwarden.com") + assertTrue(result.isFailure) + } } private const val ORGANIZATION_AUTO_ENROLL_STATUS_JSON = """ @@ -130,6 +162,7 @@ private const val ORGANIZATION_DOMAIN_SSO_DETAILS_JSON = """ private val ORGANIZATION_DOMAIN_SSO_BODY = OrganizationDomainSsoDetailsResponseJson( isSsoAvailable = true, organizationIdentifier = "Test Org", + verifiedDate = ZonedDateTime.parse("2024-09-13T00:00:00.000Z"), ) private const val ORGANIZATION_KEYS_JSON = """ @@ -143,3 +176,26 @@ private val ORGANIZATION_KEYS_RESPONSE = OrganizationKeysResponseJson( privateKey = "privateKey", publicKey = "publicKey", ) + +private const val ORGANIZATION_VERIFIED_DOMAIN_SSO_DETAILS_JSON = """ +{ + "data": [ + { + "organizationIdentifier": "Test Identifier", + "organizationName": "Bitwarden", + "domainName": "bitwarden.com" + } + ] +} +""" + +private val ORGANIZATION_VERIFIED_DOMAIN_SSO_DETAILS_RESPONSE = + VerifiedOrganizationDomainSsoDetailsResponse( + verifiedOrganizationDomainSsoDetails = listOf( + VerifiedOrganizationDomainSsoDetailsResponse.VerifiedOrganizationDomainSsoDetail( + organizationIdentifier = "Test Identifier", + organizationName = "Bitwarden", + domainName = "bitwarden.com", + ), + ), + ) diff --git a/app/src/test/java/com/x8bit/bitwarden/data/auth/repository/AuthRepositoryTest.kt b/app/src/test/java/com/x8bit/bitwarden/data/auth/repository/AuthRepositoryTest.kt index 2e437eeb6..887c7139a 100644 --- a/app/src/test/java/com/x8bit/bitwarden/data/auth/repository/AuthRepositoryTest.kt +++ b/app/src/test/java/com/x8bit/bitwarden/data/auth/repository/AuthRepositoryTest.kt @@ -43,6 +43,7 @@ import com.x8bit.bitwarden.data.auth.datasource.network.model.TrustedDeviceUserD import com.x8bit.bitwarden.data.auth.datasource.network.model.TwoFactorAuthMethod import com.x8bit.bitwarden.data.auth.datasource.network.model.TwoFactorDataModel import com.x8bit.bitwarden.data.auth.datasource.network.model.UserDecryptionOptionsJson +import com.x8bit.bitwarden.data.auth.datasource.network.model.VerifiedOrganizationDomainSsoDetailsResponse import com.x8bit.bitwarden.data.auth.datasource.network.model.VerifyEmailTokenRequestJson import com.x8bit.bitwarden.data.auth.datasource.network.model.VerifyEmailTokenResponseJson import com.x8bit.bitwarden.data.auth.datasource.network.service.AccountsService @@ -85,6 +86,7 @@ import com.x8bit.bitwarden.data.auth.repository.model.UserOrganizations import com.x8bit.bitwarden.data.auth.repository.model.ValidatePasswordResult import com.x8bit.bitwarden.data.auth.repository.model.ValidatePinResult import com.x8bit.bitwarden.data.auth.repository.model.VaultUnlockType +import com.x8bit.bitwarden.data.auth.repository.model.VerifiedOrganizationDomainSsoDetailsResult import com.x8bit.bitwarden.data.auth.repository.model.VerifyOtpResult import com.x8bit.bitwarden.data.auth.repository.util.CaptchaCallbackTokenResult import com.x8bit.bitwarden.data.auth.repository.util.DuoCallbackTokenResult @@ -149,6 +151,7 @@ import org.junit.jupiter.api.Assertions.assertNull import org.junit.jupiter.api.Assertions.assertTrue import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test +import java.time.ZonedDateTime @Suppress("LargeClass") class AuthRepositoryTest { @@ -5217,6 +5220,7 @@ class AuthRepositoryTest { } returns OrganizationDomainSsoDetailsResponseJson( isSsoAvailable = true, organizationIdentifier = "Test Org", + verifiedDate = ZonedDateTime.parse("2023-10-27T12:00:00Z"), ) .asSuccess() val result = repository.getOrganizationDomainSsoDetails(email) @@ -5224,11 +5228,53 @@ class AuthRepositoryTest { OrganizationDomainSsoDetailsResult.Success( isSsoAvailable = true, organizationIdentifier = "Test Org", + verifiedDate = ZonedDateTime.parse("2023-10-27T12:00:00Z"), ), result, ) } + @Suppress("MaxLineLength") + @Test + fun `getVerifiedOrganizationDomainSsoDetails Success should return Success`() = runTest { + val email = "test@gmail.com" + coEvery { + organizationService.getVerifiedOrganizationDomainSsoDetails(email) + } returns VerifiedOrganizationDomainSsoDetailsResponse( + verifiedOrganizationDomainSsoDetails = listOf( + VerifiedOrganizationDomainSsoDetailsResponse.VerifiedOrganizationDomainSsoDetail( + organizationIdentifier = "Test Identifier", + organizationName = "Bitwarden", + domainName = "bitwarden.com", + ), + ), + ).asSuccess() + val result = repository.getVerifiedOrganizationDomainSsoDetails(email) + assertEquals( + VerifiedOrganizationDomainSsoDetailsResult.Success( + verifiedOrganizationDomainSsoDetails = listOf( + VerifiedOrganizationDomainSsoDetailsResponse.VerifiedOrganizationDomainSsoDetail( + organizationIdentifier = "Test Identifier", + organizationName = "Bitwarden", + domainName = "bitwarden.com", + ), + ), + ), + result, + ) + } + + @Test + fun `getVerifiedOrganizationDomainSsoDetails Failure should return Failure `() = runTest { + val email = "test@gmail.com" + val throwable = Throwable() + coEvery { + organizationService.getVerifiedOrganizationDomainSsoDetails(email) + } returns throwable.asFailure() + val result = repository.getVerifiedOrganizationDomainSsoDetails(email) + assertEquals(VerifiedOrganizationDomainSsoDetailsResult.Failure, result) + } + @Test fun `prevalidateSso Failure should return Failure `() = runTest { val organizationId = "organizationid" diff --git a/app/src/test/java/com/x8bit/bitwarden/data/autofill/accessibility/manager/AccessibilityActivityManagerTest.kt b/app/src/test/java/com/x8bit/bitwarden/data/autofill/accessibility/manager/AccessibilityActivityManagerTest.kt index e328fc834..d8c5e63bd 100644 --- a/app/src/test/java/com/x8bit/bitwarden/data/autofill/accessibility/manager/AccessibilityActivityManagerTest.kt +++ b/app/src/test/java/com/x8bit/bitwarden/data/autofill/accessibility/manager/AccessibilityActivityManagerTest.kt @@ -4,7 +4,7 @@ import android.content.Context import androidx.lifecycle.LifecycleCoroutineScope import app.cash.turbine.test import com.x8bit.bitwarden.data.autofill.accessibility.util.isAccessibilityServiceEnabled -import com.x8bit.bitwarden.data.platform.manager.AppForegroundManager +import com.x8bit.bitwarden.data.platform.manager.AppStateManager import com.x8bit.bitwarden.data.platform.manager.model.AppForegroundState import io.mockk.every import io.mockk.mockk @@ -26,7 +26,7 @@ class AccessibilityActivityManagerTest { private val accessibilityEnabledManager: AccessibilityEnabledManager = AccessibilityEnabledManagerImpl() private val mutableAppForegroundStateFlow = MutableStateFlow(AppForegroundState.BACKGROUNDED) - private val appForegroundManager: AppForegroundManager = mockk { + private val appStateManager: AppStateManager = mockk { every { appForegroundStateFlow } returns mutableAppForegroundStateFlow } private val lifecycleScope = mockk { @@ -43,7 +43,7 @@ class AccessibilityActivityManagerTest { autofillActivityManager = AccessibilityActivityManagerImpl( context = context, accessibilityEnabledManager = accessibilityEnabledManager, - appForegroundManager = appForegroundManager, + appStateManager = appStateManager, lifecycleScope = lifecycleScope, ) } diff --git a/app/src/test/java/com/x8bit/bitwarden/data/autofill/manager/AutofillActivityManagerTest.kt b/app/src/test/java/com/x8bit/bitwarden/data/autofill/manager/AutofillActivityManagerTest.kt index 525f4d4ab..01ee3a0ce 100644 --- a/app/src/test/java/com/x8bit/bitwarden/data/autofill/manager/AutofillActivityManagerTest.kt +++ b/app/src/test/java/com/x8bit/bitwarden/data/autofill/manager/AutofillActivityManagerTest.kt @@ -3,7 +3,7 @@ package com.x8bit.bitwarden.data.autofill.manager import android.view.autofill.AutofillManager import androidx.lifecycle.LifecycleCoroutineScope import app.cash.turbine.test -import com.x8bit.bitwarden.data.platform.manager.AppForegroundManager +import com.x8bit.bitwarden.data.platform.manager.AppStateManager import com.x8bit.bitwarden.data.platform.manager.model.AppForegroundState import io.mockk.every import io.mockk.just @@ -28,7 +28,7 @@ class AutofillActivityManagerTest { private val autofillEnabledManager: AutofillEnabledManager = AutofillEnabledManagerImpl() private val mutableAppForegroundStateFlow = MutableStateFlow(AppForegroundState.BACKGROUNDED) - private val appForegroundManager: AppForegroundManager = mockk { + private val appStateManager: AppStateManager = mockk { every { appForegroundStateFlow } returns mutableAppForegroundStateFlow } private val lifecycleScope = mockk { @@ -39,7 +39,7 @@ class AutofillActivityManagerTest { @Suppress("unused") private val autofillActivityManager: AutofillActivityManager = AutofillActivityManagerImpl( autofillManager = autofillManager, - appForegroundManager = appForegroundManager, + appStateManager = appStateManager, autofillEnabledManager = autofillEnabledManager, lifecycleScope = lifecycleScope, ) diff --git a/app/src/test/java/com/x8bit/bitwarden/data/platform/manager/AppForegroundManagerTest.kt b/app/src/test/java/com/x8bit/bitwarden/data/platform/manager/AppForegroundManagerTest.kt deleted file mode 100644 index fbf8c1d0d..000000000 --- a/app/src/test/java/com/x8bit/bitwarden/data/platform/manager/AppForegroundManagerTest.kt +++ /dev/null @@ -1,44 +0,0 @@ -package com.x8bit.bitwarden.data.platform.manager - -import app.cash.turbine.test -import com.x8bit.bitwarden.data.platform.manager.model.AppForegroundState -import com.x8bit.bitwarden.data.util.FakeLifecycleOwner -import kotlinx.coroutines.test.runTest -import org.junit.jupiter.api.Assertions.assertEquals -import org.junit.jupiter.api.Test - -class AppForegroundManagerTest { - - private val fakeLifecycleOwner = FakeLifecycleOwner() - - private val appForegroundManager = AppForegroundManagerImpl( - processLifecycleOwner = fakeLifecycleOwner, - ) - - @Suppress("MaxLineLength") - @Test - fun `appForegroundStateFlow should emit whenever the underlying ProcessLifecycleOwner receives start and stop events`() = - runTest { - appForegroundManager.appForegroundStateFlow.test { - // Initial state is BACKGROUNDED - assertEquals( - AppForegroundState.BACKGROUNDED, - awaitItem(), - ) - - fakeLifecycleOwner.lifecycle.dispatchOnStart() - - assertEquals( - AppForegroundState.FOREGROUNDED, - awaitItem(), - ) - - fakeLifecycleOwner.lifecycle.dispatchOnStop() - - assertEquals( - AppForegroundState.BACKGROUNDED, - awaitItem(), - ) - } - } -} diff --git a/app/src/test/java/com/x8bit/bitwarden/data/platform/manager/AppStateManagerTest.kt b/app/src/test/java/com/x8bit/bitwarden/data/platform/manager/AppStateManagerTest.kt new file mode 100644 index 000000000..0021001d2 --- /dev/null +++ b/app/src/test/java/com/x8bit/bitwarden/data/platform/manager/AppStateManagerTest.kt @@ -0,0 +1,82 @@ +package com.x8bit.bitwarden.data.platform.manager + +import android.app.Activity +import android.app.Application +import app.cash.turbine.test +import com.x8bit.bitwarden.data.platform.manager.model.AppCreationState +import com.x8bit.bitwarden.data.platform.manager.model.AppForegroundState +import com.x8bit.bitwarden.data.util.FakeLifecycleOwner +import io.mockk.every +import io.mockk.just +import io.mockk.mockk +import io.mockk.runs +import io.mockk.slot +import kotlinx.coroutines.test.runTest +import org.junit.jupiter.api.Assertions.assertEquals +import org.junit.jupiter.api.Test + +class AppStateManagerTest { + + private val activityLifecycleCallbacks = slot() + private val application = mockk { + every { registerActivityLifecycleCallbacks(capture(activityLifecycleCallbacks)) } just runs + } + private val fakeLifecycleOwner = FakeLifecycleOwner() + + private val appStateManager = AppStateManagerImpl( + application = application, + processLifecycleOwner = fakeLifecycleOwner, + ) + + @Suppress("MaxLineLength") + @Test + fun `appForegroundStateFlow should emit whenever the underlying ProcessLifecycleOwner receives start and stop events`() = + runTest { + appStateManager.appForegroundStateFlow.test { + // Initial state is BACKGROUNDED + assertEquals( + AppForegroundState.BACKGROUNDED, + awaitItem(), + ) + + fakeLifecycleOwner.lifecycle.dispatchOnStart() + + assertEquals( + AppForegroundState.FOREGROUNDED, + awaitItem(), + ) + + fakeLifecycleOwner.lifecycle.dispatchOnStop() + + assertEquals( + AppForegroundState.BACKGROUNDED, + awaitItem(), + ) + } + } + + @Suppress("MaxLineLength") + @Test + fun `appCreatedStateFlow should emit whenever the underlying activities are all destroyed or a creation event occurs`() = + runTest { + val activity = mockk { + every { isChangingConfigurations } returns false + } + appStateManager.appCreatedStateFlow.test { + // Initial state is DESTROYED + assertEquals(AppCreationState.DESTROYED, awaitItem()) + + activityLifecycleCallbacks.captured.onActivityCreated(activity, null) + assertEquals(AppCreationState.CREATED, awaitItem()) + + activityLifecycleCallbacks.captured.onActivityCreated(activity, null) + expectNoEvents() + + activityLifecycleCallbacks.captured.onActivityDestroyed(activity) + expectNoEvents() + + activityLifecycleCallbacks.captured.onActivityDestroyed(activity) + assertEquals(AppCreationState.DESTROYED, awaitItem()) + } + } +} diff --git a/app/src/test/java/com/x8bit/bitwarden/data/platform/manager/restriction/RestrictionManagerTest.kt b/app/src/test/java/com/x8bit/bitwarden/data/platform/manager/restriction/RestrictionManagerTest.kt index e253f253d..b764f1ae0 100644 --- a/app/src/test/java/com/x8bit/bitwarden/data/platform/manager/restriction/RestrictionManagerTest.kt +++ b/app/src/test/java/com/x8bit/bitwarden/data/platform/manager/restriction/RestrictionManagerTest.kt @@ -7,7 +7,7 @@ import android.os.Bundle import com.x8bit.bitwarden.data.auth.datasource.disk.model.EnvironmentUrlDataJson import com.x8bit.bitwarden.data.platform.base.FakeDispatcherManager import com.x8bit.bitwarden.data.platform.manager.model.AppForegroundState -import com.x8bit.bitwarden.data.platform.manager.util.FakeAppForegroundManager +import com.x8bit.bitwarden.data.platform.manager.util.FakeAppStateManager import com.x8bit.bitwarden.data.platform.repository.model.Environment import com.x8bit.bitwarden.data.platform.repository.util.FakeEnvironmentRepository import io.mockk.clearMocks @@ -27,7 +27,7 @@ class RestrictionManagerTest { every { registerReceiver(any(), any()) } returns null every { unregisterReceiver(any()) } just runs } - private val fakeAppForegroundManager = FakeAppForegroundManager() + private val fakeAppStateManager = FakeAppStateManager() private val fakeDispatcherManager = FakeDispatcherManager().apply { setMain(unconfined) } @@ -35,7 +35,7 @@ class RestrictionManagerTest { private val restrictionsManager = mockk() private val restrictionManager: RestrictionManager = RestrictionManagerImpl( - appForegroundManager = fakeAppForegroundManager, + appStateManager = fakeAppStateManager, dispatcherManager = fakeDispatcherManager, context = context, environmentRepository = fakeEnvironmentRepository, @@ -51,7 +51,7 @@ class RestrictionManagerTest { fun `on app foreground with a null bundle should register receiver and do nothing else`() { every { restrictionsManager.applicationRestrictions } returns null - fakeAppForegroundManager.appForegroundState = AppForegroundState.FOREGROUNDED + fakeAppStateManager.appForegroundState = AppForegroundState.FOREGROUNDED verify(exactly = 1) { context.registerReceiver(any(), any()) @@ -63,7 +63,7 @@ class RestrictionManagerTest { fun `on app foreground with an empty bundle should register receiver and do nothing else`() { every { restrictionsManager.applicationRestrictions } returns mockBundle() - fakeAppForegroundManager.appForegroundState = AppForegroundState.FOREGROUNDED + fakeAppStateManager.appForegroundState = AppForegroundState.FOREGROUNDED verify(exactly = 1) { context.registerReceiver(any(), any()) @@ -78,7 +78,7 @@ class RestrictionManagerTest { restrictionsManager.applicationRestrictions } returns mockBundle("key" to "unknown") - fakeAppForegroundManager.appForegroundState = AppForegroundState.FOREGROUNDED + fakeAppStateManager.appForegroundState = AppForegroundState.FOREGROUNDED verify(exactly = 1) { context.registerReceiver(any(), any()) @@ -93,7 +93,7 @@ class RestrictionManagerTest { restrictionsManager.applicationRestrictions } returns mockBundle("baseEnvironmentUrl" to "https://vault.bitwarden.com") - fakeAppForegroundManager.appForegroundState = AppForegroundState.FOREGROUNDED + fakeAppStateManager.appForegroundState = AppForegroundState.FOREGROUNDED verify(exactly = 1) { context.registerReceiver(any(), any()) @@ -109,7 +109,7 @@ class RestrictionManagerTest { restrictionsManager.applicationRestrictions } returns mockBundle("baseEnvironmentUrl" to baseUrl) - fakeAppForegroundManager.appForegroundState = AppForegroundState.FOREGROUNDED + fakeAppStateManager.appForegroundState = AppForegroundState.FOREGROUNDED verify(exactly = 1) { context.registerReceiver(any(), any()) @@ -130,7 +130,7 @@ class RestrictionManagerTest { restrictionsManager.applicationRestrictions } returns mockBundle("baseEnvironmentUrl" to "https://vault.bitwarden.eu") - fakeAppForegroundManager.appForegroundState = AppForegroundState.FOREGROUNDED + fakeAppStateManager.appForegroundState = AppForegroundState.FOREGROUNDED verify(exactly = 1) { context.registerReceiver(any(), any()) @@ -147,7 +147,7 @@ class RestrictionManagerTest { restrictionsManager.applicationRestrictions } returns mockBundle("baseEnvironmentUrl" to baseUrl) - fakeAppForegroundManager.appForegroundState = AppForegroundState.FOREGROUNDED + fakeAppStateManager.appForegroundState = AppForegroundState.FOREGROUNDED verify(exactly = 1) { context.registerReceiver(any(), any()) @@ -172,7 +172,7 @@ class RestrictionManagerTest { restrictionsManager.applicationRestrictions } returns mockBundle("baseEnvironmentUrl" to baseUrl) - fakeAppForegroundManager.appForegroundState = AppForegroundState.FOREGROUNDED + fakeAppStateManager.appForegroundState = AppForegroundState.FOREGROUNDED verify(exactly = 1) { context.registerReceiver(any(), any()) @@ -192,7 +192,7 @@ class RestrictionManagerTest { restrictionsManager.applicationRestrictions } returns mockBundle("baseEnvironmentUrl" to baseUrl) - fakeAppForegroundManager.appForegroundState = AppForegroundState.FOREGROUNDED + fakeAppStateManager.appForegroundState = AppForegroundState.FOREGROUNDED verify(exactly = 1) { context.registerReceiver(any(), any()) @@ -207,7 +207,7 @@ class RestrictionManagerTest { @Test fun `on app background when not foregrounded should do nothing`() { - fakeAppForegroundManager.appForegroundState = AppForegroundState.BACKGROUNDED + fakeAppStateManager.appForegroundState = AppForegroundState.BACKGROUNDED verify(exactly = 0) { context.unregisterReceiver(any()) @@ -218,10 +218,10 @@ class RestrictionManagerTest { @Test fun `on app background after foreground should unregister receiver`() { every { restrictionsManager.applicationRestrictions } returns null - fakeAppForegroundManager.appForegroundState = AppForegroundState.FOREGROUNDED + fakeAppStateManager.appForegroundState = AppForegroundState.FOREGROUNDED clearMocks(context, restrictionsManager, answers = false) - fakeAppForegroundManager.appForegroundState = AppForegroundState.BACKGROUNDED + fakeAppStateManager.appForegroundState = AppForegroundState.BACKGROUNDED verify(exactly = 1) { context.unregisterReceiver(any()) diff --git a/app/src/test/java/com/x8bit/bitwarden/data/platform/manager/util/FakeAppForegroundManager.kt b/app/src/test/java/com/x8bit/bitwarden/data/platform/manager/util/FakeAppStateManager.kt similarity index 52% rename from app/src/test/java/com/x8bit/bitwarden/data/platform/manager/util/FakeAppForegroundManager.kt rename to app/src/test/java/com/x8bit/bitwarden/data/platform/manager/util/FakeAppStateManager.kt index 2bd8e637a..74a7ee939 100644 --- a/app/src/test/java/com/x8bit/bitwarden/data/platform/manager/util/FakeAppForegroundManager.kt +++ b/app/src/test/java/com/x8bit/bitwarden/data/platform/manager/util/FakeAppStateManager.kt @@ -1,20 +1,34 @@ package com.x8bit.bitwarden.data.platform.manager.util -import com.x8bit.bitwarden.data.platform.manager.AppForegroundManager +import com.x8bit.bitwarden.data.platform.manager.AppStateManager +import com.x8bit.bitwarden.data.platform.manager.model.AppCreationState import com.x8bit.bitwarden.data.platform.manager.model.AppForegroundState import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.asStateFlow /** - * A faked implementation of [AppForegroundManager] + * A faked implementation of [AppStateManager] */ -class FakeAppForegroundManager : AppForegroundManager { +class FakeAppStateManager : AppStateManager { + private val mutableAppCreationStateFlow = MutableStateFlow(AppCreationState.DESTROYED) private val mutableAppForegroundStateFlow = MutableStateFlow(AppForegroundState.BACKGROUNDED) + override val appCreatedStateFlow: StateFlow + get() = mutableAppCreationStateFlow.asStateFlow() + override val appForegroundStateFlow: StateFlow get() = mutableAppForegroundStateFlow.asStateFlow() + /** + * The current [AppCreationState] tracked by the [appCreatedStateFlow]. + */ + var appCreationState: AppCreationState + get() = mutableAppCreationStateFlow.value + set(value) { + mutableAppCreationStateFlow.value = value + } + /** * The current [AppForegroundState] tracked by the [appForegroundStateFlow]. */ diff --git a/app/src/test/java/com/x8bit/bitwarden/data/util/StringExtensionsTest.kt b/app/src/test/java/com/x8bit/bitwarden/data/util/StringExtensionsTest.kt index fa064d77c..b4055a0f4 100644 --- a/app/src/test/java/com/x8bit/bitwarden/data/util/StringExtensionsTest.kt +++ b/app/src/test/java/com/x8bit/bitwarden/data/util/StringExtensionsTest.kt @@ -3,8 +3,11 @@ package com.x8bit.bitwarden.data.util import com.x8bit.bitwarden.data.platform.manager.ResourceCacheManager import com.x8bit.bitwarden.data.platform.util.findLastSubstringIndicesOrNull import com.x8bit.bitwarden.data.platform.util.getDomainOrNull +import com.x8bit.bitwarden.data.platform.util.getHostOrNull +import com.x8bit.bitwarden.data.platform.util.getHostWithPortOrNull import com.x8bit.bitwarden.data.platform.util.getWebHostFromAndroidUriOrNull import com.x8bit.bitwarden.data.platform.util.hasHttpProtocol +import com.x8bit.bitwarden.data.platform.util.hasPort import com.x8bit.bitwarden.data.platform.util.isAndroidApp import com.x8bit.bitwarden.data.platform.util.parseDomainOrNull import com.x8bit.bitwarden.data.platform.util.toUriOrNull @@ -154,4 +157,71 @@ class StringExtensionsTest { // Verify assertEquals(expected, actual) } + + @Test + fun `getHostOrNull should return host when one is present`() { + val expectedHost = "www.google.com" + assertEquals(expectedHost, expectedHost.getHostOrNull()) + } + + @Test + fun `getHostOrNull should return null when no host is present`() { + assertNull("boo".getHostOrNull()) + } + + @Test + fun `getHostOrNull should return host from URI string when present and custom URI scheme`() { + val expectedHost = "www.google.com" + val hostWithScheme = "androidapp://$expectedHost" + assertEquals(expectedHost, hostWithScheme.getHostOrNull()) + } + + @Suppress("MaxLineLength") + @Test + fun `getHostOrNull should return host from URI string when present and has port but no scheme`() { + val expectedHost = "www.google.com" + val hostWithPort = "$expectedHost:8080" + assertEquals(expectedHost, hostWithPort.getHostOrNull()) + } + + @Test + fun `hasPort returns true when port is present`() { + val uriString = "www.google.com:8080" + assertTrue("www.google.com:8080".hasPort()) + } + + @Test + fun `hasPort returns false when port is not present`() { + assertFalse("www.google.com".hasPort()) + } + + @Test + fun `hasPort return true when port is present and custom scheme is present`() { + val uriString = "androidapp://www.google.com:8080" + assertTrue(uriString.hasPort()) + } + + @Test + fun `getHostWithPortOrNull should return host with port when present`() { + val uriString = "www.google.com:8080" + assertEquals("www.google.com:8080", uriString.getHostWithPortOrNull()) + } + + @Test + fun `getHostWithPortOrNull should return host when no port is present`() { + val uriString = "www.google.com" + assertEquals("www.google.com", uriString.getHostWithPortOrNull()) + } + + @Test + fun `getHostWithPortOrNull should return null when no host is present`() { + assertNull("boo".getHostWithPortOrNull()) + } + + @Suppress("MaxLineLength") + @Test + fun `getHostWithPortOrNull should return host with port when present and custom scheme is present`() { + val uriString = "androidapp://www.google.com:8080" + assertEquals("www.google.com:8080", uriString.getHostWithPortOrNull()) + } } diff --git a/app/src/test/java/com/x8bit/bitwarden/data/util/UriExtensionsTest.kt b/app/src/test/java/com/x8bit/bitwarden/data/util/UriExtensionsTest.kt index 0c5090014..deaf3baf6 100644 --- a/app/src/test/java/com/x8bit/bitwarden/data/util/UriExtensionsTest.kt +++ b/app/src/test/java/com/x8bit/bitwarden/data/util/UriExtensionsTest.kt @@ -2,6 +2,7 @@ package com.x8bit.bitwarden.data.util import com.x8bit.bitwarden.data.platform.manager.ResourceCacheManager import com.x8bit.bitwarden.data.platform.manager.model.DomainName +import com.x8bit.bitwarden.data.platform.util.addSchemeToUriIfNecessary import com.x8bit.bitwarden.data.platform.util.parseDomainNameOrNull import com.x8bit.bitwarden.data.platform.util.parseDomainOrNull import io.mockk.every @@ -321,4 +322,38 @@ class UriExtensionsTest { assertEquals(expected[index], actual) } } + + @Test + fun `addSchemeToUriIfNecessary should add https when missing`() { + val uriWithNoScheme = URI("example.com") + assertEquals(URI("https://example.com"), uriWithNoScheme.addSchemeToUriIfNecessary()) + } + + @Suppress("MaxLineLength") + @Test + fun `addSchemeToUriIfNecessary should add https when https scheme is missing and a port is present`() { + val uriWithPort = URI("example.com:8080") + assertEquals(URI("https://example.com:8080"), uriWithPort.addSchemeToUriIfNecessary()) + } + + @Test + fun `addSchemeToUriIfNecessary should not add https when http scheme is present`() { + val uriWithHttpScheme = URI("http://example.com") + assertEquals(URI("http://example.com"), uriWithHttpScheme.addSchemeToUriIfNecessary()) + } + + @Test + fun `addSchemeToUriIfNecessary should not add https when https scheme is present`() { + val uriWithHttpsScheme = URI("https://example.com") + assertEquals(URI("https://example.com"), uriWithHttpsScheme.addSchemeToUriIfNecessary()) + } + + @Test + fun `addSchemeToUriIfNecessary should not add https when custom scheme is already present`() { + val uriWithCustomScheme = URI("bitwarden://example.com") + assertEquals( + URI("bitwarden://example.com"), + uriWithCustomScheme.addSchemeToUriIfNecessary(), + ) + } } diff --git a/app/src/test/java/com/x8bit/bitwarden/data/vault/datasource/sdk/model/CollectionViewUtil.kt b/app/src/test/java/com/x8bit/bitwarden/data/vault/datasource/sdk/model/CollectionViewUtil.kt index 379ad075f..5d3e216f4 100644 --- a/app/src/test/java/com/x8bit/bitwarden/data/vault/datasource/sdk/model/CollectionViewUtil.kt +++ b/app/src/test/java/com/x8bit/bitwarden/data/vault/datasource/sdk/model/CollectionViewUtil.kt @@ -5,7 +5,11 @@ import com.bitwarden.vault.CollectionView /** * Create a mock [CollectionView] with a given [number]. */ -fun createMockCollectionView(number: Int, name: String? = null): CollectionView = +fun createMockCollectionView( + number: Int, + name: String? = null, + manage: Boolean = true, +): CollectionView = CollectionView( id = "mockId-$number", organizationId = "mockOrganizationId-$number", @@ -13,5 +17,5 @@ fun createMockCollectionView(number: Int, name: String? = null): CollectionView name = name ?: "mockName-$number", externalId = "mockExternalId-$number", readOnly = false, - manage = true, + manage = manage, ) 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 afc420842..92784cfc5 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 @@ -15,8 +15,9 @@ import com.x8bit.bitwarden.data.auth.manager.UserLogoutManager import com.x8bit.bitwarden.data.auth.manager.model.LogoutEvent import com.x8bit.bitwarden.data.auth.repository.util.toSdkParams import com.x8bit.bitwarden.data.platform.base.FakeDispatcherManager +import com.x8bit.bitwarden.data.platform.manager.model.AppCreationState import com.x8bit.bitwarden.data.platform.manager.model.AppForegroundState -import com.x8bit.bitwarden.data.platform.manager.util.FakeAppForegroundManager +import com.x8bit.bitwarden.data.platform.manager.util.FakeAppStateManager import com.x8bit.bitwarden.data.platform.repository.SettingsRepository import com.x8bit.bitwarden.data.platform.repository.model.VaultTimeout import com.x8bit.bitwarden.data.platform.repository.model.VaultTimeoutAction @@ -53,7 +54,7 @@ import org.junit.jupiter.api.Test @Suppress("LargeClass") class VaultLockManagerTest { private val fakeAuthDiskSource = FakeAuthDiskSource() - private val fakeAppForegroundManager = FakeAppForegroundManager() + private val fakeAppStateManager = FakeAppStateManager() private val authSdkSource: AuthSdkSource = mockk { coEvery { hashPassword( @@ -90,7 +91,7 @@ class VaultLockManagerTest { authSdkSource = authSdkSource, vaultSdkSource = vaultSdkSource, settingsRepository = settingsRepository, - appForegroundManager = fakeAppForegroundManager, + appStateManager = fakeAppStateManager, userLogoutManager = userLogoutManager, trustedDeviceManager = trustedDeviceManager, dispatcherManager = fakeDispatcherManager, @@ -147,18 +148,86 @@ class VaultLockManagerTest { } @Test - fun `app coming into background subsequent times should perform timeout action if necessary`() { + fun `app being destroyed should perform timeout action if necessary`() { setAccountTokens() fakeAuthDiskSource.userState = MOCK_USER_STATE - // Start in a foregrounded state - fakeAppForegroundManager.appForegroundState = AppForegroundState.FOREGROUNDED - // Will be used within each loop to reset the test to a suitable initial state. fun resetTest(vaultTimeout: VaultTimeout) { clearVerifications(userLogoutManager) mutableVaultTimeoutStateFlow.value = vaultTimeout - fakeAppForegroundManager.appForegroundState = AppForegroundState.FOREGROUNDED + fakeAppStateManager.appCreationState = AppCreationState.CREATED + verifyUnlockedVaultBlocking(userId = USER_ID) + assertTrue(vaultLockManager.isVaultUnlocked(USER_ID)) + } + + // Test Lock action + mutableVaultTimeoutActionStateFlow.value = VaultTimeoutAction.LOCK + MOCK_TIMEOUTS.forEach { vaultTimeout -> + resetTest(vaultTimeout = vaultTimeout) + fakeAppStateManager.appCreationState = AppCreationState.DESTROYED + + when (vaultTimeout) { + VaultTimeout.FifteenMinutes, + VaultTimeout.ThirtyMinutes, + VaultTimeout.OneHour, + VaultTimeout.FourHours, + is VaultTimeout.Custom, + VaultTimeout.Immediately, + VaultTimeout.OneMinute, + VaultTimeout.FiveMinutes, + VaultTimeout.OnAppRestart, + -> { + assertFalse(vaultLockManager.isVaultUnlocked(USER_ID)) + } + + VaultTimeout.Never -> { + assertTrue(vaultLockManager.isVaultUnlocked(USER_ID)) + } + } + verify(exactly = 0) { userLogoutManager.softLogout(any()) } + } + + // Test Logout action + mutableVaultTimeoutActionStateFlow.value = VaultTimeoutAction.LOGOUT + MOCK_TIMEOUTS.forEach { vaultTimeout -> + resetTest(vaultTimeout = vaultTimeout) + fakeAppStateManager.appCreationState = AppCreationState.DESTROYED + + when (vaultTimeout) { + VaultTimeout.OnAppRestart, + VaultTimeout.FifteenMinutes, + VaultTimeout.ThirtyMinutes, + VaultTimeout.OneHour, + VaultTimeout.FourHours, + is VaultTimeout.Custom, + VaultTimeout.Immediately, + VaultTimeout.OneMinute, + VaultTimeout.FiveMinutes, + -> { + verify(exactly = 1) { userLogoutManager.softLogout(any()) } + } + + VaultTimeout.Never -> { + verify(exactly = 0) { userLogoutManager.softLogout(any()) } + } + } + } + } + + @Test + fun `app coming into background subsequent times should perform timeout action if necessary`() { + setAccountTokens() + fakeAuthDiskSource.userState = MOCK_USER_STATE + + // Start in a foregrounded state + fakeAppStateManager.appForegroundState = AppForegroundState.FOREGROUNDED + + // Will be used within each loop to reset the test to a suitable initial state. + fun resetTest(vaultTimeout: VaultTimeout) { + clearVerifications(userLogoutManager) + mutableVaultTimeoutStateFlow.value = vaultTimeout + fakeAppStateManager.appForegroundState = AppForegroundState.FOREGROUNDED verifyUnlockedVaultBlocking(userId = USER_ID) assertTrue(vaultLockManager.isVaultUnlocked(USER_ID)) } @@ -168,7 +237,7 @@ class VaultLockManagerTest { MOCK_TIMEOUTS.forEach { vaultTimeout -> resetTest(vaultTimeout = vaultTimeout) - fakeAppForegroundManager.appForegroundState = AppForegroundState.BACKGROUNDED + fakeAppStateManager.appForegroundState = AppForegroundState.BACKGROUNDED // Advance by 6 minutes. Only actions with a timeout less than this will be triggered. testDispatcher.scheduler.advanceTimeBy(delayTimeMillis = 6 * 60 * 1000L) @@ -201,7 +270,7 @@ class VaultLockManagerTest { mutableVaultTimeoutActionStateFlow.value = VaultTimeoutAction.LOGOUT MOCK_TIMEOUTS.forEach { vaultTimeout -> resetTest(vaultTimeout = vaultTimeout) - fakeAppForegroundManager.appForegroundState = AppForegroundState.BACKGROUNDED + fakeAppStateManager.appForegroundState = AppForegroundState.BACKGROUNDED // Advance by 6 minutes. Only actions with a timeout less than this will be triggered. testDispatcher.scheduler.advanceTimeBy(delayTimeMillis = 6 * 60 * 1000L) @@ -236,11 +305,11 @@ class VaultLockManagerTest { mutableVaultTimeoutActionStateFlow.value = VaultTimeoutAction.LOCK mutableVaultTimeoutStateFlow.value = VaultTimeout.Never - fakeAppForegroundManager.appForegroundState = AppForegroundState.BACKGROUNDED + fakeAppStateManager.appForegroundState = AppForegroundState.BACKGROUNDED verifyUnlockedVaultBlocking(userId = USER_ID) assertTrue(vaultLockManager.isVaultUnlocked(USER_ID)) - fakeAppForegroundManager.appForegroundState = AppForegroundState.FOREGROUNDED + fakeAppStateManager.appForegroundState = AppForegroundState.FOREGROUNDED assertTrue(vaultLockManager.isVaultUnlocked(USER_ID)) } @@ -253,11 +322,11 @@ class VaultLockManagerTest { mutableVaultTimeoutActionStateFlow.value = VaultTimeoutAction.LOCK mutableVaultTimeoutStateFlow.value = VaultTimeout.OnAppRestart - fakeAppForegroundManager.appForegroundState = AppForegroundState.BACKGROUNDED + fakeAppStateManager.appForegroundState = AppForegroundState.BACKGROUNDED verifyUnlockedVaultBlocking(userId = USER_ID) assertTrue(vaultLockManager.isVaultUnlocked(USER_ID)) - fakeAppForegroundManager.appForegroundState = AppForegroundState.FOREGROUNDED + fakeAppStateManager.appForegroundState = AppForegroundState.FOREGROUNDED assertFalse(vaultLockManager.isVaultUnlocked(USER_ID)) } @@ -269,11 +338,11 @@ class VaultLockManagerTest { mutableVaultTimeoutActionStateFlow.value = VaultTimeoutAction.LOCK mutableVaultTimeoutStateFlow.value = VaultTimeout.ThirtyMinutes - fakeAppForegroundManager.appForegroundState = AppForegroundState.BACKGROUNDED + fakeAppStateManager.appForegroundState = AppForegroundState.BACKGROUNDED verifyUnlockedVaultBlocking(userId = USER_ID) assertTrue(vaultLockManager.isVaultUnlocked(USER_ID)) - fakeAppForegroundManager.appForegroundState = AppForegroundState.FOREGROUNDED + fakeAppStateManager.appForegroundState = AppForegroundState.FOREGROUNDED assertFalse(vaultLockManager.isVaultUnlocked(USER_ID)) } @@ -286,7 +355,7 @@ class VaultLockManagerTest { mutableVaultTimeoutActionStateFlow.value = VaultTimeoutAction.LOCK mutableVaultTimeoutStateFlow.value = VaultTimeout.ThirtyMinutes - fakeAppForegroundManager.appForegroundState = AppForegroundState.FOREGROUNDED + fakeAppStateManager.appForegroundState = AppForegroundState.FOREGROUNDED assertFalse(vaultLockManager.isVaultUnlocked(USER_ID)) } @@ -298,11 +367,11 @@ class VaultLockManagerTest { mutableVaultTimeoutActionStateFlow.value = VaultTimeoutAction.LOGOUT mutableVaultTimeoutStateFlow.value = VaultTimeout.ThirtyMinutes - fakeAppForegroundManager.appForegroundState = AppForegroundState.BACKGROUNDED + fakeAppStateManager.appForegroundState = AppForegroundState.BACKGROUNDED verifyUnlockedVaultBlocking(userId = USER_ID) assertTrue(vaultLockManager.isVaultUnlocked(USER_ID)) - fakeAppForegroundManager.appForegroundState = AppForegroundState.FOREGROUNDED + fakeAppStateManager.appForegroundState = AppForegroundState.FOREGROUNDED verify(exactly = 1) { settingsRepository.getVaultTimeoutActionStateFlow(USER_ID) } } @@ -314,11 +383,11 @@ class VaultLockManagerTest { mutableVaultTimeoutActionStateFlow.value = VaultTimeoutAction.LOGOUT mutableVaultTimeoutStateFlow.value = VaultTimeout.ThirtyMinutes - fakeAppForegroundManager.appForegroundState = AppForegroundState.BACKGROUNDED + fakeAppStateManager.appForegroundState = AppForegroundState.BACKGROUNDED verifyUnlockedVaultBlocking(userId = USER_ID) assertTrue(vaultLockManager.isVaultUnlocked(USER_ID)) - fakeAppForegroundManager.appForegroundState = AppForegroundState.FOREGROUNDED + fakeAppStateManager.appForegroundState = AppForegroundState.FOREGROUNDED verify(exactly = 0) { settingsRepository.getVaultTimeoutActionStateFlow(USER_ID) } } @@ -329,14 +398,14 @@ class VaultLockManagerTest { fakeAuthDiskSource.userState = MOCK_USER_STATE // Start in a foregrounded state - fakeAppForegroundManager.appForegroundState = AppForegroundState.BACKGROUNDED + fakeAppStateManager.appForegroundState = AppForegroundState.BACKGROUNDED // We want to skip the first time since that is different from subsequent foregrounds - fakeAppForegroundManager.appForegroundState = AppForegroundState.FOREGROUNDED + fakeAppStateManager.appForegroundState = AppForegroundState.FOREGROUNDED // Will be used within each loop to reset the test to a suitable initial state. fun resetTest(vaultTimeout: VaultTimeout) { mutableVaultTimeoutStateFlow.value = vaultTimeout - fakeAppForegroundManager.appForegroundState = AppForegroundState.BACKGROUNDED + fakeAppStateManager.appForegroundState = AppForegroundState.BACKGROUNDED clearVerifications(userLogoutManager) verifyUnlockedVaultBlocking(userId = USER_ID) assertTrue(vaultLockManager.isVaultUnlocked(USER_ID)) @@ -347,7 +416,7 @@ class VaultLockManagerTest { MOCK_TIMEOUTS.forEach { vaultTimeout -> resetTest(vaultTimeout = vaultTimeout) - fakeAppForegroundManager.appForegroundState = AppForegroundState.FOREGROUNDED + fakeAppStateManager.appForegroundState = AppForegroundState.FOREGROUNDED // Advance by 6 minutes. Only actions with a timeout less than this will be triggered. testDispatcher.scheduler.advanceTimeBy(delayTimeMillis = 6 * 60 * 1000L) @@ -361,7 +430,7 @@ class VaultLockManagerTest { MOCK_TIMEOUTS.forEach { vaultTimeout -> resetTest(vaultTimeout = vaultTimeout) - fakeAppForegroundManager.appForegroundState = AppForegroundState.FOREGROUNDED + fakeAppStateManager.appForegroundState = AppForegroundState.FOREGROUNDED // Advance by 6 minutes. Only actions with a timeout less than this will be triggered. testDispatcher.scheduler.advanceTimeBy(delayTimeMillis = 6 * 60 * 1000L) @@ -376,7 +445,7 @@ class VaultLockManagerTest { fun `switching users should perform lock actions or start a timer for each user if necessary`() { val userId2 = "mockId-2" setAccountTokens(listOf(USER_ID, userId2)) - fakeAppForegroundManager.appForegroundState = AppForegroundState.FOREGROUNDED + fakeAppStateManager.appForegroundState = AppForegroundState.FOREGROUNDED fakeAuthDiskSource.userState = UserStateJson( activeUserId = USER_ID, accounts = mapOf( diff --git a/app/src/test/java/com/x8bit/bitwarden/ui/auth/feature/enterprisesignon/EnterpriseSignOnViewModelTest.kt b/app/src/test/java/com/x8bit/bitwarden/ui/auth/feature/enterprisesignon/EnterpriseSignOnViewModelTest.kt index 0b8497bdf..4e8aac044 100644 --- a/app/src/test/java/com/x8bit/bitwarden/ui/auth/feature/enterprisesignon/EnterpriseSignOnViewModelTest.kt +++ b/app/src/test/java/com/x8bit/bitwarden/ui/auth/feature/enterprisesignon/EnterpriseSignOnViewModelTest.kt @@ -4,14 +4,18 @@ import android.net.Uri import androidx.lifecycle.SavedStateHandle import app.cash.turbine.test import com.x8bit.bitwarden.R +import com.x8bit.bitwarden.data.auth.datasource.network.model.VerifiedOrganizationDomainSsoDetailsResponse import com.x8bit.bitwarden.data.auth.repository.AuthRepository import com.x8bit.bitwarden.data.auth.repository.model.LoginResult import com.x8bit.bitwarden.data.auth.repository.model.OrganizationDomainSsoDetailsResult import com.x8bit.bitwarden.data.auth.repository.model.PrevalidateSsoResult +import com.x8bit.bitwarden.data.auth.repository.model.VerifiedOrganizationDomainSsoDetailsResult import com.x8bit.bitwarden.data.auth.repository.util.CaptchaCallbackTokenResult import com.x8bit.bitwarden.data.auth.repository.util.SsoCallbackResult import com.x8bit.bitwarden.data.auth.repository.util.generateUriForCaptcha import com.x8bit.bitwarden.data.auth.repository.util.generateUriForSso +import com.x8bit.bitwarden.data.platform.manager.FeatureFlagManager +import com.x8bit.bitwarden.data.platform.manager.model.FlagKey import com.x8bit.bitwarden.data.platform.manager.util.FakeNetworkConnectionManager import com.x8bit.bitwarden.data.platform.repository.EnvironmentRepository import com.x8bit.bitwarden.data.platform.repository.util.FakeEnvironmentRepository @@ -34,6 +38,7 @@ import org.junit.jupiter.api.AfterEach import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.BeforeEach import org.junit.jupiter.api.Test +import java.time.ZonedDateTime @Suppress("LargeClass") class EnterpriseSignOnViewModelTest : BaseViewModelTest() { @@ -54,6 +59,12 @@ class EnterpriseSignOnViewModelTest : BaseViewModelTest() { private val generatorRepository: GeneratorRepository = FakeGeneratorRepository() + private val featureFlagManager = mockk() { + every { + getFeatureFlag(FlagKey.VerifiedSsoDomainEndpoint) + } returns false + } + @BeforeEach fun setUp() { mockkStatic(::generateUriForSso) @@ -694,6 +705,37 @@ class EnterpriseSignOnViewModelTest : BaseViewModelTest() { val orgDetails = OrganizationDomainSsoDetailsResult.Success( isSsoAvailable = false, organizationIdentifier = "Bitwarden without SSO", + verifiedDate = ZonedDateTime.parse("2023-10-27T12:00:00Z"), + ) + + coEvery { + authRepository.getOrganizationDomainSsoDetails(any()) + } returns orgDetails + + coEvery { + authRepository.rememberedOrgIdentifier + } returns "Bitwarden" + + val viewModel = createViewModel(dismissInitialDialog = false) + assertEquals( + DEFAULT_STATE.copy(orgIdentifierInput = "Bitwarden"), + viewModel.stateFlow.value, + ) + + coVerify(exactly = 1) { + authRepository.getOrganizationDomainSsoDetails(DEFAULT_EMAIL) + authRepository.rememberedOrgIdentifier + } + } + + @Suppress("MaxLineLength") + @Test + fun `OrganizationDomainSsoDetails success with no verified date available should make a request, hide the dialog, and update the org input based on the remembered org`() = + runTest { + val orgDetails = OrganizationDomainSsoDetailsResult.Success( + isSsoAvailable = true, + organizationIdentifier = "Bitwarden without SSO", + verifiedDate = null, ) coEvery { @@ -723,6 +765,7 @@ class EnterpriseSignOnViewModelTest : BaseViewModelTest() { val orgDetails = OrganizationDomainSsoDetailsResult.Success( isSsoAvailable = true, organizationIdentifier = "", + verifiedDate = ZonedDateTime.parse("2023-10-27T12:00:00Z"), ) coEvery { @@ -757,6 +800,7 @@ class EnterpriseSignOnViewModelTest : BaseViewModelTest() { val orgDetails = OrganizationDomainSsoDetailsResult.Success( isSsoAvailable = true, organizationIdentifier = "Bitwarden with SSO", + verifiedDate = ZonedDateTime.parse("2023-10-27T12:00:00Z"), ) coEvery { @@ -784,6 +828,109 @@ class EnterpriseSignOnViewModelTest : BaseViewModelTest() { } } + @Suppress("MaxLineLength") + @Test + fun `VerifiedOrganizationDomainSsoDetails success with valid organization should make a request then attempt to login`() = + runTest { + val orgDetails = VerifiedOrganizationDomainSsoDetailsResult.Success( + verifiedOrganizationDomainSsoDetails = listOf( + VerifiedOrganizationDomainSsoDetailsResponse.VerifiedOrganizationDomainSsoDetail( + organizationIdentifier = "Bitwarden with SSO", + organizationName = "Bitwarden", + domainName = "bitwarden.com", + ), + ), + ) + + coEvery { + authRepository.getVerifiedOrganizationDomainSsoDetails(any()) + } returns orgDetails + + coEvery { + featureFlagManager.getFeatureFlag(FlagKey.VerifiedSsoDomainEndpoint) + } returns true + + // Just hang on this request; login is tested elsewhere + coEvery { + authRepository.prevalidateSso(any()) + } just awaits + + val viewModel = createViewModel(dismissInitialDialog = false) + assertEquals( + DEFAULT_STATE.copy( + orgIdentifierInput = "Bitwarden with SSO", + dialogState = EnterpriseSignOnState.DialogState.Loading( + message = R.string.logging_in.asText(), + ), + ), + viewModel.stateFlow.value, + ) + + coVerify(exactly = 1) { + authRepository.getVerifiedOrganizationDomainSsoDetails(DEFAULT_EMAIL) + } + } + + @Suppress("MaxLineLength") + @Test + fun `VerifiedOrganizationDomainSsoDetails success with no verified domains should make a request, hide the dialog, and update the org input based on the remembered org`() = + runTest { + val orgDetails = VerifiedOrganizationDomainSsoDetailsResult.Success( + verifiedOrganizationDomainSsoDetails = emptyList(), + ) + + coEvery { + authRepository.getVerifiedOrganizationDomainSsoDetails(any()) + } returns orgDetails + + coEvery { + featureFlagManager.getFeatureFlag(FlagKey.VerifiedSsoDomainEndpoint) + } returns true + + val viewModel = createViewModel(dismissInitialDialog = false) + assertEquals( + DEFAULT_STATE.copy( + orgIdentifierInput = "", + dialogState = null, + ), + viewModel.stateFlow.value, + ) + + coVerify(exactly = 1) { + authRepository.getVerifiedOrganizationDomainSsoDetails(DEFAULT_EMAIL) + } + } + + @Suppress("MaxLineLength") + @Test + fun `VerifiedOrganizationDomainSsoDetails failure should make a request, hide dialog, load from remembered org identifier`() = + runTest { + coEvery { + authRepository.getVerifiedOrganizationDomainSsoDetails(any()) + } returns VerifiedOrganizationDomainSsoDetailsResult.Failure + + coEvery { + featureFlagManager.getFeatureFlag(FlagKey.VerifiedSsoDomainEndpoint) + } returns true + + coEvery { + authRepository.rememberedOrgIdentifier + } returns "Bitwarden" + + val viewModel = createViewModel(dismissInitialDialog = false) + assertEquals( + DEFAULT_STATE.copy( + orgIdentifierInput = "Bitwarden", + dialogState = null, + ), + viewModel.stateFlow.value, + ) + + coVerify(exactly = 1) { + authRepository.getVerifiedOrganizationDomainSsoDetails(DEFAULT_EMAIL) + } + } + @Suppress("LongParameterList") private fun createViewModel( initialState: EnterpriseSignOnState? = null, @@ -802,6 +949,7 @@ class EnterpriseSignOnViewModelTest : BaseViewModelTest() { ): EnterpriseSignOnViewModel = EnterpriseSignOnViewModel( authRepository = authRepository, environmentRepository = environmentRepository, + featureFlagManager = featureFlagManager, generatorRepository = generatorRepository, networkConnectionManager = FakeNetworkConnectionManager(isNetworkConnected), savedStateHandle = savedStateHandle, diff --git a/app/src/test/java/com/x8bit/bitwarden/ui/platform/feature/debugmenu/DebugMenuViewModelTest.kt b/app/src/test/java/com/x8bit/bitwarden/ui/platform/feature/debugmenu/DebugMenuViewModelTest.kt index 68e509623..3bda50b54 100644 --- a/app/src/test/java/com/x8bit/bitwarden/ui/platform/feature/debugmenu/DebugMenuViewModelTest.kt +++ b/app/src/test/java/com/x8bit/bitwarden/ui/platform/feature/debugmenu/DebugMenuViewModelTest.kt @@ -113,6 +113,7 @@ private val DEFAULT_MAP_VALUE: Map, Any> = mapOf( FlagKey.OnboardingFlow to true, FlagKey.ImportLoginsFlow to true, FlagKey.SshKeyCipherItems to true, + FlagKey.VerifiedSsoDomainEndpoint to true, ) private val UPDATED_MAP_VALUE: Map, Any> = mapOf( @@ -122,6 +123,7 @@ private val UPDATED_MAP_VALUE: Map, Any> = mapOf( FlagKey.OnboardingFlow to false, FlagKey.ImportLoginsFlow to false, FlagKey.SshKeyCipherItems to false, + FlagKey.VerifiedSsoDomainEndpoint to false, ) private val DEFAULT_STATE = DebugMenuState( diff --git a/app/src/test/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/pendingrequests/PendingRequestsScreenTest.kt b/app/src/test/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/pendingrequests/PendingRequestsScreenTest.kt index 6e373b534..2311cc0b2 100644 --- a/app/src/test/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/pendingrequests/PendingRequestsScreenTest.kt +++ b/app/src/test/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/pendingrequests/PendingRequestsScreenTest.kt @@ -1,18 +1,33 @@ package com.x8bit.bitwarden.ui.platform.feature.settings.accountsecurity.pendingrequests +import androidx.compose.ui.semantics.SemanticsActions import androidx.compose.ui.test.assert +import androidx.compose.ui.test.filterToOne import androidx.compose.ui.test.hasAnyAncestor +import androidx.compose.ui.test.hasClickAction import androidx.compose.ui.test.isDialog +import androidx.compose.ui.test.onAllNodesWithText import androidx.compose.ui.test.onNodeWithText import androidx.compose.ui.test.performClick +import androidx.compose.ui.test.performScrollTo +import androidx.compose.ui.test.performSemanticsAction import com.x8bit.bitwarden.data.platform.repository.util.bufferedMutableSharedFlow +import com.x8bit.bitwarden.data.platform.util.isBuildVersionBelow +import com.x8bit.bitwarden.data.platform.util.isFdroid +import com.x8bit.bitwarden.data.util.advanceTimeByAndRunCurrent import com.x8bit.bitwarden.ui.platform.base.BaseComposeTest +import com.x8bit.bitwarden.ui.platform.manager.permissions.FakePermissionManager import com.x8bit.bitwarden.ui.util.assertNoDialogExists import io.mockk.every +import io.mockk.just import io.mockk.mockk +import io.mockk.mockkStatic +import io.mockk.runs +import io.mockk.unmockkStatic import io.mockk.verify import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.test.runTest +import org.junit.After import org.junit.Before import org.junit.Test import org.junit.jupiter.api.Assertions.assertTrue @@ -24,22 +39,38 @@ class PendingRequestsScreenTest : BaseComposeTest() { private val mutableEventFlow = bufferedMutableSharedFlow() private val mutableStateFlow = MutableStateFlow(DEFAULT_STATE) - private val viewModel = mockk(relaxed = true) { + private val viewModel = mockk { every { eventFlow } returns mutableEventFlow every { stateFlow } returns mutableStateFlow + every { trySendAction(any()) } just runs + } + private val permissionsManager = FakePermissionManager().apply { + checkPermissionResult = false + shouldShowRequestRationale = true } @Before fun setUp() { + mockkStatic(::isFdroid) + mockkStatic(::isBuildVersionBelow) + every { isFdroid } returns false + every { isBuildVersionBelow(any()) } returns false composeTestRule.setContent { PendingRequestsScreen( onNavigateBack = { onNavigateBackCalled = true }, onNavigateToLoginApproval = { _ -> onNavigateToLoginApprovalCalled = true }, viewModel = viewModel, + permissionsManager = permissionsManager, ) } } + @After + fun tearDown() { + unmockkStatic(::isFdroid) + unmockkStatic(::isBuildVersionBelow) + } + @Test fun `on NavigateBack should call onNavigateBack`() { mutableEventFlow.tryEmit(PendingRequestsEvent.NavigateBack) @@ -70,6 +101,7 @@ class PendingRequestsScreenTest : BaseComposeTest() { ), ), ), + hideBottomSheet = true, ) composeTestRule.onNodeWithText("Decline all requests").performClick() composeTestRule @@ -101,6 +133,7 @@ class PendingRequestsScreenTest : BaseComposeTest() { ), ), ), + hideBottomSheet = true, ) composeTestRule.onNodeWithText("Decline all requests").performClick() composeTestRule @@ -114,12 +147,36 @@ class PendingRequestsScreenTest : BaseComposeTest() { } } - companion object { - val DEFAULT_STATE: PendingRequestsState = PendingRequestsState( - authRequests = emptyList(), - viewState = PendingRequestsState.ViewState.Loading, - isPullToRefreshSettingEnabled = false, - isRefreshing = false, - ) + @Test + fun `on skip for now click should emit HideBottomSheet`() { + composeTestRule + .onNodeWithText(text = "Skip for now") + .performScrollTo() + .performSemanticsAction(SemanticsActions.OnClick) + dispatcher.advanceTimeByAndRunCurrent(delayTimeMillis = 1000L) + verify(exactly = 1) { + viewModel.trySendAction(PendingRequestsAction.HideBottomSheet) + } + } + + @Test + fun `on Enable notifications click should emit HideBottomSheet`() { + composeTestRule + .onAllNodesWithText(text = "Enable notifications") + .filterToOne(hasClickAction()) + .performScrollTo() + .performSemanticsAction(SemanticsActions.OnClick) + dispatcher.advanceTimeByAndRunCurrent(delayTimeMillis = 1000L) + verify(exactly = 1) { + viewModel.trySendAction(PendingRequestsAction.HideBottomSheet) + } } } + +private val DEFAULT_STATE: PendingRequestsState = PendingRequestsState( + authRequests = emptyList(), + viewState = PendingRequestsState.ViewState.Loading, + isPullToRefreshSettingEnabled = false, + isRefreshing = false, + hideBottomSheet = false, +) diff --git a/app/src/test/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/pendingrequests/PendingRequestsViewModelTest.kt b/app/src/test/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/pendingrequests/PendingRequestsViewModelTest.kt index bdea2ce7c..1637f4803 100644 --- a/app/src/test/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/pendingrequests/PendingRequestsViewModelTest.kt +++ b/app/src/test/java/com/x8bit/bitwarden/ui/platform/feature/settings/accountsecurity/pendingrequests/PendingRequestsViewModelTest.kt @@ -165,6 +165,13 @@ class PendingRequestsViewModelTest : BaseViewModelTest() { } } + @Test + fun `on HideBottomSheet should make hideBottomSheet true`() { + val viewModel = createViewModel() + viewModel.trySendAction(PendingRequestsAction.HideBottomSheet) + assertEquals(DEFAULT_STATE.copy(hideBottomSheet = true), viewModel.stateFlow.value) + } + @Test fun `on RefreshPull should make auth request`() = runTest { val viewModel = createViewModel() @@ -370,13 +377,12 @@ class PendingRequestsViewModelTest : BaseViewModelTest() { settingsRepository = settingsRepository, savedStateHandle = SavedStateHandle().apply { set("state", state) }, ) - - companion object { - val DEFAULT_STATE: PendingRequestsState = PendingRequestsState( - authRequests = emptyList(), - viewState = PendingRequestsState.ViewState.Empty, - isPullToRefreshSettingEnabled = false, - isRefreshing = false, - ) - } } + +private val DEFAULT_STATE: PendingRequestsState = PendingRequestsState( + authRequests = emptyList(), + viewState = PendingRequestsState.ViewState.Empty, + isPullToRefreshSettingEnabled = false, + isRefreshing = false, + hideBottomSheet = false, +) diff --git a/app/src/test/java/com/x8bit/bitwarden/ui/platform/manager/snackbar/SnackbarRelayManagerTest.kt b/app/src/test/java/com/x8bit/bitwarden/ui/platform/manager/snackbar/SnackbarRelayManagerTest.kt index 49e6639c2..46d821325 100644 --- a/app/src/test/java/com/x8bit/bitwarden/ui/platform/manager/snackbar/SnackbarRelayManagerTest.kt +++ b/app/src/test/java/com/x8bit/bitwarden/ui/platform/manager/snackbar/SnackbarRelayManagerTest.kt @@ -66,16 +66,16 @@ class SnackbarRelayManagerTest { fun `When multiple consumers are registered to the same relay, send data to all consumers`() = runTest { val relayManager = SnackbarRelayManagerImpl() - val relay1 = SnackbarRelay.MY_VAULT_RELAY + val relay = SnackbarRelay.MY_VAULT_RELAY val expectedData = BitwardenSnackbarData(message = "Test message".asText()) turbineScope { - val consumer1 = relayManager.getSnackbarDataFlow(relay1).testIn(backgroundScope) - relayManager.sendSnackbarData(data = expectedData, relay = relay1) + val consumer1 = relayManager.getSnackbarDataFlow(relay).testIn(backgroundScope) + relayManager.sendSnackbarData(data = expectedData, relay = relay) assertEquals( expectedData, consumer1.awaitItem(), ) - val consumer2 = relayManager.getSnackbarDataFlow(relay1).testIn(backgroundScope) + val consumer2 = relayManager.getSnackbarDataFlow(relay).testIn(backgroundScope) assertEquals( expectedData, consumer2.awaitItem(), @@ -85,20 +85,40 @@ class SnackbarRelayManagerTest { @Suppress("MaxLineLength") @Test - fun `When multiple consumers are register to the same relay, and one is completed before the other the second consumer registers should not receive any emissions`() = + fun `When multiple consumers are registered to the same relay, and one is completed before the other the second consumer registers should not receive any emissions`() = runTest { val relayManager = SnackbarRelayManagerImpl() - val relay1 = SnackbarRelay.MY_VAULT_RELAY + val relay = SnackbarRelay.MY_VAULT_RELAY val expectedData = BitwardenSnackbarData(message = "Test message".asText()) turbineScope { - val consumer1 = relayManager.getSnackbarDataFlow(relay1).testIn(backgroundScope) - relayManager.sendSnackbarData(data = expectedData, relay = relay1) + val consumer1 = relayManager.getSnackbarDataFlow(relay).testIn(backgroundScope) + relayManager.sendSnackbarData(data = expectedData, relay = relay) assertEquals( expectedData, consumer1.awaitItem(), ) consumer1.cancel() - val consumer2 = relayManager.getSnackbarDataFlow(relay1).testIn(backgroundScope) + val consumer2 = relayManager.getSnackbarDataFlow(relay).testIn(backgroundScope) + consumer2.expectNoEvents() + } + } + + @Suppress("MaxLineLength") + @Test + fun `When multiple consumers register to the same relay, and clearRelayBuffer is called, the second consumer should not receive any emissions`() = + runTest { + val relayManager = SnackbarRelayManagerImpl() + val relay = SnackbarRelay.MY_VAULT_RELAY + val expectedData = BitwardenSnackbarData(message = "Test message".asText()) + turbineScope { + val consumer1 = relayManager.getSnackbarDataFlow(relay).testIn(backgroundScope) + relayManager.sendSnackbarData(data = expectedData, relay = relay) + assertEquals( + expectedData, + consumer1.awaitItem(), + ) + relayManager.clearRelayBuffer(relay) + val consumer2 = relayManager.getSnackbarDataFlow(relay).testIn(backgroundScope) consumer2.expectNoEvents() } } diff --git a/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/addedit/VaultAddEditViewModelTest.kt b/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/addedit/VaultAddEditViewModelTest.kt index e62191f8a..1347c36c1 100644 --- a/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/addedit/VaultAddEditViewModelTest.kt +++ b/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/addedit/VaultAddEditViewModelTest.kt @@ -45,6 +45,7 @@ import com.x8bit.bitwarden.data.vault.datasource.network.model.OrganizationType import com.x8bit.bitwarden.data.vault.datasource.network.model.PolicyTypeJson import com.x8bit.bitwarden.data.vault.datasource.network.model.SyncResponseJson import com.x8bit.bitwarden.data.vault.datasource.sdk.model.createMockCipherView +import com.x8bit.bitwarden.data.vault.datasource.sdk.model.createMockCollectionView import com.x8bit.bitwarden.data.vault.datasource.sdk.model.createMockSdkFido2CredentialList import com.x8bit.bitwarden.data.vault.repository.VaultRepository import com.x8bit.bitwarden.data.vault.repository.model.CreateCipherResult @@ -1195,6 +1196,136 @@ class VaultAddEditViewModelTest : BaseViewModelTest() { } } + @Suppress("MaxLineLength") + @Test + fun `in edit mode, canDelete should be false when cipher is in a collection the user cannot manage`() = + runTest { + val cipherView = createMockCipherView(1) + val vaultAddEditType = VaultAddEditType.EditItem(DEFAULT_EDIT_ITEM_ID) + val stateWithName = createVaultAddItemState( + vaultAddEditType = vaultAddEditType, + commonContentViewState = createCommonContentViewState( + name = "mockName-1", + originalCipher = cipherView, + customFieldData = listOf( + VaultAddEditState.Custom.HiddenField( + itemId = "testId", + name = "mockName-1", + value = "mockValue-1", + ), + ), + notes = "mockNotes-1", + canDelete = false, + ), + ) + + every { + cipherView.toViewState( + isClone = false, + isIndividualVaultDisabled = false, + totpData = null, + resourceManager = resourceManager, + clock = fixedClock, + canDelete = false, + ) + } returns stateWithName.viewState + + mutableVaultDataFlow.value = DataState.Loaded( + data = createVaultData( + cipherView = cipherView, + collectionViewList = listOf( + createMockCollectionView( + number = 1, + manage = false, + ), + ), + ), + ) + + createAddVaultItemViewModel( + createSavedStateHandleWithState( + state = stateWithName, + vaultAddEditType = vaultAddEditType, + ), + ) + + verify { + cipherView.toViewState( + isClone = false, + isIndividualVaultDisabled = false, + totpData = null, + resourceManager = resourceManager, + clock = fixedClock, + canDelete = false, + ) + } + } + + @Suppress("MaxLineLength") + @Test + fun `in edit mode, canDelete should be true when cipher is in a collection the user can manage`() = + runTest { + val cipherView = createMockCipherView(1) + val vaultAddEditType = VaultAddEditType.EditItem(DEFAULT_EDIT_ITEM_ID) + val stateWithName = createVaultAddItemState( + vaultAddEditType = vaultAddEditType, + commonContentViewState = createCommonContentViewState( + name = "mockName-1", + originalCipher = cipherView, + customFieldData = listOf( + VaultAddEditState.Custom.HiddenField( + itemId = "testId", + name = "mockName-1", + value = "mockValue-1", + ), + ), + notes = "mockNotes-1", + canDelete = true, + ), + ) + + every { + cipherView.toViewState( + isClone = false, + isIndividualVaultDisabled = false, + totpData = null, + resourceManager = resourceManager, + clock = fixedClock, + canDelete = true, + ) + } returns stateWithName.viewState + + mutableVaultDataFlow.value = DataState.Loaded( + data = createVaultData( + cipherView = cipherView, + collectionViewList = listOf( + createMockCollectionView( + number = 1, + manage = true, + ), + ), + ), + ) + + createAddVaultItemViewModel( + createSavedStateHandleWithState( + state = stateWithName, + vaultAddEditType = vaultAddEditType, + ), + ) + + verify { + cipherView.toViewState( + isClone = false, + isIndividualVaultDisabled = false, + totpData = null, + resourceManager = resourceManager, + clock = fixedClock, + canDelete = true, + ) + } + } + @Test fun `in edit mode, updateCipher success should ShowToast and NavigateBack`() = runTest { @@ -1310,6 +1441,7 @@ class VaultAddEditViewModelTest : BaseViewModelTest() { totpData = null, resourceManager = resourceManager, clock = fixedClock, + canDelete = true, ) } returns stateWithName.viewState mutableVaultDataFlow.value = DataState.Loaded( @@ -1341,6 +1473,7 @@ class VaultAddEditViewModelTest : BaseViewModelTest() { totpData = null, resourceManager = resourceManager, clock = fixedClock, + canDelete = true, ) vaultRepository.updateCipher(DEFAULT_EDIT_ITEM_ID, any()) } @@ -1375,6 +1508,7 @@ class VaultAddEditViewModelTest : BaseViewModelTest() { totpData = null, resourceManager = resourceManager, clock = fixedClock, + canDelete = true, ) } returns stateWithName.viewState coEvery { @@ -1437,6 +1571,7 @@ class VaultAddEditViewModelTest : BaseViewModelTest() { totpData = null, resourceManager = resourceManager, clock = fixedClock, + canDelete = true, ) } returns stateWithName.viewState coEvery { @@ -1502,6 +1637,7 @@ class VaultAddEditViewModelTest : BaseViewModelTest() { totpData = null, resourceManager = resourceManager, clock = fixedClock, + canDelete = true, ) } returns stateWithName.viewState mutableVaultDataFlow.value = DataState.Loaded( @@ -1558,6 +1694,7 @@ class VaultAddEditViewModelTest : BaseViewModelTest() { totpData = null, resourceManager = resourceManager, clock = fixedClock, + canDelete = true, ) } returns stateWithName.viewState every { fido2CredentialManager.isUserVerified } returns true @@ -1619,6 +1756,7 @@ class VaultAddEditViewModelTest : BaseViewModelTest() { totpData = null, resourceManager = resourceManager, clock = fixedClock, + canDelete = true, ) } returns stateWithName.viewState every { fido2CredentialManager.isUserVerified } returns false @@ -3982,6 +4120,7 @@ class VaultAddEditViewModelTest : BaseViewModelTest() { availableOwners: List = createOwnerList(), selectedOwnerId: String? = null, hasOrganizations: Boolean = true, + canDelete: Boolean = true, ): VaultAddEditState.ViewState.Content.Common = VaultAddEditState.ViewState.Content.Common( name = name, @@ -3995,6 +4134,7 @@ class VaultAddEditViewModelTest : BaseViewModelTest() { availableFolders = availableFolders, availableOwners = availableOwners, hasOrganizations = hasOrganizations, + canDelete = canDelete, ) @Suppress("LongParameterList") diff --git a/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/addedit/util/CipherViewExtensionsTest.kt b/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/addedit/util/CipherViewExtensionsTest.kt index 0d6328799..a2ddb3963 100644 --- a/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/addedit/util/CipherViewExtensionsTest.kt +++ b/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/addedit/util/CipherViewExtensionsTest.kt @@ -75,6 +75,7 @@ class CipherViewExtensionsTest { totpData = null, resourceManager = resourceManager, clock = FIXED_CLOCK, + canDelete = true, ) assertEquals( @@ -121,6 +122,7 @@ class CipherViewExtensionsTest { totpData = null, resourceManager = resourceManager, clock = FIXED_CLOCK, + canDelete = true, ) assertEquals( @@ -172,6 +174,7 @@ class CipherViewExtensionsTest { totpData = null, resourceManager = resourceManager, clock = FIXED_CLOCK, + canDelete = true, ) assertEquals( @@ -232,6 +235,7 @@ class CipherViewExtensionsTest { totpData = mockk { every { uri } returns totp }, resourceManager = resourceManager, clock = FIXED_CLOCK, + canDelete = true, ) assertEquals( @@ -289,6 +293,7 @@ class CipherViewExtensionsTest { totpData = null, resourceManager = resourceManager, clock = FIXED_CLOCK, + canDelete = true, ) assertEquals( @@ -324,6 +329,7 @@ class CipherViewExtensionsTest { totpData = null, resourceManager = resourceManager, clock = FIXED_CLOCK, + canDelete = true, ) assertEquals( @@ -368,6 +374,7 @@ class CipherViewExtensionsTest { totpData = null, resourceManager = resourceManager, clock = FIXED_CLOCK, + canDelete = true, ) assertEquals( diff --git a/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/item/VaultItemScreenTest.kt b/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/item/VaultItemScreenTest.kt index dbcd02847..cb008adb0 100644 --- a/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/item/VaultItemScreenTest.kt +++ b/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/item/VaultItemScreenTest.kt @@ -780,22 +780,39 @@ class VaultItemScreenTest : BaseComposeTest() { } @Test - fun `menu Delete option click should be displayed`() { - - // Confirm dropdown version of item is absent + fun `menu Delete option should be displayed based on state`() { + // Confirm overflow is closed on initial load composeTestRule .onAllNodesWithText("Delete") .filter(hasAnyAncestor(isPopup())) .assertCountEquals(0) + // Open the overflow menu composeTestRule .onNodeWithContentDescription("More") .performClick() - // Click on the delete item in the dropdown + + // Confirm Delete option is present + mutableStateFlow.update { it.copy(viewState = DEFAULT_LOGIN_VIEW_STATE) } composeTestRule .onAllNodesWithText("Delete") .filterToOne(hasAnyAncestor(isPopup())) .assertIsDisplayed() + + // Confirm Delete option is not present when canDelete is false + mutableStateFlow.update { + it.copy( + viewState = DEFAULT_LOGIN_VIEW_STATE + .copy( + common = DEFAULT_COMMON + .copy(canDelete = false), + ), + ) + } + composeTestRule + .onAllNodesWithText("Delete") + .filter(hasAnyAncestor(isPopup())) + .assertCountEquals(0) } @Test @@ -1166,6 +1183,7 @@ class VaultItemScreenTest : BaseComposeTest() { @Test fun `Menu should display correct items when cipher is not in a collection`() { + mutableStateFlow.update { it.copy(viewState = DEFAULT_LOGIN_VIEW_STATE) } composeTestRule .onNodeWithContentDescription("More") .performClick() @@ -2374,6 +2392,7 @@ private val DEFAULT_COMMON: VaultItemState.ViewState.Content.Common = title = "test.mp4", ), ), + canDelete = true, ) private val DEFAULT_PASSKEY = R.string.created_xy.asText( @@ -2455,6 +2474,7 @@ private val EMPTY_COMMON: VaultItemState.ViewState.Content.Common = requiresReprompt = true, requiresCloneConfirmation = false, attachments = emptyList(), + canDelete = true, ) private val EMPTY_LOGIN_TYPE: VaultItemState.ViewState.Content.ItemType.Login = diff --git a/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/item/VaultItemViewModelTest.kt b/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/item/VaultItemViewModelTest.kt index 560de35a1..e351a8281 100644 --- a/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/item/VaultItemViewModelTest.kt +++ b/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/item/VaultItemViewModelTest.kt @@ -4,6 +4,7 @@ import android.net.Uri import androidx.lifecycle.SavedStateHandle import app.cash.turbine.test import com.bitwarden.vault.CipherView +import com.bitwarden.vault.CollectionView import com.x8bit.bitwarden.R import com.x8bit.bitwarden.data.auth.datasource.disk.model.OnboardingStatus import com.x8bit.bitwarden.data.auth.repository.AuthRepository @@ -17,6 +18,7 @@ import com.x8bit.bitwarden.data.platform.manager.model.OrganizationEvent import com.x8bit.bitwarden.data.platform.repository.model.DataState import com.x8bit.bitwarden.data.platform.repository.model.Environment import com.x8bit.bitwarden.data.vault.datasource.sdk.model.createMockCipherView +import com.x8bit.bitwarden.data.vault.datasource.sdk.model.createMockCollectionView import com.x8bit.bitwarden.data.vault.manager.FileManager import com.x8bit.bitwarden.data.vault.manager.model.VerificationCodeItem import com.x8bit.bitwarden.data.vault.repository.VaultRepository @@ -59,6 +61,8 @@ class VaultItemViewModelTest : BaseViewModelTest() { private val mutableAuthCodeItemFlow = MutableStateFlow>(DataState.Loading) private val mutableUserStateFlow = MutableStateFlow(DEFAULT_USER_STATE) + private val mutableCollectionsStateFlow = + MutableStateFlow>>(DataState.Loading) private val clipboardManager: BitwardenClipboardManager = mockk() private val authRepo: AuthRepository = mockk { @@ -67,6 +71,7 @@ class VaultItemViewModelTest : BaseViewModelTest() { private val vaultRepo: VaultRepository = mockk { every { getAuthCodeFlow(VAULT_ITEM_ID) } returns mutableAuthCodeItemFlow every { getVaultItemStateFlow(VAULT_ITEM_ID) } returns mutableVaultItemFlow + every { collectionsStateFlow } returns mutableCollectionsStateFlow } private val mockFileManager: FileManager = mockk() @@ -151,6 +156,105 @@ class VaultItemViewModelTest : BaseViewModelTest() { assertEquals(initialState.copy(dialog = null), viewModel.stateFlow.value) } + @Test + fun `canDelete should be true when collections are empty`() = runTest { + val mockCipherView = mockk { + every { + toViewState( + previousState = null, + isPremiumUser = true, + hasMasterPassword = true, + totpCodeItemData = null, + canDelete = true, + ) + } returns DEFAULT_VIEW_STATE + } + mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView) + mutableAuthCodeItemFlow.value = DataState.Loaded(data = null) + mutableCollectionsStateFlow.value = DataState.Loaded(emptyList()) + verify { + mockCipherView.toViewState( + previousState = null, + isPremiumUser = true, + hasMasterPassword = true, + totpCodeItemData = null, + canDelete = true, + ) + } + } + + @Suppress("MaxLineLength") + @Test + fun `canDelete should be false when cipher is in a collection that the user cannot manage`() = + runTest { + val mockCipherView = mockk { + every { collectionIds } returns listOf("mockId-1", "mockId-2") + every { + toViewState( + previousState = null, + isPremiumUser = true, + hasMasterPassword = true, + totpCodeItemData = null, + canDelete = false, + ) + } returns DEFAULT_VIEW_STATE + } + mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView) + mutableAuthCodeItemFlow.value = DataState.Loaded(data = null) + mutableCollectionsStateFlow.value = DataState.Loaded( + data = listOf( + createMockCollectionView(number = 1) + .copy(manage = false), + createMockCollectionView(number = 2) + .copy(manage = true), + ), + ) + verify { + mockCipherView.toViewState( + previousState = null, + isPremiumUser = true, + hasMasterPassword = true, + totpCodeItemData = null, + canDelete = false, + ) + } + } + + @Test + fun `canDelete should be true when cipher is not in collections`() { + val mockCipherView = mockk { + every { collectionIds } returns listOf("mockId-3") + every { + toViewState( + previousState = null, + isPremiumUser = true, + hasMasterPassword = true, + totpCodeItemData = null, + canDelete = true, + ) + } returns DEFAULT_VIEW_STATE + } + mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView) + mutableAuthCodeItemFlow.value = DataState.Loaded(data = null) + mutableCollectionsStateFlow.value = DataState.Loaded( + data = listOf( + createMockCollectionView(number = 1) + .copy(manage = false), + createMockCollectionView(number = 2) + .copy(manage = false), + ), + ) + verify { + mockCipherView.toViewState( + previousState = null, + isPremiumUser = true, + hasMasterPassword = true, + totpCodeItemData = null, + canDelete = true, + ) + } + } + @Test fun `DeleteClick should show password dialog when re-prompt is required`() = runTest { @@ -162,11 +266,13 @@ class VaultItemViewModelTest : BaseViewModelTest() { isPremiumUser = true, hasMasterPassword = true, totpCodeItemData = null, + canDelete = true, ) } returns DEFAULT_VIEW_STATE } mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView) mutableAuthCodeItemFlow.value = DataState.Loaded(data = null) + mutableCollectionsStateFlow.value = DataState.Loaded(emptyList()) assertEquals(loginState, viewModel.stateFlow.value) viewModel.trySendAction(VaultItemAction.Common.DeleteClick) @@ -185,6 +291,7 @@ class VaultItemViewModelTest : BaseViewModelTest() { isPremiumUser = true, hasMasterPassword = true, totpCodeItemData = null, + canDelete = true, ) } } @@ -204,6 +311,7 @@ class VaultItemViewModelTest : BaseViewModelTest() { isPremiumUser = true, hasMasterPassword = true, totpCodeItemData = null, + canDelete = true, ) } returns loginState } @@ -221,6 +329,7 @@ class VaultItemViewModelTest : BaseViewModelTest() { mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView) mutableAuthCodeItemFlow.value = DataState.Loaded(data = null) + mutableCollectionsStateFlow.value = DataState.Loaded(emptyList()) viewModel.trySendAction(VaultItemAction.Common.DeleteClick) assertEquals(expected, viewModel.stateFlow.value) @@ -247,6 +356,7 @@ class VaultItemViewModelTest : BaseViewModelTest() { isPremiumUser = true, hasMasterPassword = true, totpCodeItemData = null, + canDelete = true, ) } returns loginState } @@ -260,6 +370,7 @@ class VaultItemViewModelTest : BaseViewModelTest() { mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView) mutableAuthCodeItemFlow.value = DataState.Loaded(data = null) + mutableCollectionsStateFlow.value = DataState.Loaded(emptyList()) viewModel.trySendAction(VaultItemAction.Common.DeleteClick) assertEquals(expected, viewModel.stateFlow.value) @@ -279,12 +390,14 @@ class VaultItemViewModelTest : BaseViewModelTest() { isPremiumUser = true, hasMasterPassword = true, totpCodeItemData = createTotpCodeData(), + canDelete = true, ) } returns loginViewState } mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView) mutableAuthCodeItemFlow.value = DataState.Loaded(data = createVerificationCodeItem()) + mutableCollectionsStateFlow.value = DataState.Loaded(emptyList()) val viewModel = createViewModel(state = DEFAULT_STATE) coEvery { @@ -322,11 +435,13 @@ class VaultItemViewModelTest : BaseViewModelTest() { isPremiumUser = true, hasMasterPassword = true, totpCodeItemData = null, + canDelete = true, ) } returns loginViewState } mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView) mutableAuthCodeItemFlow.value = DataState.Loaded(data = null) + mutableCollectionsStateFlow.value = DataState.Loaded(emptyList()) val viewModel = createViewModel(state = DEFAULT_STATE) coEvery { @@ -368,12 +483,14 @@ class VaultItemViewModelTest : BaseViewModelTest() { isPremiumUser = true, hasMasterPassword = true, totpCodeItemData = createTotpCodeData(), + canDelete = true, ) } returns loginViewState } mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView) mutableAuthCodeItemFlow.value = DataState.Loaded(data = createVerificationCodeItem()) + mutableCollectionsStateFlow.value = DataState.Loaded(emptyList()) val viewModel = createViewModel(state = DEFAULT_STATE) coEvery { @@ -406,11 +523,13 @@ class VaultItemViewModelTest : BaseViewModelTest() { isPremiumUser = true, hasMasterPassword = true, totpCodeItemData = createTotpCodeData(), + canDelete = true, ) } returns DEFAULT_VIEW_STATE } mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView) mutableAuthCodeItemFlow.value = DataState.Loaded(data = createVerificationCodeItem()) + mutableCollectionsStateFlow.value = DataState.Loaded(emptyList()) val loginState = DEFAULT_STATE.copy(viewState = DEFAULT_VIEW_STATE) val viewModel = createViewModel(state = loginState) assertEquals(loginState, viewModel.stateFlow.value) @@ -439,12 +558,14 @@ class VaultItemViewModelTest : BaseViewModelTest() { isPremiumUser = true, hasMasterPassword = true, totpCodeItemData = createTotpCodeData(), + canDelete = true, ) } returns viewState } mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView) mutableAuthCodeItemFlow.value = DataState.Loaded(data = createVerificationCodeItem()) + mutableCollectionsStateFlow.value = DataState.Loaded(emptyList()) val loginState = DEFAULT_STATE.copy(viewState = viewState) val viewModel = createViewModel(state = loginState) assertEquals(loginState, viewModel.stateFlow.value) @@ -476,6 +597,7 @@ class VaultItemViewModelTest : BaseViewModelTest() { isPremiumUser = true, hasMasterPassword = true, totpCodeItemData = createTotpCodeData(), + canDelete = true, ) } returns DEFAULT_VIEW_STATE } @@ -483,6 +605,7 @@ class VaultItemViewModelTest : BaseViewModelTest() { mutableAuthCodeItemFlow.value = DataState.Loaded( data = createVerificationCodeItem(), ) + mutableCollectionsStateFlow.value = DataState.Loaded(emptyList()) val viewModel = createViewModel(state = DEFAULT_STATE) coEvery { @@ -516,11 +639,13 @@ class VaultItemViewModelTest : BaseViewModelTest() { isPremiumUser = true, hasMasterPassword = true, totpCodeItemData = createTotpCodeData(), + canDelete = true, ) } returns DEFAULT_VIEW_STATE } mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView) mutableAuthCodeItemFlow.value = DataState.Loaded(data = createVerificationCodeItem()) + mutableCollectionsStateFlow.value = DataState.Loaded(emptyList()) val viewModel = createViewModel(state = DEFAULT_STATE) coEvery { @@ -565,11 +690,13 @@ class VaultItemViewModelTest : BaseViewModelTest() { isPremiumUser = true, hasMasterPassword = true, totpCodeItemData = createTotpCodeData(), + canDelete = true, ) } returns DEFAULT_VIEW_STATE } mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView) mutableAuthCodeItemFlow.value = DataState.Loaded(data = createVerificationCodeItem()) + mutableCollectionsStateFlow.value = DataState.Loaded(emptyList()) val loginState = DEFAULT_STATE.copy(viewState = DEFAULT_VIEW_STATE) val viewModel = createViewModel(state = loginState) assertEquals(loginState, viewModel.stateFlow.value) @@ -597,11 +724,13 @@ class VaultItemViewModelTest : BaseViewModelTest() { isPremiumUser = true, hasMasterPassword = true, totpCodeItemData = null, + canDelete = true, ) } returns loginViewState } mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView) mutableAuthCodeItemFlow.value = DataState.Loaded(data = null) + mutableCollectionsStateFlow.value = DataState.Loaded(emptyList()) val loginState = DEFAULT_STATE.copy(viewState = loginViewState) val viewModel = createViewModel(state = loginState) @@ -613,6 +742,7 @@ class VaultItemViewModelTest : BaseViewModelTest() { isPremiumUser = true, hasMasterPassword = true, totpCodeItemData = null, + canDelete = true, ) } assertEquals( @@ -638,6 +768,7 @@ class VaultItemViewModelTest : BaseViewModelTest() { previousState = any(), isPremiumUser = true, hasMasterPassword = true, + canDelete = true, totpCodeItemData = null, ) } returns loginViewState @@ -648,6 +779,7 @@ class VaultItemViewModelTest : BaseViewModelTest() { } returns ValidatePasswordResult.Success(isValid = true) mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView) mutableAuthCodeItemFlow.value = DataState.Loaded(data = null) + mutableCollectionsStateFlow.value = DataState.Loaded(emptyList()) val loginState = DEFAULT_STATE.copy(viewState = loginViewState) val viewModel = createViewModel(state = loginState) @@ -699,6 +831,7 @@ class VaultItemViewModelTest : BaseViewModelTest() { previousState = any(), isPremiumUser = true, hasMasterPassword = true, + canDelete = true, totpCodeItemData = null, ) } returns loginViewState @@ -709,6 +842,7 @@ class VaultItemViewModelTest : BaseViewModelTest() { } returns ValidatePasswordResult.Success(isValid = false) mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView) mutableAuthCodeItemFlow.value = DataState.Loaded(data = null) + mutableCollectionsStateFlow.value = DataState.Loaded(emptyList()) val loginState = DEFAULT_STATE.copy(viewState = loginViewState) val viewModel = createViewModel(state = loginState) @@ -752,6 +886,7 @@ class VaultItemViewModelTest : BaseViewModelTest() { previousState = any(), isPremiumUser = true, hasMasterPassword = true, + canDelete = true, totpCodeItemData = null, ) } returns loginViewState @@ -762,6 +897,7 @@ class VaultItemViewModelTest : BaseViewModelTest() { } returns ValidatePasswordResult.Error mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView) mutableAuthCodeItemFlow.value = DataState.Loaded(data = null) + mutableCollectionsStateFlow.value = DataState.Loaded(emptyList()) val loginState = DEFAULT_STATE.copy(viewState = loginViewState) val viewModel = createViewModel(state = loginState) @@ -816,12 +952,14 @@ class VaultItemViewModelTest : BaseViewModelTest() { previousState = null, isPremiumUser = true, hasMasterPassword = true, + canDelete = true, totpCodeItemData = null, ) } returns DEFAULT_VIEW_STATE } mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView) mutableAuthCodeItemFlow.value = DataState.Loaded(data = null) + mutableCollectionsStateFlow.value = DataState.Loaded(emptyList()) assertEquals(loginState, viewModel.stateFlow.value) viewModel.trySendAction(VaultItemAction.Common.CopyCustomHiddenFieldClick("field")) @@ -839,6 +977,7 @@ class VaultItemViewModelTest : BaseViewModelTest() { previousState = null, isPremiumUser = true, hasMasterPassword = true, + canDelete = true, totpCodeItemData = null, ) } @@ -854,6 +993,7 @@ class VaultItemViewModelTest : BaseViewModelTest() { previousState = null, isPremiumUser = true, hasMasterPassword = true, + canDelete = true, totpCodeItemData = null, ) } returns createViewState(common = DEFAULT_COMMON.copy(requiresReprompt = false)) @@ -862,6 +1002,7 @@ class VaultItemViewModelTest : BaseViewModelTest() { mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView) mutableAuthCodeItemFlow.value = DataState.Loaded(data = null) + mutableCollectionsStateFlow.value = DataState.Loaded(emptyList()) viewModel.trySendAction(VaultItemAction.Common.CopyCustomHiddenFieldClick(field)) @@ -871,6 +1012,7 @@ class VaultItemViewModelTest : BaseViewModelTest() { previousState = null, isPremiumUser = true, hasMasterPassword = true, + canDelete = true, totpCodeItemData = null, ) organizationEventManager.trackEvent( @@ -910,12 +1052,14 @@ class VaultItemViewModelTest : BaseViewModelTest() { previousState = null, isPremiumUser = true, hasMasterPassword = true, + canDelete = true, totpCodeItemData = null, ) } returns DEFAULT_VIEW_STATE } mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView) mutableAuthCodeItemFlow.value = DataState.Loaded(data = null) + mutableCollectionsStateFlow.value = DataState.Loaded(emptyList()) assertEquals(loginState, viewModel.stateFlow.value) viewModel.trySendAction( @@ -941,6 +1085,7 @@ class VaultItemViewModelTest : BaseViewModelTest() { previousState = null, isPremiumUser = true, hasMasterPassword = true, + canDelete = true, totpCodeItemData = null, ) } @@ -974,11 +1119,13 @@ class VaultItemViewModelTest : BaseViewModelTest() { isPremiumUser = true, hasMasterPassword = true, totpCodeItemData = null, + canDelete = true, ) } returns loginViewState } mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView) mutableAuthCodeItemFlow.value = DataState.Loaded(data = null) + mutableCollectionsStateFlow.value = DataState.Loaded(emptyList()) assertEquals(loginState, viewModel.stateFlow.value) viewModel.trySendAction( @@ -1004,6 +1151,7 @@ class VaultItemViewModelTest : BaseViewModelTest() { previousState = null, isPremiumUser = true, hasMasterPassword = true, + canDelete = true, totpCodeItemData = null, ) organizationEventManager.trackEvent( @@ -1024,12 +1172,14 @@ class VaultItemViewModelTest : BaseViewModelTest() { previousState = null, isPremiumUser = true, hasMasterPassword = true, + canDelete = true, totpCodeItemData = null, ) } returns DEFAULT_VIEW_STATE } mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView) mutableAuthCodeItemFlow.value = DataState.Loaded(data = null) + mutableCollectionsStateFlow.value = DataState.Loaded(emptyList()) assertEquals(loginState, viewModel.stateFlow.value) viewModel.trySendAction(VaultItemAction.Common.AttachmentsClick) @@ -1047,6 +1197,7 @@ class VaultItemViewModelTest : BaseViewModelTest() { previousState = null, isPremiumUser = true, hasMasterPassword = true, + canDelete = true, totpCodeItemData = null, ) } @@ -1066,12 +1217,14 @@ class VaultItemViewModelTest : BaseViewModelTest() { previousState = null, isPremiumUser = true, hasMasterPassword = true, + canDelete = true, totpCodeItemData = null, ) } returns loginViewState } mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView) mutableAuthCodeItemFlow.value = DataState.Loaded(data = null) + mutableCollectionsStateFlow.value = DataState.Loaded(emptyList()) assertEquals(loginState, viewModel.stateFlow.value) @@ -1100,12 +1253,14 @@ class VaultItemViewModelTest : BaseViewModelTest() { previousState = null, isPremiumUser = true, hasMasterPassword = true, + canDelete = true, totpCodeItemData = null, ) } returns loginViewState } mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView) mutableAuthCodeItemFlow.value = DataState.Loaded(data = null) + mutableCollectionsStateFlow.value = DataState.Loaded(emptyList()) assertEquals(loginState, viewModel.stateFlow.value) @@ -1125,6 +1280,7 @@ class VaultItemViewModelTest : BaseViewModelTest() { previousState = null, isPremiumUser = true, hasMasterPassword = true, + canDelete = true, totpCodeItemData = null, ) } @@ -1148,12 +1304,14 @@ class VaultItemViewModelTest : BaseViewModelTest() { previousState = null, isPremiumUser = true, hasMasterPassword = true, + canDelete = true, totpCodeItemData = null, ) } returns loginViewState } mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView) mutableAuthCodeItemFlow.value = DataState.Loaded(data = null) + mutableCollectionsStateFlow.value = DataState.Loaded(emptyList()) assertEquals(loginState, viewModel.stateFlow.value) viewModel.trySendAction(VaultItemAction.Common.CloneClick) @@ -1196,12 +1354,14 @@ class VaultItemViewModelTest : BaseViewModelTest() { previousState = null, isPremiumUser = true, hasMasterPassword = true, + canDelete = true, totpCodeItemData = null, ) } returns DEFAULT_VIEW_STATE } mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView) mutableAuthCodeItemFlow.value = DataState.Loaded(data = null) + mutableCollectionsStateFlow.value = DataState.Loaded(emptyList()) assertEquals(loginState, viewModel.stateFlow.value) viewModel.trySendAction(VaultItemAction.Common.CloneClick) @@ -1219,6 +1379,7 @@ class VaultItemViewModelTest : BaseViewModelTest() { previousState = null, isPremiumUser = true, hasMasterPassword = true, + canDelete = true, totpCodeItemData = null, ) } @@ -1238,12 +1399,14 @@ class VaultItemViewModelTest : BaseViewModelTest() { previousState = null, isPremiumUser = true, hasMasterPassword = true, + canDelete = true, totpCodeItemData = null, ) } returns loginViewState } mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView) mutableAuthCodeItemFlow.value = DataState.Loaded(data = null) + mutableCollectionsStateFlow.value = DataState.Loaded(emptyList()) assertEquals(loginState, viewModel.stateFlow.value) @@ -1269,12 +1432,14 @@ class VaultItemViewModelTest : BaseViewModelTest() { previousState = null, isPremiumUser = true, hasMasterPassword = true, + canDelete = true, totpCodeItemData = null, ) } returns DEFAULT_VIEW_STATE } mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView) mutableAuthCodeItemFlow.value = DataState.Loaded(data = null) + mutableCollectionsStateFlow.value = DataState.Loaded(emptyList()) assertEquals(loginState, viewModel.stateFlow.value) viewModel.trySendAction(VaultItemAction.Common.MoveToOrganizationClick) @@ -1292,6 +1457,7 @@ class VaultItemViewModelTest : BaseViewModelTest() { previousState = null, isPremiumUser = true, hasMasterPassword = true, + canDelete = true, totpCodeItemData = null, ) } @@ -1311,12 +1477,14 @@ class VaultItemViewModelTest : BaseViewModelTest() { previousState = null, isPremiumUser = true, hasMasterPassword = true, + canDelete = true, totpCodeItemData = null, ) } returns loginViewState } mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView) mutableAuthCodeItemFlow.value = DataState.Loaded(data = null) + mutableCollectionsStateFlow.value = DataState.Loaded(emptyList()) assertEquals(loginState, viewModel.stateFlow.value) @@ -1353,12 +1521,14 @@ class VaultItemViewModelTest : BaseViewModelTest() { previousState = any(), isPremiumUser = true, hasMasterPassword = true, + canDelete = true, totpCodeItemData = null, ) } returns loginViewState } mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView) mutableAuthCodeItemFlow.value = DataState.Loaded(data = null) + mutableCollectionsStateFlow.value = DataState.Loaded(emptyList()) val loginState = DEFAULT_STATE.copy(viewState = loginViewState) val viewModel = createViewModel(state = loginState) @@ -1409,12 +1579,14 @@ class VaultItemViewModelTest : BaseViewModelTest() { previousState = any(), isPremiumUser = true, hasMasterPassword = true, + canDelete = true, totpCodeItemData = null, ) } returns loginViewState } mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView) mutableAuthCodeItemFlow.value = DataState.Loaded(data = null) + mutableCollectionsStateFlow.value = DataState.Loaded(emptyList()) val loginState = DEFAULT_STATE.copy(viewState = loginViewState) val viewModel = createViewModel(state = loginState) @@ -1474,12 +1646,14 @@ class VaultItemViewModelTest : BaseViewModelTest() { previousState = any(), isPremiumUser = true, hasMasterPassword = true, + canDelete = true, totpCodeItemData = null, ) } returns loginViewState } mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView) mutableAuthCodeItemFlow.value = DataState.Loaded(data = null) + mutableCollectionsStateFlow.value = DataState.Loaded(emptyList()) val loginState = DEFAULT_STATE.copy(viewState = loginViewState) val viewModel = createViewModel(state = loginState) @@ -1652,6 +1826,7 @@ class VaultItemViewModelTest : BaseViewModelTest() { previousState = null, isPremiumUser = true, hasMasterPassword = true, + canDelete = true, totpCodeItemData = createTotpCodeData(), ) } returns DEFAULT_VIEW_STATE @@ -1659,6 +1834,7 @@ class VaultItemViewModelTest : BaseViewModelTest() { mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView) mutableAuthCodeItemFlow.value = DataState.Loaded(data = createVerificationCodeItem()) + mutableCollectionsStateFlow.value = DataState.Loaded(emptyList()) val loginState = DEFAULT_STATE.copy(viewState = DEFAULT_VIEW_STATE) val breachCount = 5 @@ -1692,6 +1868,7 @@ class VaultItemViewModelTest : BaseViewModelTest() { previousState = null, isPremiumUser = true, hasMasterPassword = true, + canDelete = true, totpCodeItemData = createTotpCodeData(), ) } @@ -1710,6 +1887,7 @@ class VaultItemViewModelTest : BaseViewModelTest() { previousState = null, isPremiumUser = true, hasMasterPassword = true, + canDelete = true, totpCodeItemData = createTotpCodeData(), ) } returns DEFAULT_VIEW_STATE @@ -1717,6 +1895,7 @@ class VaultItemViewModelTest : BaseViewModelTest() { mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView) mutableAuthCodeItemFlow.value = DataState.Loaded(data = createVerificationCodeItem()) + mutableCollectionsStateFlow.value = DataState.Loaded(emptyList()) assertEquals(loginState, viewModel.stateFlow.value) viewModel.trySendAction(VaultItemAction.ItemType.Login.CopyPasswordClick) @@ -1736,6 +1915,7 @@ class VaultItemViewModelTest : BaseViewModelTest() { previousState = null, isPremiumUser = true, hasMasterPassword = true, + canDelete = true, totpCodeItemData = createTotpCodeData(), ) } @@ -1750,6 +1930,7 @@ class VaultItemViewModelTest : BaseViewModelTest() { previousState = null, isPremiumUser = true, hasMasterPassword = true, + canDelete = true, totpCodeItemData = createTotpCodeData(), ) } returns createViewState(common = DEFAULT_COMMON.copy(requiresReprompt = false)) @@ -1757,6 +1938,7 @@ class VaultItemViewModelTest : BaseViewModelTest() { mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView) mutableAuthCodeItemFlow.value = DataState.Loaded(data = createVerificationCodeItem()) + mutableCollectionsStateFlow.value = DataState.Loaded(emptyList()) every { clipboardManager.setText(text = DEFAULT_LOGIN_PASSWORD) } just runs @@ -1768,6 +1950,7 @@ class VaultItemViewModelTest : BaseViewModelTest() { previousState = null, isPremiumUser = true, hasMasterPassword = true, + canDelete = true, totpCodeItemData = createTotpCodeData(), ) } @@ -1782,6 +1965,7 @@ class VaultItemViewModelTest : BaseViewModelTest() { mutableAuthCodeItemFlow.value = DataState.Loaded( data = createVerificationCodeItem(), ) + mutableCollectionsStateFlow.value = DataState.Loaded(emptyList()) viewModel.trySendAction(VaultItemAction.ItemType.Login.CopyTotpClick) @@ -1808,6 +1992,7 @@ class VaultItemViewModelTest : BaseViewModelTest() { previousState = null, isPremiumUser = true, hasMasterPassword = true, + canDelete = true, totpCodeItemData = createTotpCodeData(), ) } returns createViewState(common = DEFAULT_COMMON.copy(requiresReprompt = false)) @@ -1815,6 +2000,7 @@ class VaultItemViewModelTest : BaseViewModelTest() { every { clipboardManager.setText(text = DEFAULT_LOGIN_USERNAME) } just runs mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView) mutableAuthCodeItemFlow.value = DataState.Loaded(data = createVerificationCodeItem()) + mutableCollectionsStateFlow.value = DataState.Loaded(emptyList()) viewModel.trySendAction(VaultItemAction.ItemType.Login.CopyUsernameClick) @@ -1825,6 +2011,7 @@ class VaultItemViewModelTest : BaseViewModelTest() { isPremiumUser = true, hasMasterPassword = true, totpCodeItemData = createTotpCodeData(), + canDelete = true, ) } } @@ -1849,12 +2036,14 @@ class VaultItemViewModelTest : BaseViewModelTest() { isPremiumUser = true, hasMasterPassword = true, totpCodeItemData = createTotpCodeData(), + canDelete = true, ) } returns DEFAULT_VIEW_STATE } mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView) mutableAuthCodeItemFlow.value = DataState.Loaded(data = createVerificationCodeItem()) + mutableCollectionsStateFlow.value = DataState.Loaded(emptyList()) assertEquals(loginState, viewModel.stateFlow.value) viewModel.trySendAction(VaultItemAction.ItemType.Login.PasswordHistoryClick) @@ -1873,6 +2062,7 @@ class VaultItemViewModelTest : BaseViewModelTest() { isPremiumUser = true, hasMasterPassword = true, totpCodeItemData = createTotpCodeData(), + canDelete = true, ) } } @@ -1888,6 +2078,7 @@ class VaultItemViewModelTest : BaseViewModelTest() { isPremiumUser = true, hasMasterPassword = true, totpCodeItemData = createTotpCodeData(), + canDelete = true, ) } .returns( @@ -1899,6 +2090,7 @@ class VaultItemViewModelTest : BaseViewModelTest() { mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView) mutableAuthCodeItemFlow.value = DataState.Loaded(data = createVerificationCodeItem()) + mutableCollectionsStateFlow.value = DataState.Loaded(emptyList()) viewModel.eventFlow.test { viewModel.trySendAction(VaultItemAction.ItemType.Login.PasswordHistoryClick) @@ -1914,6 +2106,7 @@ class VaultItemViewModelTest : BaseViewModelTest() { isPremiumUser = true, hasMasterPassword = true, totpCodeItemData = createTotpCodeData(), + canDelete = true, ) } } @@ -1930,12 +2123,14 @@ class VaultItemViewModelTest : BaseViewModelTest() { isPremiumUser = true, hasMasterPassword = true, totpCodeItemData = createTotpCodeData(), + canDelete = true, ) } returns DEFAULT_VIEW_STATE } mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView) mutableAuthCodeItemFlow.value = DataState.Loaded(data = createVerificationCodeItem()) + mutableCollectionsStateFlow.value = DataState.Loaded(emptyList()) assertEquals(loginState, viewModel.stateFlow.value) viewModel.trySendAction( @@ -1958,6 +2153,7 @@ class VaultItemViewModelTest : BaseViewModelTest() { isPremiumUser = true, hasMasterPassword = true, totpCodeItemData = createTotpCodeData(), + canDelete = true, ) } } @@ -1977,12 +2173,14 @@ class VaultItemViewModelTest : BaseViewModelTest() { isPremiumUser = true, hasMasterPassword = true, totpCodeItemData = createTotpCodeData(), + canDelete = true, ) } returns loginViewState } mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView) mutableAuthCodeItemFlow.value = DataState.Loaded(data = createVerificationCodeItem()) + mutableCollectionsStateFlow.value = DataState.Loaded(emptyList()) assertEquals(loginState, viewModel.stateFlow.value) viewModel.trySendAction( @@ -2008,6 +2206,7 @@ class VaultItemViewModelTest : BaseViewModelTest() { isPremiumUser = true, hasMasterPassword = true, totpCodeItemData = createTotpCodeData(), + canDelete = true, ) organizationEventManager.trackEvent( event = OrganizationEvent.CipherClientToggledPasswordVisible( @@ -2042,11 +2241,13 @@ class VaultItemViewModelTest : BaseViewModelTest() { isPremiumUser = true, hasMasterPassword = true, totpCodeItemData = null, + canDelete = true, ) } returns CARD_VIEW_STATE } mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView) mutableAuthCodeItemFlow.value = DataState.Loaded(data = null) + mutableCollectionsStateFlow.value = DataState.Loaded(emptyList()) assertEquals(cardState, viewModel.stateFlow.value) viewModel.trySendAction(VaultItemAction.ItemType.Card.CopyNumberClick) @@ -2067,6 +2268,7 @@ class VaultItemViewModelTest : BaseViewModelTest() { isPremiumUser = true, hasMasterPassword = true, totpCodeItemData = null, + canDelete = true, ) } } @@ -2081,6 +2283,7 @@ class VaultItemViewModelTest : BaseViewModelTest() { isPremiumUser = true, hasMasterPassword = true, totpCodeItemData = null, + canDelete = true, ) } returns createViewState( common = DEFAULT_COMMON.copy(requiresReprompt = false), @@ -2090,6 +2293,7 @@ class VaultItemViewModelTest : BaseViewModelTest() { every { clipboardManager.setText(text = "12345436") } just runs mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView) mutableAuthCodeItemFlow.value = DataState.Loaded(data = null) + mutableCollectionsStateFlow.value = DataState.Loaded(emptyList()) viewModel.trySendAction(VaultItemAction.ItemType.Card.CopyNumberClick) @@ -2100,6 +2304,7 @@ class VaultItemViewModelTest : BaseViewModelTest() { isPremiumUser = true, hasMasterPassword = true, totpCodeItemData = null, + canDelete = true, ) } } @@ -2115,11 +2320,13 @@ class VaultItemViewModelTest : BaseViewModelTest() { isPremiumUser = true, hasMasterPassword = true, totpCodeItemData = null, + canDelete = true, ) } returns CARD_VIEW_STATE } mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView) mutableAuthCodeItemFlow.value = DataState.Loaded(data = null) + mutableCollectionsStateFlow.value = DataState.Loaded(emptyList()) assertEquals(cardState, viewModel.stateFlow.value) viewModel.trySendAction( @@ -2140,6 +2347,7 @@ class VaultItemViewModelTest : BaseViewModelTest() { isPremiumUser = true, hasMasterPassword = true, totpCodeItemData = null, + canDelete = true, ) } } @@ -2154,6 +2362,7 @@ class VaultItemViewModelTest : BaseViewModelTest() { isPremiumUser = true, hasMasterPassword = true, totpCodeItemData = null, + canDelete = true, ) } returns createViewState( common = DEFAULT_COMMON.copy(requiresReprompt = false), @@ -2163,6 +2372,7 @@ class VaultItemViewModelTest : BaseViewModelTest() { every { clipboardManager.setText(text = "12345436") } just runs mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView) mutableAuthCodeItemFlow.value = DataState.Loaded(data = null) + mutableCollectionsStateFlow.value = DataState.Loaded(emptyList()) viewModel.trySendAction( VaultItemAction.ItemType.Card.NumberVisibilityClick(isVisible = true), @@ -2179,6 +2389,7 @@ class VaultItemViewModelTest : BaseViewModelTest() { isPremiumUser = true, hasMasterPassword = true, totpCodeItemData = null, + canDelete = true, ) } } @@ -2194,11 +2405,13 @@ class VaultItemViewModelTest : BaseViewModelTest() { isPremiumUser = true, hasMasterPassword = true, totpCodeItemData = null, + canDelete = true, ) } returns CARD_VIEW_STATE } mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView) mutableAuthCodeItemFlow.value = DataState.Loaded(data = null) + mutableCollectionsStateFlow.value = DataState.Loaded(emptyList()) assertEquals(cardState, viewModel.stateFlow.value) viewModel.trySendAction(VaultItemAction.ItemType.Card.CopySecurityCodeClick) @@ -2219,6 +2432,7 @@ class VaultItemViewModelTest : BaseViewModelTest() { isPremiumUser = true, hasMasterPassword = true, totpCodeItemData = null, + canDelete = true, ) } } @@ -2233,6 +2447,7 @@ class VaultItemViewModelTest : BaseViewModelTest() { isPremiumUser = true, hasMasterPassword = true, totpCodeItemData = null, + canDelete = true, ) } returns createViewState( common = DEFAULT_COMMON.copy(requiresReprompt = false), @@ -2242,6 +2457,7 @@ class VaultItemViewModelTest : BaseViewModelTest() { every { clipboardManager.setText(text = "987") } just runs mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView) mutableAuthCodeItemFlow.value = DataState.Loaded(data = null) + mutableCollectionsStateFlow.value = DataState.Loaded(emptyList()) viewModel.trySendAction(VaultItemAction.ItemType.Card.CopySecurityCodeClick) @@ -2252,6 +2468,7 @@ class VaultItemViewModelTest : BaseViewModelTest() { isPremiumUser = true, hasMasterPassword = true, totpCodeItemData = null, + canDelete = true, ) } } @@ -2267,11 +2484,13 @@ class VaultItemViewModelTest : BaseViewModelTest() { isPremiumUser = true, hasMasterPassword = true, totpCodeItemData = null, + canDelete = true, ) } returns CARD_VIEW_STATE } mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView) mutableAuthCodeItemFlow.value = DataState.Loaded(data = null) + mutableCollectionsStateFlow.value = DataState.Loaded(emptyList()) assertEquals(cardState, viewModel.stateFlow.value) viewModel.trySendAction( @@ -2292,6 +2511,7 @@ class VaultItemViewModelTest : BaseViewModelTest() { isPremiumUser = true, hasMasterPassword = true, totpCodeItemData = null, + canDelete = true, ) } } @@ -2306,6 +2526,7 @@ class VaultItemViewModelTest : BaseViewModelTest() { isPremiumUser = true, hasMasterPassword = true, totpCodeItemData = null, + canDelete = true, ) } returns createViewState( common = DEFAULT_COMMON.copy(requiresReprompt = false), @@ -2314,6 +2535,7 @@ class VaultItemViewModelTest : BaseViewModelTest() { } every { clipboardManager.setText(text = "987") } just runs mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView) + mutableCollectionsStateFlow.value = DataState.Loaded(emptyList()) mutableAuthCodeItemFlow.value = DataState.Loaded(data = null) viewModel.trySendAction( @@ -2331,6 +2553,7 @@ class VaultItemViewModelTest : BaseViewModelTest() { isPremiumUser = true, hasMasterPassword = true, totpCodeItemData = null, + canDelete = true, ) } } @@ -2359,11 +2582,13 @@ class VaultItemViewModelTest : BaseViewModelTest() { isPremiumUser = true, hasMasterPassword = true, totpCodeItemData = null, + canDelete = true, ) } returns SSH_KEY_VIEW_STATE } mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView) mutableAuthCodeItemFlow.value = DataState.Loaded(data = null) + mutableCollectionsStateFlow.value = DataState.Loaded(emptyList()) viewModel.trySendAction(VaultItemAction.ItemType.SshKey.CopyPublicKeyClick) @@ -2387,11 +2612,13 @@ class VaultItemViewModelTest : BaseViewModelTest() { isPremiumUser = true, hasMasterPassword = true, totpCodeItemData = null, + canDelete = true, ) } returns SSH_KEY_VIEW_STATE } mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView) mutableAuthCodeItemFlow.value = DataState.Loaded(data = null) + mutableCollectionsStateFlow.value = DataState.Loaded(emptyList()) assertEquals(sshKeyState, viewModel.stateFlow.value) viewModel.trySendAction( @@ -2422,11 +2649,13 @@ class VaultItemViewModelTest : BaseViewModelTest() { isPremiumUser = true, hasMasterPassword = true, totpCodeItemData = null, + canDelete = true, ) } returns SSH_KEY_VIEW_STATE } mutableVaultItemFlow.value = DataState.Loaded(data = mockCipherView) mutableAuthCodeItemFlow.value = DataState.Loaded(data = null) + mutableCollectionsStateFlow.value = DataState.Loaded(emptyList()) viewModel.trySendAction(VaultItemAction.ItemType.SshKey.CopyFingerprintClick) @@ -2466,12 +2695,14 @@ class VaultItemViewModelTest : BaseViewModelTest() { isPremiumUser = true, hasMasterPassword = true, totpCodeItemData = null, + canDelete = true, ) } returns viewState } val viewModel = createViewModel(state = null) mutableVaultItemFlow.value = DataState.Loaded(data = cipherView) + mutableCollectionsStateFlow.value = DataState.Loaded(emptyList()) assertEquals(DEFAULT_STATE.copy(viewState = viewState), viewModel.stateFlow.value) } @@ -2481,6 +2712,7 @@ class VaultItemViewModelTest : BaseViewModelTest() { val viewModel = createViewModel(state = null) mutableVaultItemFlow.value = DataState.Loaded(data = null) + mutableCollectionsStateFlow.value = DataState.Loaded(emptyList()) assertEquals( DEFAULT_STATE.copy( @@ -2502,12 +2734,14 @@ class VaultItemViewModelTest : BaseViewModelTest() { isPremiumUser = true, hasMasterPassword = true, totpCodeItemData = null, + canDelete = true, ) } returns viewState } val viewModel = createViewModel(state = null) mutableVaultItemFlow.value = DataState.Pending(data = cipherView) + mutableCollectionsStateFlow.value = DataState.Loaded(emptyList()) assertEquals(DEFAULT_STATE.copy(viewState = viewState), viewModel.stateFlow.value) } @@ -2518,6 +2752,7 @@ class VaultItemViewModelTest : BaseViewModelTest() { val viewModel = createViewModel(state = null) mutableVaultItemFlow.value = DataState.Pending(data = null) + mutableCollectionsStateFlow.value = DataState.Loaded(emptyList()) assertEquals( DEFAULT_STATE.copy( @@ -2539,6 +2774,7 @@ class VaultItemViewModelTest : BaseViewModelTest() { isPremiumUser = true, hasMasterPassword = true, totpCodeItemData = null, + canDelete = true, ) } returns viewState } @@ -2575,6 +2811,7 @@ class VaultItemViewModelTest : BaseViewModelTest() { isPremiumUser = true, hasMasterPassword = true, totpCodeItemData = null, + canDelete = true, ) } returns viewState } @@ -2608,6 +2845,15 @@ class VaultItemViewModelTest : BaseViewModelTest() { } } + @Nested + inner class CollectionsFlow { + @BeforeEach + fun setup() { + mutableUserStateFlow.value = DEFAULT_USER_STATE + mutableAuthCodeItemFlow.value = DataState.Loaded(data = null) + } + } + @Suppress("LongParameterList") private fun createViewModel( state: VaultItemState?, @@ -2780,6 +3026,7 @@ class VaultItemViewModelTest : BaseViewModelTest() { title = "test.mp4", ), ), + canDelete = true, ) private val DEFAULT_VIEW_STATE: VaultItemState.ViewState.Content = diff --git a/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/item/util/CipherViewExtensionsTest.kt b/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/item/util/CipherViewExtensionsTest.kt index b2ab66549..05d86866a 100644 --- a/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/item/util/CipherViewExtensionsTest.kt +++ b/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/item/util/CipherViewExtensionsTest.kt @@ -45,6 +45,7 @@ class CipherViewExtensionsTest { totpCode = "testCode", ), clock = fixedClock, + canDelete = true, ) assertEquals( @@ -80,6 +81,7 @@ class CipherViewExtensionsTest { totpCode = "testCode", ), clock = fixedClock, + canDelete = true, ) assertEquals( @@ -108,6 +110,7 @@ class CipherViewExtensionsTest { totpCode = "testCode", ), clock = fixedClock, + canDelete = true, ) assertEquals( @@ -136,6 +139,7 @@ class CipherViewExtensionsTest { totpCode = "testCode", ), clock = fixedClock, + canDelete = true, ) assertEquals( @@ -170,6 +174,7 @@ class CipherViewExtensionsTest { totpCode = "testCode", ), clock = fixedClock, + canDelete = true, ) assertEquals( @@ -194,6 +199,7 @@ class CipherViewExtensionsTest { hasMasterPassword = true, totpCodeItemData = null, clock = fixedClock, + canDelete = true, ) assertEquals( @@ -216,6 +222,7 @@ class CipherViewExtensionsTest { hasMasterPassword = true, totpCodeItemData = null, clock = fixedClock, + canDelete = true, ) assertEquals( @@ -237,6 +244,7 @@ class CipherViewExtensionsTest { hasMasterPassword = true, totpCodeItemData = null, clock = fixedClock, + canDelete = true, ) assertEquals( @@ -268,6 +276,7 @@ class CipherViewExtensionsTest { hasMasterPassword = true, totpCodeItemData = null, clock = fixedClock, + canDelete = true, ) assertEquals( @@ -304,6 +313,7 @@ class CipherViewExtensionsTest { hasMasterPassword = true, totpCodeItemData = null, clock = fixedClock, + canDelete = true, ) assertEquals( @@ -342,6 +352,7 @@ class CipherViewExtensionsTest { hasMasterPassword = true, totpCodeItemData = null, clock = fixedClock, + canDelete = true, ) assertEquals( @@ -364,6 +375,7 @@ class CipherViewExtensionsTest { hasMasterPassword = true, totpCodeItemData = null, clock = fixedClock, + canDelete = true, ) val expectedState = VaultItemState.ViewState.Content( @@ -384,6 +396,7 @@ class CipherViewExtensionsTest { hasMasterPassword = true, totpCodeItemData = null, clock = fixedClock, + canDelete = true, ) assertEquals( VaultItemState.ViewState.Content( diff --git a/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/item/util/VaultItemTestUtil.kt b/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/item/util/VaultItemTestUtil.kt index 6b0d0c0cb..5fb2db4fe 100644 --- a/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/item/util/VaultItemTestUtil.kt +++ b/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/item/util/VaultItemTestUtil.kt @@ -170,6 +170,7 @@ fun createCommonContent( requiresReprompt = true, requiresCloneConfirmation = false, attachments = emptyList(), + canDelete = true, ) } else { VaultItemState.ViewState.Content.Common( @@ -213,6 +214,7 @@ fun createCommonContent( title = "test.mp4", ), ), + canDelete = true, ) } diff --git a/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/vault/VaultScreenTest.kt b/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/vault/VaultScreenTest.kt index 203f9a8fe..ef752981f 100644 --- a/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/vault/VaultScreenTest.kt +++ b/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/vault/VaultScreenTest.kt @@ -29,7 +29,6 @@ import com.x8bit.bitwarden.ui.platform.components.model.AccountSummary import com.x8bit.bitwarden.ui.platform.components.snackbar.BitwardenSnackbarData import com.x8bit.bitwarden.ui.platform.manager.exit.ExitManager import com.x8bit.bitwarden.ui.platform.manager.intent.IntentManager -import com.x8bit.bitwarden.ui.platform.manager.permissions.FakePermissionManager import com.x8bit.bitwarden.ui.platform.manager.snackbar.SnackbarRelay import com.x8bit.bitwarden.ui.util.assertLockOrLogoutDialogIsDisplayed import com.x8bit.bitwarden.ui.util.assertLogoutConfirmationDialogIsDisplayed @@ -74,7 +73,6 @@ class VaultScreenTest : BaseComposeTest() { private var onNavigateToSearchScreen = false private val exitManager = mockk(relaxed = true) private val intentManager = mockk(relaxed = true) - private val permissionsManager = FakePermissionManager() private val mutableEventFlow = bufferedMutableSharedFlow() private val mutableStateFlow = MutableStateFlow(DEFAULT_STATE) @@ -101,7 +99,6 @@ class VaultScreenTest : BaseComposeTest() { }, exitManager = exitManager, intentManager = intentManager, - permissionsManager = permissionsManager, ) } } @@ -1143,14 +1140,6 @@ class VaultScreenTest : BaseComposeTest() { } } - @Test - fun `permissionManager is invoked for notifications based on state`() { - assertFalse(permissionsManager.hasGetLauncherBeenCalled) - mutableStateFlow.update { it.copy(hideNotificationsDialog = false) } - composeTestRule.waitForIdle() - assertTrue(permissionsManager.hasGetLauncherBeenCalled) - } - @Test fun `action card for importing logins should show based on state`() { mutableStateFlow.update { @@ -1324,7 +1313,6 @@ private val DEFAULT_STATE: VaultState = VaultState( baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl, isIconLoadingDisabled = false, hasMasterPassword = true, - hideNotificationsDialog = true, isRefreshing = false, showImportActionCard = false, showSshKeys = false, diff --git a/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/vault/VaultViewModelTest.kt b/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/vault/VaultViewModelTest.kt index d3071498d..f5d4fda3f 100644 --- a/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/vault/VaultViewModelTest.kt +++ b/app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/vault/VaultViewModelTest.kt @@ -36,7 +36,7 @@ import com.x8bit.bitwarden.ui.platform.base.util.asText import com.x8bit.bitwarden.ui.platform.components.model.AccountSummary import com.x8bit.bitwarden.ui.platform.components.snackbar.BitwardenSnackbarData import com.x8bit.bitwarden.ui.platform.manager.snackbar.SnackbarRelay -import com.x8bit.bitwarden.ui.platform.manager.snackbar.SnackbarRelayManagerImpl +import com.x8bit.bitwarden.ui.platform.manager.snackbar.SnackbarRelayManager import com.x8bit.bitwarden.ui.vault.feature.itemlisting.model.ListingItemOverflowAction import com.x8bit.bitwarden.ui.vault.feature.vault.model.VaultFilterData import com.x8bit.bitwarden.ui.vault.feature.vault.model.VaultFilterType @@ -49,6 +49,7 @@ import io.mockk.mockk import io.mockk.runs import io.mockk.verify import kotlinx.coroutines.flow.MutableStateFlow +import kotlinx.coroutines.flow.filterNotNull import kotlinx.coroutines.flow.update import kotlinx.coroutines.test.runTest import org.junit.jupiter.api.Assertions.assertEquals @@ -66,7 +67,12 @@ class VaultViewModelTest : BaseViewModelTest() { ZoneOffset.UTC, ) - private val snackbarRelayManager = SnackbarRelayManagerImpl() + private val mutableSnackbarDataFlow = MutableStateFlow(null) + private val snackbarRelayManager: SnackbarRelayManager = mockk { + every { getSnackbarDataFlow(SnackbarRelay.MY_VAULT_RELAY) } returns mutableSnackbarDataFlow + .filterNotNull() + every { clearRelayBuffer(SnackbarRelay.MY_VAULT_RELAY) } just runs + } private val clipboardManager: BitwardenClipboardManager = mockk { every { setText(any()) } just runs @@ -1802,15 +1808,28 @@ class VaultViewModelTest : BaseViewModelTest() { fun `when SnackbarRelay flow updates, snackbar is shown`() = runTest { val viewModel = createViewModel() val expectedSnackbarData = BitwardenSnackbarData(message = "test message".asText()) + mutableSnackbarDataFlow.update { expectedSnackbarData } viewModel.eventFlow.test { - snackbarRelayManager.sendSnackbarData( - data = expectedSnackbarData, - relay = SnackbarRelay.MY_VAULT_RELAY, - ) assertEquals(VaultEvent.ShowSnackbar(expectedSnackbarData), awaitItem()) } } + @Test + fun `when account switch action is handled, clear snackbar relay buffer should be called`() = + runTest { + val viewModel = createViewModel() + switchAccountResult = SwitchAccountResult.AccountSwitched + viewModel.trySendAction( + VaultAction.SwitchAccountClick( + accountSummary = mockk() { + every { userId } returns "updatedUserId" + }, + ), + ) + verify(exactly = 1) { + snackbarRelayManager.clearRelayBuffer(SnackbarRelay.MY_VAULT_RELAY) + } + } private fun createViewModel(): VaultViewModel = VaultViewModel( authRepository = authRepository, @@ -1930,7 +1949,6 @@ private fun createMockVaultState( baseIconUrl = Environment.Us.environmentUrlData.baseIconUrl, isIconLoadingDisabled = false, hasMasterPassword = true, - hideNotificationsDialog = true, showImportActionCard = true, isRefreshing = false, showSshKeys = showSshKeys, diff --git a/authenticatorbridge/CHANGELOG.md b/authenticatorbridge/CHANGELOG.md index 62a9ddd44..fdca1b87c 100644 --- a/authenticatorbridge/CHANGELOG.md +++ b/authenticatorbridge/CHANGELOG.md @@ -1,4 +1,4 @@ -v0.1.0 (pending) +v1.1.0 (pending) -------- ### API Changes @@ -6,3 +6,7 @@ v0.1.0 (pending) ### Breaking Changes ### Bug Fixes + +v1.0.0 +-------- +Initial release. \ No newline at end of file diff --git a/authenticatorbridge/build.gradle.kts b/authenticatorbridge/build.gradle.kts index cadfb31db..cf4074b7c 100644 --- a/authenticatorbridge/build.gradle.kts +++ b/authenticatorbridge/build.gradle.kts @@ -1,7 +1,7 @@ import org.jetbrains.kotlin.gradle.dsl.JvmTarget // For more info on versioning, see the README. -val version = "0.1.0" +val version = "1.0.0" plugins { alias(libs.plugins.android.library) @@ -46,7 +46,7 @@ android { outputs .map { it as com.android.build.gradle.internal.api.BaseVariantOutputImpl } .forEach { output -> - val outputFileName = "authenticatorbridge-${version}-SNAPSHOT-${variant.baseName}.aar" + val outputFileName = "authenticatorbridge-${version}-${variant.baseName}.aar" output.outputFileName = outputFileName } } diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md index 22321beb2..281f0bbd2 100644 --- a/docs/ARCHITECTURE.md +++ b/docs/ARCHITECTURE.md @@ -46,7 +46,7 @@ Note that these data sources are constructed in a manner that adheres to a very ### Managers -Manager classes represent something of a middle level of the data layer. While some manager classes like [VaultLockManager](../app/src/main/java/com/x8bit/bitwarden/data/vault/manager/VaultLockManager.kt) depend on the the lower-level data sources, others are wrappers around OS-level classes (ex: [AppForegroundManager](../app/src/main/java/com/x8bit/bitwarden/data/platform/manager/AppForegroundManager.kt)) while others have no dependencies at all (ex: [SpecialCircumstanceManager](../app/src/main/java/com/x8bit/bitwarden/data/platform/manager/SpecialCircumstanceManager.kt)). The commonality amongst the manager classes is that they tend to have a single discrete responsibility. These classes may also exist solely in the data layer for use inside a repository or manager class, like [AppForegroundManager](../app/src/main/java/com/x8bit/bitwarden/data/platform/manager/AppForegroundManager.kt), or may be exposed directly to the UI layer, like [SpecialCircumstanceManager](../app/src/main/java/com/x8bit/bitwarden/data/platform/manager/SpecialCircumstanceManager.kt). +Manager classes represent something of a middle level of the data layer. While some manager classes like [VaultLockManager](../app/src/main/java/com/x8bit/bitwarden/data/vault/manager/VaultLockManager.kt) depend on the the lower-level data sources, others are wrappers around OS-level classes (ex: [AppStateManager](../app/src/main/java/com/x8bit/bitwarden/data/platform/manager/AppStateManager.kt)) while others have no dependencies at all (ex: [SpecialCircumstanceManager](../app/src/main/java/com/x8bit/bitwarden/data/platform/manager/SpecialCircumstanceManager.kt)). The commonality amongst the manager classes is that they tend to have a single discrete responsibility. These classes may also exist solely in the data layer for use inside a repository or manager class, like [AppStateManager](../app/src/main/java/com/x8bit/bitwarden/data/platform/manager/AppStateManager.kt), or may be exposed directly to the UI layer, like [SpecialCircumstanceManager](../app/src/main/java/com/x8bit/bitwarden/data/platform/manager/SpecialCircumstanceManager.kt). ### Repositories