Notification: ignore seen notifications

This commit is contained in:
Alibek Omarov 2020-01-11 11:21:42 +03:00 committed by fruye
parent a4d57b7cc4
commit 723c67fd0d
2 changed files with 12 additions and 1 deletions

View File

@ -77,6 +77,11 @@ class NotificationFetcher @Inject constructor(
account,
index == 0
)
// Pleroma extension: don't notify about seen notifications
if (notification.pleroma?.seen == true)
return
notificationManager.notify(notification.id, account.id.toInt(), androidNotification)
// Android will rate limit / drop notifications if they're posted too
// quickly. There is no indication to the user that this happened.

View File

@ -20,6 +20,7 @@ import com.google.gson.JsonDeserializationContext
import com.google.gson.JsonDeserializer
import com.google.gson.JsonElement
import com.google.gson.JsonParseException
import com.google.gson.annotations.SerializedName
import com.google.gson.annotations.JsonAdapter
import com.keylesspalace.tusky.R
@ -28,7 +29,8 @@ data class Notification(
val id: String,
val account: TimelineAccount,
val status: Status?,
val report: Report?
val report: Report?,
val pleroma: PleromaNotification? = null,
) {
/** From https://docs.joinmastodon.org/entities/Notification/#type */
@ -86,6 +88,10 @@ data class Notification(
}
}
data class PleromaNotification(
@SerializedName("is_seen") val seen: Boolean
)
override fun hashCode(): Int {
return id.hashCode()
}