Skip to content

Commit 3f9ea1f

Browse files
committed
chore: cleanup
1 parent bee7811 commit 3f9ea1f

File tree

6 files changed

+25
-793
lines changed

6 files changed

+25
-793
lines changed

app/src/main/java/to/bitkit/env/Env.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,6 @@ internal object Env {
143143
*/
144144
private fun storagePathOf(walletIndex: Int, network: String, dir: String): String {
145145
require(::appStoragePath.isInitialized) { "App storage path should be 'context.filesDir.absolutePath'." }
146-
// appStoragePath/network/walletN/dir
147146
val path = Path(appStoragePath, network, "wallet$walletIndex", dir)
148147
.toFile()
149148
.ensureDir()

app/src/main/java/to/bitkit/models/BackupCategory.kt

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,51 @@
11
package to.bitkit.models
22

3+
import androidx.annotation.DrawableRes
4+
import androidx.annotation.StringRes
35
import kotlinx.serialization.Serializable
46
import to.bitkit.R
57

68
@Serializable
79
enum class BackupCategory(
8-
val uiIcon: Int,
9-
val uiTitle: Int,
10+
@DrawableRes val icon: Int,
11+
@StringRes val title: Int,
1012
) {
1113
LIGHTNING_CONNECTIONS(
12-
uiIcon = R.drawable.ic_lightning,
13-
uiTitle = R.string.settings__backup__category_connections,
14+
icon = R.drawable.ic_lightning,
15+
title = R.string.settings__backup__category_connections,
1416
),
1517
BLOCKTANK(
16-
uiIcon = R.drawable.ic_note,
17-
uiTitle = R.string.settings__backup__category_connection_receipts,
18+
icon = R.drawable.ic_note,
19+
title = R.string.settings__backup__category_connection_receipts,
1820
),
1921
ACTIVITY(
20-
uiIcon = R.drawable.ic_transfer,
21-
uiTitle = R.string.settings__backup__category_transaction_log,
22+
icon = R.drawable.ic_transfer,
23+
title = R.string.settings__backup__category_transaction_log,
2224
),
2325
WALLET(
24-
uiIcon = R.drawable.ic_timer_alt,
25-
uiTitle = R.string.settings__backup__category_wallet,
26+
icon = R.drawable.ic_timer_alt,
27+
title = R.string.settings__backup__category_wallet,
2628
),
2729
SETTINGS(
28-
uiIcon = R.drawable.ic_settings,
29-
uiTitle = R.string.settings__backup__category_settings,
30+
icon = R.drawable.ic_settings,
31+
title = R.string.settings__backup__category_settings,
3032
),
3133
WIDGETS(
32-
uiIcon = R.drawable.ic_rectangles_two,
33-
uiTitle = R.string.settings__backup__category_widgets,
34+
icon = R.drawable.ic_rectangles_two,
35+
title = R.string.settings__backup__category_widgets,
3436
),
3537
METADATA(
36-
uiIcon = R.drawable.ic_tag,
37-
uiTitle = R.string.settings__backup__category_tags,
38+
icon = R.drawable.ic_tag,
39+
title = R.string.settings__backup__category_tags,
3840
),
3941
// Descoped in v1, will return in v2:
4042
// PROFILE(
41-
// uiIcon = R.drawable.ic_user,
42-
// uiTitle = R.string.settings__backup__category_profile,
43+
// icon = R.drawable.ic_user,
44+
// title = R.string.settings__backup__category_profile,
4345
// ),
4446
// CONTACTS(
45-
// uiIcon = R.drawable.ic_users,
46-
// uiTitle = R.string.settings__backup__category_contacts,
47+
// icon = R.drawable.ic_users,
48+
// title = R.string.settings__backup__category_contacts,
4749
// ),
4850
}
4951

app/src/main/java/to/bitkit/models/BackupPayloads.kt

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -9,26 +9,13 @@ import to.bitkit.data.AppCacheData
99
import to.bitkit.data.entities.TagMetadataEntity
1010
import to.bitkit.data.entities.TransferEntity
1111

12-
/**
13-
* Wallet backup payload (v1)
14-
*
15-
* Contains:
16-
* - Transfer entities from Room database
17-
*/
1812
@Serializable
1913
data class WalletBackupV1(
2014
val version: Int = 1,
2115
val createdAt: Long,
2216
val transfers: List<TransferEntity>,
2317
)
2418

25-
/**
26-
* Metadata backup payload (v1)
27-
*
28-
* Contains:
29-
* - Tag metadata entities from Room database
30-
* - Entire AppCacheData from CacheStore
31-
*/
3219
@Serializable
3320
data class MetadataBackupV1(
3421
val version: Int = 1,
@@ -37,14 +24,6 @@ data class MetadataBackupV1(
3724
val cache: AppCacheData,
3825
)
3926

40-
/**
41-
* Blocktank backup payload (v1)
42-
*
43-
* Contains:
44-
* - List of IBtOrder from bitkit-core
45-
* - List of IcJitEntry from bitkit-core
46-
* - IBtInfo from bitkit-core
47-
*/
4827
@Serializable
4928
data class BlocktankBackupV1(
5029
val version: Int = 1,
@@ -54,12 +33,6 @@ data class BlocktankBackupV1(
5433
val info: IBtInfo? = null,
5534
)
5635

57-
/**
58-
* Activity backup payload (v1)
59-
*
60-
* Contains:
61-
* - ALL activities (onchain + lightning) from bitkit-core
62-
*/
6336
@Serializable
6437
data class ActivityBackupV1(
6538
val version: Int = 1,

app/src/main/java/to/bitkit/repositories/ActivityRepo.kt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,6 @@ class ActivityRepo @Inject constructor(
5151
) {
5252
val isSyncingLdkNodePayments = MutableStateFlow(false)
5353

54-
/**
55-
* Emits a timestamp whenever activities are modified (insert, update, delete, tag changes, etc.)
56-
* Used to trigger backups and UI updates.
57-
*/
5854
private val _activitiesChanged = MutableStateFlow(0L)
5955
val activitiesChanged: StateFlow<Long> = _activitiesChanged
6056

@@ -83,7 +79,6 @@ class ActivityRepo @Inject constructor(
8379
boostPendingActivities()
8480
transferRepo.syncTransferStates()
8581
isSyncingLdkNodePayments.value = false
86-
// Note: We don't call notifyActivitiesChanged() here to avoid backups on every sync.
8782
return@withContext Result.success(Unit)
8883
}.onFailure { e ->
8984
Logger.error("Failed to sync ldk-node payments", e, context = TAG)

app/src/main/java/to/bitkit/ui/settings/BackupSettingsScreen.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,11 +174,11 @@ private fun BackupStatusItem(
174174
) {
175175
BackupStatusIcon(
176176
status = uiState.status,
177-
iconRes = uiState.category.uiIcon,
177+
iconRes = uiState.category.icon,
178178
)
179179

180180
Column(modifier = Modifier.weight(1f)) {
181-
BodyMSB(text = stringResource(uiState.category.uiTitle))
181+
BodyMSB(text = stringResource(uiState.category.title))
182182
CaptionB(text = subtitle, color = Colors.White64, maxLines = 1)
183183
}
184184

@@ -251,7 +251,7 @@ private fun Preview() {
251251
val timestamp = System.currentTimeMillis() - (minutesAgo * 60 * 1000)
252252

253253
when (it.category) {
254-
BackupCategory.ACTIVITY -> it.copy(disableRetry = true)
254+
BackupCategory.LIGHTNING_CONNECTIONS -> it.copy(disableRetry = true)
255255
BackupCategory.WALLET -> it.copy(status = BackupItemStatus(running = true, required = 1))
256256
BackupCategory.METADATA -> it.copy(status = BackupItemStatus(required = 1))
257257
else -> it.copy(status = BackupItemStatus(synced = timestamp, required = timestamp))

0 commit comments

Comments
 (0)