From 4d833a4da6b131acbffe9e16fee22c1b1e463334 Mon Sep 17 00:00:00 2001 From: Jean-Luc Makiola Date: Fri, 20 Nov 2026 13:08:29 +0100 Subject: [PATCH] Tell providers apart in the shown reminders a restyle or restore reads (#100) --- .../agendula/data/reminders/TaskNotifier.kt | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/de/jeanlucmakiola/agendula/data/reminders/TaskNotifier.kt b/app/src/main/java/de/jeanlucmakiola/agendula/data/reminders/TaskNotifier.kt index ffda483..0be5d49 100644 --- a/app/src/main/java/de/jeanlucmakiola/agendula/data/reminders/TaskNotifier.kt +++ b/app/src/main/java/de/jeanlucmakiola/agendula/data/reminders/TaskNotifier.kt @@ -156,6 +156,7 @@ class TaskNotifier @Inject constructor( Bundle().apply { putLong(EXTRA_OCCURRENCE, occurrence) putLong(EXTRA_DUE, task.due?.toEpochMilliseconds() ?: NO_DUE) + putString(EXTRA_STORE, store) }, ) .addAction(0, context.getString(R.string.reminder_action_done), actionIntent(task, ReminderActionReceiver.ACTION_DONE, store)) @@ -311,11 +312,17 @@ class TaskNotifier @Inject constructor( val notification: Notification, ) - /** The current store's posted reminders; another store's ids name other tasks. */ - private fun postedReminders(): List { + /** + * The current store's posted reminders; another store's or provider's ids + * name other tasks. One posted before the provider was recorded is the + * bare store's. + */ + private suspend fun postedReminders(): List { val prefix = "$LIST_CHANNEL_PREFIX${channelStore}_" + val store = settingsPrefs.storeScope() return manager.activeNotifications .filter { it.id == NOTIFICATION_ID && it.notification.channelId?.startsWith(prefix) == true } + .filter { (it.notification.extras.getString(EXTRA_STORE) ?: channelStore) == store } .mapNotNull { posted -> val taskId = posted.tag?.toLongOrNull() ?: return@mapNotNull null val extras = posted.notification.extras @@ -422,6 +429,7 @@ class TaskNotifier @Inject constructor( private const val CHANNEL_PREFS = "reminder_channels" private const val KEY_LEGACY_IMPORTANCE = "legacy_importance" private const val EXTRA_DUE = "de.jeanlucmakiola.agendula.extra.DUE" + private const val EXTRA_STORE = "de.jeanlucmakiola.agendula.extra.STORE" private const val NO_DUE = Long.MIN_VALUE private const val PERSISTENT_GROUP_PREFIX = "reminder_" private const val SILENT_GROUP = "reminders"