diff --git a/data/src/main/sqldelight/tachiyomi/view/updatesView.sq b/data/src/main/sqldelight/tachiyomi/view/updatesView.sq index 437b86ea0..fc6953818 100644 --- a/data/src/main/sqldelight/tachiyomi/view/updatesView.sq +++ b/data/src/main/sqldelight/tachiyomi/view/updatesView.sq @@ -24,3 +24,9 @@ updates: SELECT * FROM updatesView WHERE dateUpload > :after; + +getUpdatesByReadStatus: +SELECT * +FROM updatesView +WHERE read = :read +AND dateUpload > :after; \ No newline at end of file diff --git a/presentation-widget/src/main/java/tachiyomi/presentation/widget/TachiyomiWidgetManager.kt b/presentation-widget/src/main/java/tachiyomi/presentation/widget/TachiyomiWidgetManager.kt index 1ede10ba0..ca33d4b31 100644 --- a/presentation-widget/src/main/java/tachiyomi/presentation/widget/TachiyomiWidgetManager.kt +++ b/presentation-widget/src/main/java/tachiyomi/presentation/widget/TachiyomiWidgetManager.kt @@ -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 { diff --git a/presentation-widget/src/main/java/tachiyomi/presentation/widget/UpdatesGridGlanceWidget.kt b/presentation-widget/src/main/java/tachiyomi/presentation/widget/UpdatesGridGlanceWidget.kt index 6573dbbd9..280c5d679 100644 --- a/presentation-widget/src/main/java/tachiyomi/presentation/widget/UpdatesGridGlanceWidget.kt +++ b/presentation-widget/src/main/java/tachiyomi/presentation/widget/UpdatesGridGlanceWidget.kt @@ -72,7 +72,12 @@ class UpdatesGridGlanceWidget : GlanceAppWidget() { val processList = list ?: Injekt.get() - .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 }