diff --git a/app/src/main/java/com/x8bit/bitwarden/data/platform/datasource/disk/SettingsDiskSource.kt b/app/src/main/java/com/x8bit/bitwarden/data/platform/datasource/disk/SettingsDiskSource.kt index e737bf324..e20fadebf 100644 --- a/app/src/main/java/com/x8bit/bitwarden/data/platform/datasource/disk/SettingsDiskSource.kt +++ b/app/src/main/java/com/x8bit/bitwarden/data/platform/datasource/disk/SettingsDiskSource.kt @@ -330,7 +330,7 @@ interface SettingsDiskSource { * Stores the given value for whether or not the given [userId] has registered for export via * the credential exchange protocol. */ - fun storeVaultRegisteredForExport(userId: String, isRegistered: Boolean) + fun storeVaultRegisteredForExport(userId: String, isRegistered: Boolean?) /** * Emits updates that track [getVaultRegisteredForExport] for the given [userId]. diff --git a/app/src/main/java/com/x8bit/bitwarden/data/platform/datasource/disk/SettingsDiskSourceImpl.kt b/app/src/main/java/com/x8bit/bitwarden/data/platform/datasource/disk/SettingsDiskSourceImpl.kt index 894e561b8..65d0f5134 100644 --- a/app/src/main/java/com/x8bit/bitwarden/data/platform/datasource/disk/SettingsDiskSourceImpl.kt +++ b/app/src/main/java/com/x8bit/bitwarden/data/platform/datasource/disk/SettingsDiskSourceImpl.kt @@ -185,6 +185,7 @@ class SettingsDiskSourceImpl( storeLastSyncTime(userId = userId, lastSyncTime = null) storeClearClipboardFrequencySeconds(userId = userId, frequency = null) removeWithPrefix(prefix = ACCOUNT_BIOMETRIC_INTEGRITY_VALID_KEY.appendIdentifier(userId)) + storeVaultRegisteredForExport(userId = userId, isRegistered = null) // The following are intentionally not cleared so they can be // restored after logging out and back in: @@ -450,7 +451,7 @@ class SettingsDiskSourceImpl( override fun getVaultRegisteredForExport(userId: String): Boolean? = getBoolean(IS_VAULT_REGISTERED_FOR_EXPORT.appendIdentifier(userId)) - override fun storeVaultRegisteredForExport(userId: String, isRegistered: Boolean) { + override fun storeVaultRegisteredForExport(userId: String, isRegistered: Boolean?) { putBoolean(IS_VAULT_REGISTERED_FOR_EXPORT.appendIdentifier(userId), isRegistered) getMutableVaultRegisteredForExportFlow(userId).tryEmit(isRegistered) } diff --git a/app/src/test/java/com/x8bit/bitwarden/data/platform/datasource/disk/util/FakeSettingsDiskSource.kt b/app/src/test/java/com/x8bit/bitwarden/data/platform/datasource/disk/util/FakeSettingsDiskSource.kt index 021f59c08..b83846a57 100644 --- a/app/src/test/java/com/x8bit/bitwarden/data/platform/datasource/disk/util/FakeSettingsDiskSource.kt +++ b/app/src/test/java/com/x8bit/bitwarden/data/platform/datasource/disk/util/FakeSettingsDiskSource.kt @@ -68,7 +68,7 @@ class FakeSettingsDiskSource : SettingsDiskSource { private val userShowUnlockBadge = mutableMapOf() private val userShowImportLoginsBadge = mutableMapOf() private var storedLastDatabaseSchemeChangeInstant: Instant? = null - private val vaultRegisteredForExport = mutableMapOf() + private val vaultRegisteredForExport = mutableMapOf() private val mutableShowAutoFillSettingBadgeFlowMap = mutableMapOf>() @@ -80,7 +80,7 @@ class FakeSettingsDiskSource : SettingsDiskSource { mutableMapOf>() private val mutableVaultRegisteredForExportFlowMap = - mutableMapOf>() + mutableMapOf>() override var appLanguage: AppLanguage? = null @@ -357,7 +357,7 @@ class FakeSettingsDiskSource : SettingsDiskSource { override fun getVaultRegisteredForExport(userId: String): Boolean = vaultRegisteredForExport[userId] ?: false - override fun storeVaultRegisteredForExport(userId: String, registered: Boolean) { + override fun storeVaultRegisteredForExport(userId: String, registered: Boolean?) { vaultRegisteredForExport[userId] = registered getMutableVaultRegisteredForExportFlow(userId = userId).tryEmit(registered) } @@ -421,7 +421,7 @@ class FakeSettingsDiskSource : SettingsDiskSource { private fun getMutableVaultRegisteredForExportFlow( userId: String, - ): MutableSharedFlow = + ): MutableSharedFlow = mutableVaultRegisteredForExportFlowMap.getOrPut(userId) { bufferedMutableSharedFlow(replay = 1) }