From 680fd446f26dde8947d121234acd84fbbe4004e6 Mon Sep 17 00:00:00 2001 From: Brandon McAnsh Date: Fri, 29 May 2026 18:45:27 -0400 Subject: [PATCH] feat(notifications): trigger contact sync on CONTACT_JOIN push When a CONTACT_JOIN push notification is received, sync contacts to update the isOnFlipcash status for the newly joined contact. Signed-off-by: Brandon McAnsh --- apps/flipcash/shared/notifications/build.gradle.kts | 1 + .../app/notifications/NotificationService.kt | 13 +++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/apps/flipcash/shared/notifications/build.gradle.kts b/apps/flipcash/shared/notifications/build.gradle.kts index 6ef87aedb..41948f5da 100644 --- a/apps/flipcash/shared/notifications/build.gradle.kts +++ b/apps/flipcash/shared/notifications/build.gradle.kts @@ -9,6 +9,7 @@ android { dependencies { implementation(project(":apps:flipcash:shared:authentication")) + implementation(project(":apps:flipcash:shared:contacts")) implementation(project(":apps:flipcash:shared:persistence:sources")) implementation(project(":apps:flipcash:shared:phone")) implementation(project(":apps:flipcash:shared:push")) diff --git a/apps/flipcash/shared/notifications/src/main/kotlin/com/flipcash/app/notifications/NotificationService.kt b/apps/flipcash/shared/notifications/src/main/kotlin/com/flipcash/app/notifications/NotificationService.kt index 185c828bb..1e23580b1 100644 --- a/apps/flipcash/shared/notifications/src/main/kotlin/com/flipcash/app/notifications/NotificationService.kt +++ b/apps/flipcash/shared/notifications/src/main/kotlin/com/flipcash/app/notifications/NotificationService.kt @@ -11,6 +11,7 @@ import androidx.core.app.NotificationCompat import androidx.core.app.NotificationManagerCompat import androidx.core.net.toUri import com.flipcash.app.auth.AuthManager +import com.flipcash.app.contacts.ContactCoordinator import com.flipcash.app.core.util.Linkify import com.flipcash.app.persistence.sources.ContactDataSource import com.flipcash.app.phone.PhoneUtils @@ -61,6 +62,9 @@ class NotificationService : FirebaseMessagingService(), @Inject lateinit var contactDataSource: ContactDataSource + @Inject + lateinit var contactCoordinator: ContactCoordinator + @Inject lateinit var phoneUtils: PhoneUtils @@ -102,8 +106,13 @@ class NotificationService : FirebaseMessagingService(), .takeIf { it.isNotEmpty() } ?.let { NotificationPayload.fromEncoded(it) } - if (payload?.navigation is NavigationTrigger.CurrencyInfo) { - launch { tokenCoordinator.update() } + when { + payload?.navigation is NavigationTrigger.CurrencyInfo -> { + launch { tokenCoordinator.update() } + } + payload?.category == NotificationCategory.CONTACT_JOIN -> { + launch { contactCoordinator.sync() } + } } launch {