11package to.bitkit.repositories
22
3- import androidx.room.PrimaryKey
43import com.synonym.bitkitcore.Activity
54import com.synonym.bitkitcore.Activity.Onchain
65import com.synonym.bitkitcore.ActivityFilter
@@ -44,8 +43,7 @@ class ActivityRepo @Inject constructor(
4443 private val db : AppDb ,
4544 private val addressChecker : AddressChecker ,
4645) {
47- var isSyncingLdkNodePayments = MutableStateFlow (false )
48- private set
46+ val isSyncingLdkNodePayments = MutableStateFlow (false )
4947
5048 val inProgressTransfers = cacheStore.data.map { it.inProgressTransfers }
5149
@@ -58,7 +56,7 @@ class ActivityRepo @Inject constructor(
5856 isSyncingLdkNodePayments.first { ! it }
5957 }
6058
61- isSyncingLdkNodePayments = MutableStateFlow ( true )
59+ isSyncingLdkNodePayments.value = true
6260
6361 deletePendingActivities()
6462 return @withContext lightningRepo.getPayments()
@@ -71,22 +69,22 @@ class ActivityRepo @Inject constructor(
7169 boostPendingActivities()
7270 updateInProgressTransfers()
7371 syncResult.getOrNull()?.let { syncTagsMetaData(it) }
74- isSyncingLdkNodePayments = MutableStateFlow ( false )
72+ isSyncingLdkNodePayments.value = false
7573 return @withContext Result .success(Unit )
7674 }.onFailure { e ->
7775 Logger .error(" Failed to sync ldk-node payments" , e, context = TAG )
78- isSyncingLdkNodePayments = MutableStateFlow ( false )
76+ isSyncingLdkNodePayments.value = false
7977 return @withContext Result .failure(e)
8078 }.map { Unit }
8179 }.onFailure { e ->
8280 when (e) {
8381 is TimeoutCancellationException -> {
84- isSyncingLdkNodePayments = MutableStateFlow ( false )
82+ isSyncingLdkNodePayments.value = false
8583 Logger .warn(" Timeout waiting for sync to complete, forcing reset" , context = TAG )
8684 }
8785
8886 else -> {
89- isSyncingLdkNodePayments = MutableStateFlow ( false )
87+ isSyncingLdkNodePayments.value = false
9088 Logger .error(" syncActivities error" , e, context = TAG )
9189 }
9290 }
0 commit comments