mirror of
https://github.com/bitwarden/android.git
synced 2024-11-27 12:00:19 +03:00
Remove unnecessary SettingsRepository.clearData (#648)
This commit is contained in:
parent
cd236f183f
commit
9ba02c67e0
4 changed files with 0 additions and 31 deletions
|
@ -52,11 +52,6 @@ interface SettingsRepository {
|
||||||
*/
|
*/
|
||||||
val isUnlockWithPinEnabled: Boolean
|
val isUnlockWithPinEnabled: Boolean
|
||||||
|
|
||||||
/**
|
|
||||||
* Clears all the settings data for the given user.
|
|
||||||
*/
|
|
||||||
fun clearData(userId: String)
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets default values for various settings for the given [userId] if necessary. This is
|
* Sets default values for various settings for the given [userId] if necessary. This is
|
||||||
* typically used when logging into a new account.
|
* typically used when logging into a new account.
|
||||||
|
|
|
@ -97,10 +97,6 @@ class SettingsRepositoryImpl(
|
||||||
?.let { authDiskSource.getEncryptedPin(userId = it) != null }
|
?.let { authDiskSource.getEncryptedPin(userId = it) != null }
|
||||||
?: false
|
?: false
|
||||||
|
|
||||||
override fun clearData(userId: String) {
|
|
||||||
settingsDiskSource.clearData(userId = userId)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun setDefaultsIfNecessary(userId: String) {
|
override fun setDefaultsIfNecessary(userId: String) {
|
||||||
// Set Vault Settings defaults
|
// Set Vault Settings defaults
|
||||||
if (!isVaultTimeoutActionSet(userId = userId)) {
|
if (!isVaultTimeoutActionSet(userId = userId)) {
|
||||||
|
|
|
@ -92,7 +92,6 @@ class AuthRepositoryTest {
|
||||||
environment = Environment.Us
|
environment = Environment.Us
|
||||||
}
|
}
|
||||||
private val settingsRepository: SettingsRepository = mockk() {
|
private val settingsRepository: SettingsRepository = mockk() {
|
||||||
every { clearData(any()) } just runs
|
|
||||||
every { setDefaultsIfNecessary(any()) } just runs
|
every { setDefaultsIfNecessary(any()) } just runs
|
||||||
}
|
}
|
||||||
private val authSdkSource = mockk<AuthSdkSource> {
|
private val authSdkSource = mockk<AuthSdkSource> {
|
||||||
|
|
|
@ -34,27 +34,6 @@ class SettingsRepositoryTest {
|
||||||
dispatcherManager = FakeDispatcherManager(),
|
dispatcherManager = FakeDispatcherManager(),
|
||||||
)
|
)
|
||||||
|
|
||||||
@Test
|
|
||||||
fun `clearData should clear all necessary data for the given user`() {
|
|
||||||
val userId = "userId"
|
|
||||||
|
|
||||||
fakeSettingsDiskSource.apply {
|
|
||||||
storeVaultTimeoutInMinutes(
|
|
||||||
userId = userId,
|
|
||||||
vaultTimeoutInMinutes = 30,
|
|
||||||
)
|
|
||||||
storeVaultTimeoutAction(
|
|
||||||
userId = userId,
|
|
||||||
vaultTimeoutAction = VaultTimeoutAction.LOCK,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
settingsRepository.clearData(userId = userId)
|
|
||||||
|
|
||||||
assertNull(fakeSettingsDiskSource.getVaultTimeoutInMinutes(userId = userId))
|
|
||||||
assertNull(fakeSettingsDiskSource.getVaultTimeoutAction(userId = userId))
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `setDefaultsIfNecessary should set default values for the given user if necessary`() {
|
fun `setDefaultsIfNecessary should set default values for the given user if necessary`() {
|
||||||
val userId = "userId"
|
val userId = "userId"
|
||||||
|
|
Loading…
Reference in a new issue