Tell providers apart in the shown reminders a restyle or restore reads (#100)
This commit is contained in:
1 parent
8dcc48b0ba
commit
4d833a4da6
1 file changed
+10
-2
@@ -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<Posted> {
|
||||
/**
|
||||
* 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<Posted> {
|
||||
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"
|
||||
|
||||
Reference in new issue
Block a user