Skip to content

Commit 02f88cb

Browse files
committed
chore(pools): update activity feed on successful bid and resolution of a pool
Signed-off-by: Brandon McAnsh <git@bmcreations.dev>
1 parent 8e97610 commit 02f88cb

3 files changed

Lines changed: 8 additions & 0 deletions

File tree

apps/flipcash/shared/payments/build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ dependencies {
5050
implementation(Libs.androidx_localbroadcastmanager)
5151

5252
implementation(project(":apps:flipcash:core"))
53+
implementation(project(":apps:flipcash:shared:activityfeed"))
5354
implementation(project(":libs:messaging"))
5455
implementation(project(":ui:components"))
5556
implementation(project(":ui:resources"))

apps/flipcash/shared/payments/src/main/kotlin/com/flipcash/app/payments/internal/InternalPoolBidDelegate.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.flipcash.app.payments.internal
22

3+
import com.flipcash.app.activityfeed.ActivityFeedCoordinator
34
import com.flipcash.app.core.pools.Pool
45
import com.flipcash.app.payments.delegates.PoolBidDelegate
56
import com.flipcash.services.user.UserManager
@@ -19,6 +20,7 @@ internal class InternalPoolBidDelegate @Inject constructor(
1920
private val exchange: Exchange,
2021
private val transactionController: TransactionController,
2122
private val userManager: UserManager,
23+
private val activityFeedCoordinator: ActivityFeedCoordinator,
2224
): PoolBidDelegate {
2325
override suspend fun payForBid(
2426
pool: Pool,
@@ -50,6 +52,7 @@ internal class InternalPoolBidDelegate @Inject constructor(
5052
source = userManager.accountCluster!!,
5153
).map { it.id.bytes }.onSuccess {
5254
// update balance on successful bid payment
55+
activityFeedCoordinator.fetchSinceLatest()
5356
balanceController.subtract(localizedAmount)
5457
onSuccess(it)
5558
}.onFailure {

apps/flipcash/shared/payments/src/main/kotlin/com/flipcash/app/payments/internal/InternalPoolResolveDelegate.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.flipcash.app.payments.internal
22

3+
import com.flipcash.app.activityfeed.ActivityFeedCoordinator
34
import com.flipcash.app.core.pools.Pool
45
import com.flipcash.app.core.pools.PoolBet
56
import com.flipcash.app.core.pools.PoolBetOutcome
@@ -33,6 +34,7 @@ class InternalPoolResolveDelegate @Inject constructor(
3334
private val userManager: UserManager,
3435
private val accountController: AccountController,
3536
private val exchange: Exchange,
37+
private val activityFeedCoordinator: ActivityFeedCoordinator,
3638
) : PoolResolveDelegate {
3739
override suspend fun resolvePool(
3840
pool: Pool,
@@ -83,6 +85,8 @@ class InternalPoolResolveDelegate @Inject constructor(
8385
if (balanceIncrement != null) {
8486
balanceController.add(balanceIncrement)
8587
}
88+
// update balance on successful bid payment
89+
activityFeedCoordinator.fetchSinceLatest()
8690
onSuccess(it)
8791
}.onFailure {
8892
onError(it)

0 commit comments

Comments
 (0)