Refactor notifications to Kotlin & paging (#4026)

This refactors the NotificationsFragment and related classes to Kotlin &
paging.
While trying to preserve as much of the original behavior as possible,
this adds the following improvements as well:
- The "show notifications filter" preference was added again
- The "load more" button now has a background ripple effect when clicked
- The "legal" report category of Mastodon 4.2 is now supported in report
notifications
- Unknown notifications now display "unknown notification type" instead
of an empty line

Other code quality improvements:
- All views from xml layouts are now referenced via ViewBindings
- the classes responsible for showing system notifications were moved to
a new package `systemnotifications` while the classes from this
refactoring are in `notifications`
- the id of the local Tusky account is now called `tuskyAccountId` in
all places I could find

closes https://github.com/tuskyapp/Tusky/issues/3429

---------

Co-authored-by: Zongle Wang <wangzongler@gmail.com>
This commit is contained in:
Konrad Pozniak 2024-05-03 18:27:10 +02:00 committed by GitHub
commit b2c0b18c8e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
121 changed files with 6992 additions and 4654 deletions

View file

@ -137,15 +137,18 @@ interface MastodonApi {
): Response<List<Status>>
@GET("api/v1/notifications")
@Throws(Exception::class)
suspend fun notifications(
/** Return results older than this ID */
@Query("max_id") maxId: String?,
@Query("max_id") maxId: String? = null,
/** Return results newer than this ID */
@Query("since_id") sinceId: String?,
@Query("since_id") sinceId: String? = null,
/** Return results immediately newer than this ID */
@Query("min_id") minId: String? = null,
/** Maximum number of results to return. Defaults to 15, max is 30 */
@Query("limit") limit: Int?,
@Query("limit") limit: Int? = null,
/** Types to excludes from the results */
@Query("exclude_types[]") excludes: Set<Notification.Type>?
@Query("exclude_types[]") excludes: Set<Notification.Type>? = null
): Response<List<Notification>>
/** Fetch a single notification */