mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-06-04 03:38:44 +02:00
d29b7c4e57
Should be better at incremental builds. To format, run `./gradlew ktlintFormat`.
48 lines
1.4 KiB
Kotlin
48 lines
1.4 KiB
Kotlin
package tachiyomi.data.updates
|
|
|
|
import kotlinx.coroutines.flow.Flow
|
|
import tachiyomi.data.DatabaseHandler
|
|
import tachiyomi.domain.updates.model.UpdatesWithRelations
|
|
import tachiyomi.domain.updates.repository.UpdatesRepository
|
|
|
|
class UpdatesRepositoryImpl(
|
|
private val databaseHandler: DatabaseHandler,
|
|
) : UpdatesRepository {
|
|
|
|
override suspend fun awaitWithRead(
|
|
read: Boolean,
|
|
after: Long,
|
|
limit: Long,
|
|
): List<UpdatesWithRelations> {
|
|
return databaseHandler.awaitList {
|
|
updatesViewQueries.getUpdatesByReadStatus(
|
|
read = read,
|
|
after = after,
|
|
limit = limit,
|
|
mapper = updateWithRelationMapper,
|
|
)
|
|
}
|
|
}
|
|
|
|
override fun subscribeAll(after: Long, limit: Long): Flow<List<UpdatesWithRelations>> {
|
|
return databaseHandler.subscribeToList {
|
|
updatesViewQueries.getRecentUpdates(after, limit, updateWithRelationMapper)
|
|
}
|
|
}
|
|
|
|
override fun subscribeWithRead(
|
|
read: Boolean,
|
|
after: Long,
|
|
limit: Long,
|
|
): Flow<List<UpdatesWithRelations>> {
|
|
return databaseHandler.subscribeToList {
|
|
updatesViewQueries.getUpdatesByReadStatus(
|
|
read = read,
|
|
after = after,
|
|
limit = limit,
|
|
mapper = updateWithRelationMapper,
|
|
)
|
|
}
|
|
}
|
|
}
|