When fetching:
- Maintain a marker with the position of the newest fetched notification
- Use the marker to determine which notifications to fetch
- Fetch notifications with min_id to ensure that none are lost
- Update the marker as necessary
- Perform a one-time immediate fetch of notifications on startup
When creating notifications:
- Identify each notification with tag=${MastodonNotificationId}, id=${account.id}
- Remove activeNotifications field, it's no longer necessary
- Use the tag/id tuple to reliably identify existing notifications and avoid creating duplicates
- Cancelling notifications for an account must iterate over all the notifications, and individually remove the notifications that exist for that account.
- Limit notifications to a maximum of 40 (excluding summary notifications)
- Remove notifications (oldest first) to get under this limit
- Rate limit notification creation to 1 per second, so the OS won't drop them
Adjust the summary notification:
- Ensure the summary notification and the child notifications have the same group key
- Dismiss the summary notification if there is only one child notification
NotificationClearBroadcastReceiver is no longer needed, so remove it, and the need for deletePendingIntent.
Fixes #3625, #3539
35 lines
1.5 KiB
Kotlin
35 lines
1.5 KiB
Kotlin
/* Copyright 2018 Jeremiasz Nelz <remi6397(a)gmail.com>
|
|
* Copyright 2018 Conny Duck
|
|
*
|
|
* This file is a part of Tusky.
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify it under the terms of the
|
|
* GNU General Public License as published by the Free Software Foundation; either version 3 of the
|
|
* License, or (at your option) any later version.
|
|
*
|
|
* Tusky is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
|
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
|
* Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License along with Tusky; if not,
|
|
* see <http://www.gnu.org/licenses>. */
|
|
|
|
package com.keylesspalace.tusky.di
|
|
|
|
import com.keylesspalace.tusky.receiver.NotificationBlockStateBroadcastReceiver
|
|
import com.keylesspalace.tusky.receiver.SendStatusBroadcastReceiver
|
|
import com.keylesspalace.tusky.receiver.UnifiedPushBroadcastReceiver
|
|
import dagger.Module
|
|
import dagger.android.ContributesAndroidInjector
|
|
|
|
@Module
|
|
abstract class BroadcastReceiverModule {
|
|
@ContributesAndroidInjector
|
|
abstract fun contributeSendStatusBroadcastReceiver(): SendStatusBroadcastReceiver
|
|
|
|
@ContributesAndroidInjector
|
|
abstract fun contributeUnifiedPushBroadcastReceiver(): UnifiedPushBroadcastReceiver
|
|
|
|
@ContributesAndroidInjector
|
|
abstract fun contributeNotificationBlockStateBroadcastReceiver(): NotificationBlockStateBroadcastReceiver
|
|
}
|