Notification policy (#4768)
This was so much work wow. I think it works pretty well and is the best compromise between all the alternative we considered. Yes the pull-to-refreh on the notifications works slightly different now when the new bar is visible, but I don't think there is a way around that. Things I plan to do later, i.e. not as part of this PR or release: - Cache the notification policy summary for better offline behavior and less view shifting when it loads - try to reduce some of the code duplications that are now in there - if there is user demand, add a "legacy mode" setting where this feature is disabled even if the server would support it closes #4331 closes #4550 as won't do closes #4712 as won't do <img src="https://github.com/user-attachments/assets/de322d3c-3775-41e7-be57-28ab7fbaecdf" width="240"/> <img src="https://github.com/user-attachments/assets/1ce958a4-4f15-484c-a337-5ad93f36046c" width="240"/> <img src="https://github.com/user-attachments/assets/98b0482b-1c05-4c99-a371-f7f4d8a69abd" width="240"/>
This commit is contained in:
parent
29914f8fd9
commit
cd57352cbd
42 changed files with 2401 additions and 97 deletions
|
|
@ -26,7 +26,8 @@ data class Notification(
|
|||
val id: String,
|
||||
val account: TimelineAccount,
|
||||
val status: Status? = null,
|
||||
val report: Report? = null
|
||||
val report: Report? = null,
|
||||
val filtered: Boolean = false,
|
||||
) {
|
||||
|
||||
/** From https://docs.joinmastodon.org/entities/Notification/#type */
|
||||
|
|
|
|||
|
|
@ -0,0 +1,47 @@
|
|||
/* Copyright 2024 Tusky contributors
|
||||
*
|
||||
* 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.entity
|
||||
|
||||
import com.squareup.moshi.Json
|
||||
import com.squareup.moshi.JsonClass
|
||||
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class NotificationPolicy(
|
||||
@Json(name = "for_not_following") val forNotFollowing: State,
|
||||
@Json(name = "for_not_followers") val forNotFollowers: State,
|
||||
@Json(name = "for_new_accounts") val forNewAccounts: State,
|
||||
@Json(name = "for_private_mentions") val forPrivateMentions: State,
|
||||
@Json(name = "for_limited_accounts") val forLimitedAccounts: State,
|
||||
val summary: Summary
|
||||
) {
|
||||
@JsonClass(generateAdapter = false)
|
||||
enum class State {
|
||||
@Json(name = "accept")
|
||||
ACCEPT,
|
||||
|
||||
@Json(name = "filter")
|
||||
FILTER,
|
||||
|
||||
@Json(name = "drop")
|
||||
DROP
|
||||
}
|
||||
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class Summary(
|
||||
@Json(name = "pending_requests_count") val pendingRequestsCount: Int,
|
||||
@Json(name = "pending_notifications_count") val pendingNotificationsCount: Int
|
||||
)
|
||||
}
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
/* Copyright 2024 Tusky contributors
|
||||
*
|
||||
* 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.entity
|
||||
|
||||
import com.squareup.moshi.Json
|
||||
import com.squareup.moshi.JsonClass
|
||||
|
||||
@JsonClass(generateAdapter = true)
|
||||
data class NotificationRequest(
|
||||
val id: String,
|
||||
val account: Account,
|
||||
@Json(name = "notifications_count") val notificationsCount: String
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue