Remove unnecessary SettingsRepository.clearData (#648)

This commit is contained in:
Brian Yencho 2024-01-17 15:28:06 -06:00 committed by Álison Fernandes
parent cd236f183f
commit 9ba02c67e0
4 changed files with 0 additions and 31 deletions

View file

@ -52,11 +52,6 @@ interface SettingsRepository {
*/
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
* typically used when logging into a new account.

View file

@ -97,10 +97,6 @@ class SettingsRepositoryImpl(
?.let { authDiskSource.getEncryptedPin(userId = it) != null }
?: false
override fun clearData(userId: String) {
settingsDiskSource.clearData(userId = userId)
}
override fun setDefaultsIfNecessary(userId: String) {
// Set Vault Settings defaults
if (!isVaultTimeoutActionSet(userId = userId)) {

View file

@ -92,7 +92,6 @@ class AuthRepositoryTest {
environment = Environment.Us
}
private val settingsRepository: SettingsRepository = mockk() {
every { clearData(any()) } just runs
every { setDefaultsIfNecessary(any()) } just runs
}
private val authSdkSource = mockk<AuthSdkSource> {

View file

@ -34,27 +34,6 @@ class SettingsRepositoryTest {
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
fun `setDefaultsIfNecessary should set default values for the given user if necessary`() {
val userId = "userId"