Skip to content

Commit c2b9ce3

Browse files
committed
feat: update in progress transfers
1 parent d8928cd commit c2b9ce3

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ class ActivityRepo @Inject constructor(
5757
syncLdkNodePayments(payments = payments)
5858
updateActivitiesMetadata()
5959
boostPendingActivities()
60+
updateInProgressTransfers()
6061
isSyncingLdkNodePayments = false
6162
return@withContext Result.success(Unit)
6263
}.onFailure { e ->
@@ -323,6 +324,18 @@ class ActivityRepo @Inject constructor(
323324
}
324325
}
325326

327+
private suspend fun updateInProgressTransfers() {
328+
cacheStore.data.first().inProgressTransfers.forEach { transfer ->
329+
getActivity(transfer.activityId).onSuccess { activity ->
330+
(activity as? Onchain)?.let { onChain ->
331+
if (onChain.v1.confirmed) {
332+
cacheStore.removeInProgressTransfer(transfer)
333+
}
334+
}
335+
}
336+
}
337+
}
338+
326339
private suspend fun boostPendingActivities() = withContext(bgDispatcher) {
327340
cacheStore.data.first().pendingBoostActivities.forEach { pendingBoostActivity ->
328341
findActivityByPaymentId(

0 commit comments

Comments
 (0)