diff --git a/data/src/main/java/tachiyomi/data/updates/UpdatesRepositoryImpl.kt b/data/src/main/java/tachiyomi/data/updates/UpdatesRepositoryImpl.kt index 877eb6f1b..00b4fffcf 100644 --- a/data/src/main/java/tachiyomi/data/updates/UpdatesRepositoryImpl.kt +++ b/data/src/main/java/tachiyomi/data/updates/UpdatesRepositoryImpl.kt @@ -19,9 +19,9 @@ class UpdatesRepositoryImpl( } } - override fun subscribeAll(after: Long): Flow> { + override fun subscribeAll(after: Long, limit: Long): Flow> { return databaseHandler.subscribeToList { - updatesViewQueries.updates(after, updateWithRelationMapper) + updatesViewQueries.getRecentUpdates(after, limit, updateWithRelationMapper) } } diff --git a/data/src/main/sqldelight/tachiyomi/view/updatesView.sq b/data/src/main/sqldelight/tachiyomi/view/updatesView.sq index fc6953818..6e9fd95c2 100644 --- a/data/src/main/sqldelight/tachiyomi/view/updatesView.sq +++ b/data/src/main/sqldelight/tachiyomi/view/updatesView.sq @@ -20,10 +20,11 @@ WHERE favorite = 1 AND date_fetch > date_added ORDER BY date_fetch DESC; -updates: +getRecentUpdates: SELECT * FROM updatesView -WHERE dateUpload > :after; +WHERE dateUpload > :after +LIMIT :limit; getUpdatesByReadStatus: SELECT * diff --git a/domain/src/main/java/tachiyomi/domain/updates/interactor/GetUpdates.kt b/domain/src/main/java/tachiyomi/domain/updates/interactor/GetUpdates.kt index 988b860c9..f1738d71a 100644 --- a/domain/src/main/java/tachiyomi/domain/updates/interactor/GetUpdates.kt +++ b/domain/src/main/java/tachiyomi/domain/updates/interactor/GetUpdates.kt @@ -13,10 +13,8 @@ class GetUpdates( return repository.awaitWithRead(read, after) } - fun subscribe(calendar: Calendar): Flow> = subscribe(calendar.time.time) - - fun subscribe(after: Long): Flow> { - return repository.subscribeAll(after) + fun subscribe(calendar: Calendar): Flow> { + return repository.subscribeAll(calendar.time.time, limit = 250) } fun subscribe(read: Boolean, after: Long): Flow> { diff --git a/domain/src/main/java/tachiyomi/domain/updates/repository/UpdatesRepository.kt b/domain/src/main/java/tachiyomi/domain/updates/repository/UpdatesRepository.kt index 8c879d323..0856b4b9f 100644 --- a/domain/src/main/java/tachiyomi/domain/updates/repository/UpdatesRepository.kt +++ b/domain/src/main/java/tachiyomi/domain/updates/repository/UpdatesRepository.kt @@ -7,7 +7,7 @@ interface UpdatesRepository { suspend fun awaitWithRead(read: Boolean, after: Long): List - fun subscribeAll(after: Long): Flow> + fun subscribeAll(after: Long, limit: Long): Flow> fun subscribeWithRead(read: Boolean, after: Long): Flow> }