* Separate thread notifications into their own notifications when the feature flag is enabled.
Otherwise, set the `threadId` to null so it'll behave as usual. It's done this way to avoid having to inject `FeatureFlagService` in several places.
* Add permalink navigation to threads from notifications, focusing on the latest event in the list of messages of the notification tapped
* Fix redactions in threads
* Clear notifications for a thread when visiting it
* Fix opening a thread happening twice, first because of the `openThreadId` value, then because of the `focusedEventId` one
* Make opening a room through a notification also focus on the latest event
* Add helper `NotificationCreator.messageTag` function
* Remove unused `ROOM_CALL_NOTIFICATION_ID`: `FOREGROUND_SERVICE_NOTIFICATION_ID`+ `ForegroundServiceType` is used instead
* Simplify `DefaultDeepLinkCreator`
* Make sure the main timeline focuses on the thread root id too when navigating to a thread
* Handle "Mark as read" action for thread notification, using `timeline.markAsRead`
* Log failures to mark rooms as read using the notification action
---------
Co-authored-by: Benoit Marty <benoit@matrix.org>
* Add `getForegroundInfo` implementation to try to fix issues with WorkManager on Android 12 and below
This may be a MIUI-only issue as I couldn't reproduce it with several emulators on Android 11, 12 and 13.
* Use `setExpedited` only on Android 13 or higher, it's not needed on older versions
* Use an actual string resource, fix tests
* Fix review comments
* Fix broken test with Element Pro:
Instead of using Robolectric with API < 33 (since Pro uses minSdk 33) use a `BuildVersionSdkIntProvider`
* Remove `getForegroundInfo` and the associated permission, as we expect it to be dead code
* Fix lint issues
* Cleanup NotificationIdProvider
---------
Co-authored-by: Benoit Marty <benoit@matrix.org>
* Introduce JsonProvider.
It will ensure that classes are using the correct Json instances in the unit tests.
* Avoid creating a Json instance many times.
* Update ref.
* Initial implementation of notification sync using `WorkManager`
* Use custom `MetroWorkerFactory` to allow assisted injection in WorkManager Workers
* Add tests for `FetchNotificationWorker`. Create `FakeNotificationResolverQueue` to help testing.
* Add more tests, fix Konsist checks
* Add tests for `SyncNotificationWorkManagerRequest`
* Simplify `FakeNotificationResolverQueue`