feat: add history sync worker

This commit is contained in:
2026-06-07 17:16:47 +02:00
parent 3f25ee4c41
commit 3b14f2fba9
25 changed files with 807 additions and 120 deletions
@@ -45,6 +45,18 @@ object NotificationHelper {
setSound(null, null)
}
)
nm.createNotificationChannel(
NotificationChannel(
NotificationConstants.CHANNEL_SYNC,
context.getString(R.string.notif_channel_sync_name),
NotificationManager.IMPORTANCE_DEFAULT
).apply {
description = context.getString(R.string.notif_channel_sync_desc)
enableVibration(false)
setSound(null, null)
}
)
}
// ── User-facing notifications ─────────────────────────────────────────────
@@ -92,6 +104,26 @@ object NotificationHelper {
)
}
/**
* Posts a notification when the one-time historical payment sync completes.
* No tap destination needed — the user is already in the app or will land
* on the main screen via the default MainActivity launch.
*/
fun notifySyncComplete(context: Context, paymentCount: Int) {
val title = context.getString(R.string.notif_sync_complete_title)
val text = context.getString(R.string.notif_sync_complete_text, paymentCount)
notify(
context,
NotificationConstants.NOTIF_ID_SYNC_COMPLETE,
NotificationCompat.Builder(context, NotificationConstants.CHANNEL_SYNC)
.setSmallIcon(R.drawable.ic_notification)
.setContentTitle(title)
.setContentText(text)
.setAutoCancel(true)
.build()
)
}
// ── Foreground service notification ───────────────────────────────────────
fun buildServiceNotification(context: Context): Notification {