(android) Collect payments as state
@@ -68,7 +68,9 @@ import fr.acinq.phoenix.db.WalletPaymentOrderRow
import fr.acinq.phoenix.managers.Connections
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.ExperimentalCoroutinesApi
+import kotlinx.coroutines.coroutineScope
import kotlinx.coroutines.flow.StateFlow
+import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.launch
@@ -100,7 +102,8 @@ fun HomeView(appVM: AppViewModel) {
}
val paymentsManager = business.paymentsManager
- val paymentsPage by remember { mutableStateOf(paymentsManager.paymentsPage) }
+ val paymentsPage = paymentsManager.paymentsPage.collectAsState()
+
DisposableEffect(key1 = "homeview") {
log.debug { "subscribing to changes in payments page" }
paymentsManager.subscribeToPaymentsPage(0, 50)
