Skip to content

Commit f7322d0

Browse files
committed
fix: use set value instead of replace the instance
1 parent 339f4ce commit f7322d0

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

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

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ class ActivityRepo @Inject constructor(
3434
private val lightningRepo: LightningRepo,
3535
private val cacheStore: CacheStore,
3636
) {
37-
var isSyncingLdkNodePayments = MutableStateFlow(false)
38-
private set
37+
val isSyncingLdkNodePayments = MutableStateFlow(false)
3938

4039
val inProgressTransfers = cacheStore.data.map { it.inProgressTransfers }
4140

@@ -48,7 +47,7 @@ class ActivityRepo @Inject constructor(
4847
isSyncingLdkNodePayments.first { !it }
4948
}
5049

51-
isSyncingLdkNodePayments = MutableStateFlow(true)
50+
isSyncingLdkNodePayments.value = true
5251

5352
deletePendingActivities()
5453
return@withContext lightningRepo.getPayments()
@@ -58,22 +57,22 @@ class ActivityRepo @Inject constructor(
5857
updateActivitiesMetadata()
5958
boostPendingActivities()
6059
updateInProgressTransfers()
61-
isSyncingLdkNodePayments = MutableStateFlow(false)
60+
isSyncingLdkNodePayments.value = false
6261
return@withContext Result.success(Unit)
6362
}.onFailure { e ->
6463
Logger.error("Failed to sync ldk-node payments", e, context = TAG)
65-
isSyncingLdkNodePayments = MutableStateFlow(false)
64+
isSyncingLdkNodePayments.value = false
6665
return@withContext Result.failure(e)
6766
}.map { Unit }
6867
}.onFailure { e ->
6968
when (e) {
7069
is TimeoutCancellationException -> {
71-
isSyncingLdkNodePayments = MutableStateFlow(false)
70+
isSyncingLdkNodePayments.value = false
7271
Logger.error("Timeout waiting for sync to complete, forcing reset", e, context = TAG)
7372
}
7473

7574
else -> {
76-
isSyncingLdkNodePayments = MutableStateFlow(false)
75+
isSyncingLdkNodePayments.value = false
7776
Logger.error("syncActivities error", e, context = TAG)
7877
}
7978
}

0 commit comments

Comments
 (0)