mirror of
https://github.com/ReVanced/revanced-manager.git
synced 2026-03-13 08:41:57 +08:00
feat: Don't mark all announcements as read on first launch, and set the correct default tags
This commit is contained in:
@@ -98,19 +98,14 @@ class DashboardViewModel(
|
||||
} ?: throw IllegalStateException("Announcements could not be retrieved")
|
||||
|
||||
val readAnnouncements = prefs.readAnnouncements.get()
|
||||
if (readAnnouncements.isEmpty()) {
|
||||
val announcementIds = announcements.mapTo(mutableSetOf()) { it.id }
|
||||
prefs.readAnnouncements.update(announcementIds)
|
||||
return@uiSafe
|
||||
}
|
||||
|
||||
unreadAnnouncement = announcements.firstOrNull { announcement ->
|
||||
val isNotArchived =
|
||||
announcement.archivedAt.toInstant(TimeZone.UTC) > Clock.System.now()
|
||||
|
||||
val hasRelevantTag = "revanced" in announcement.tags ||
|
||||
"manager" in announcement.tags
|
||||
|
||||
val hasRelevantTag = announcement.tags.any {
|
||||
it == "✨ ReVanced" || it == "💊 Manager"
|
||||
}
|
||||
val isUnread = announcement.id !in readAnnouncements
|
||||
|
||||
isNotArchived && hasRelevantTag && isUnread
|
||||
|
||||
Reference in New Issue
Block a user