Commit Graph

12 Commits

Author SHA1 Message Date
UlrichKu 8efe3a96b7
3820: Group android notifications and properly use the "group summary alert" (#3821)
Fixes #3820 

This mainly corrects the "first of batch" logic.
(Each group/batch has a list so the question "only one per this group?"
can be answered.)
2023-11-23 08:25:00 +01:00
UlrichKu b286255630
3532: Show badge on conversations tab on new conversations (#3890)
Fixes #3532

(Old PR, now closed: https://github.com/tuskyapp/Tusky/pull/3533)

Listens on new notifications and if a "direct mention" is detected a
badge (red dot) is shown on the conversations tab if present.

I am missing things like this a lot and also big accounts are unhappy
with the usability so far:
https://mastodon.social/@pallenberg/110129889996182814
2023-10-15 21:39:38 +02:00
Lakoja 4af160853d Remove unneeded code 2023-09-11 21:58:56 +02:00
Nik Clayton 1f7a5f626d
Show notifications from workers (#3760)
Fix a crash where workers, in some conditions, should show a notification. These are sent to a dedicated channel with no importance.

Convert NotificationWorker to a CoroutineWorker and remove its use of `runBlocking`.

Fixes #3754
2023-06-29 18:37:27 +02:00
Nik Clayton 01b3cb3a53
Fetch all outstanding Mastodon notifications when creating Android notifications (#3700)
* Fetch all outstanding Mastodon notifications when creating Android notifications

Previous code fetched the oldest page of unfetched Mastodon notifications.

If you had more than a page of Mastodon notifications you'd get Android notifications for that page, then ~ 15 minutes later Android notifications for the next page, and so on.

This code fetches all the outstanding notifications at once.

If this results in more than 40 total notifications the list is still trimmed so that a maximum of 40 Android notifications is displayed.

Fixes https://github.com/tuskyapp/Tusky/issues/3648

* Build the list using buildList
2023-06-01 19:31:30 +02:00
Nik Clayton d644f6e6f3
Save the a copy of the notification marker ID locally (#3672)
Not all servers support the marker API. If they don't the user will
potentially get duplicate Android notifications.

To resolve this, store a copy of the notification marker ID locally as
well. Defer to the remote marker if it exists (and is newer than the
local marker).

Fixes https://github.com/tuskyapp/Tusky/issues/3671
2023-05-18 23:23:42 +02:00
Nik Clayton 158f9b83fb
updateMarkersWithAuth(): Require DOMAIN header (#3660)
Otherwise markers are updated for the wrong account.

Fixes https://github.com/tuskyapp/Tusky/issues/3658
2023-05-16 18:24:38 +02:00
Nik Clayton 92ba53a8c3
Compare notification IDs by length as well as value (#3657) 2023-05-15 23:11:14 +02:00
Nik Clayton 81b15e72f3
Only fetch and display a given notification once (#3626)
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
2023-05-13 16:00:28 +02:00
Konrad Pozniak e29567c9ec
Cleanup dagger setup (#2300)
* cleanup dagger setup

* fix tests

* fix ktlint

* cleanup FragmentBuildersModule
2022-01-23 20:24:55 +01:00
Konrad Pozniak 16ffcca748
add ktlint plugin to project and apply default code style (#2209)
* add ktlint plugin to project and apply default code style

* some manual adjustments, fix wildcard imports

* update CONTRIBUTING.md

* fix formatting
2021-06-28 21:13:24 +02:00
Ivan Kupalov e4c10f1ca4
Improve notifications fetching (#1930)
* Improve notifications fetching

 - Only fetch notifications up to the latest fetched one
 - Use timeline markers to avoid showing already seen notifications

* Apply some of the suggestions
2020-09-20 18:43:28 +02:00