Only show unread entries in widget

Closes #9083
This commit is contained in:
arkon 2023-02-18 10:51:06 -05:00
parent ef863335e6
commit 3634b52e3a
3 changed files with 18 additions and 2 deletions

View File

@ -24,3 +24,9 @@ updates:
SELECT *
FROM updatesView
WHERE dateUpload > :after;
getUpdatesByReadStatus:
SELECT *
FROM updatesView
WHERE read = :read
AND dateUpload > :after;

View File

@ -16,7 +16,12 @@ class TachiyomiWidgetManager(
) {
fun Context.init(scope: LifecycleCoroutineScope) {
database.subscribeToList { updatesViewQueries.updates(after = UpdatesGridGlanceWidget.DateLimit.timeInMillis) }
database.subscribeToList {
updatesViewQueries.getUpdatesByReadStatus(
read = false,
after = UpdatesGridGlanceWidget.DateLimit.timeInMillis,
)
}
.drop(1)
.distinctUntilChanged()
.onEach {

View File

@ -72,7 +72,12 @@ class UpdatesGridGlanceWidget : GlanceAppWidget() {
val processList = list
?: Injekt.get<DatabaseHandler>()
.awaitList { updatesViewQueries.updates(after = DateLimit.timeInMillis) }
.awaitList {
updatesViewQueries.getUpdatesByReadStatus(
read = false,
after = DateLimit.timeInMillis,
)
}
val (rowCount, columnCount) = ids
.flatMap { manager.getAppWidgetSizes(it) }
.maxBy { it.height.value * it.width.value }