Skip to content

Commit c6ed583

Browse files
committed
fix: clear widgets data on wipe
1 parent f0e8371 commit c6ed583

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

app/src/main/java/to/bitkit/usecases/WipeWalletUseCase.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package to.bitkit.usecases
33
import to.bitkit.data.AppDb
44
import to.bitkit.data.CacheStore
55
import to.bitkit.data.SettingsStore
6+
import to.bitkit.data.WidgetsStore
67
import to.bitkit.data.keychain.Keychain
78
import to.bitkit.repositories.ActivityRepo
89
import to.bitkit.repositories.BackupRepo
@@ -22,6 +23,7 @@ class WipeWalletUseCase @Inject constructor(
2223
private val db: AppDb,
2324
private val settingsStore: SettingsStore,
2425
private val cacheStore: CacheStore,
26+
private val widgetsStore: WidgetsStore,
2527
private val blocktankRepo: BlocktankRepo,
2628
private val activityRepo: ActivityRepo,
2729
private val lightningRepo: LightningRepo,
@@ -40,8 +42,10 @@ class WipeWalletUseCase @Inject constructor(
4042

4143
coreService.wipeData()
4244
db.clearAllTables()
45+
4346
settingsStore.reset()
4447
cacheStore.reset()
48+
widgetsStore.reset()
4549

4650
blocktankRepo.resetState()
4751
activityRepo.resetState()

app/src/test/java/to/bitkit/usecases/WipeWalletUseCaseTest.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import org.mockito.kotlin.wheneverBlocking
1111
import to.bitkit.data.AppDb
1212
import to.bitkit.data.CacheStore
1313
import to.bitkit.data.SettingsStore
14+
import to.bitkit.data.WidgetsStore
1415
import to.bitkit.data.keychain.Keychain
1516
import to.bitkit.repositories.ActivityRepo
1617
import to.bitkit.repositories.BackupRepo
@@ -28,6 +29,7 @@ class WipeWalletUseCaseTest : BaseUnitTest() {
2829
private val db = mock<AppDb>()
2930
private val settingsStore = mock<SettingsStore>()
3031
private val cacheStore = mock<CacheStore>()
32+
private val widgetsStore = mock<WidgetsStore>()
3133
private val blocktankRepo = mock<BlocktankRepo>()
3234
private val activityRepo = mock<ActivityRepo>()
3335
private val lightningRepo = mock<LightningRepo>()
@@ -50,6 +52,7 @@ class WipeWalletUseCaseTest : BaseUnitTest() {
5052
db = db,
5153
settingsStore = settingsStore,
5254
cacheStore = cacheStore,
55+
widgetsStore = widgetsStore,
5356
blocktankRepo = blocktankRepo,
5457
activityRepo = activityRepo,
5558
lightningRepo = lightningRepo,
@@ -71,6 +74,7 @@ class WipeWalletUseCaseTest : BaseUnitTest() {
7174
db,
7275
settingsStore,
7376
cacheStore,
77+
widgetsStore,
7478
blocktankRepo,
7579
activityRepo,
7680
lightningRepo
@@ -82,6 +86,7 @@ class WipeWalletUseCaseTest : BaseUnitTest() {
8286
inOrder.verify(db).clearAllTables()
8387
inOrder.verify(settingsStore).reset()
8488
inOrder.verify(cacheStore).reset()
89+
inOrder.verify(widgetsStore).reset()
8590
inOrder.verify(blocktankRepo).resetState()
8691
inOrder.verify(activityRepo).resetState()
8792
assertTrue(onWipeCalled)

0 commit comments

Comments
 (0)