tachiyomi/data/src/main/java/tachiyomi/data/updates/UpdatesRepositoryImpl.kt
arkon d29b7c4e57 Switch to different ktlint plugin
Should be better at incremental builds.
To format, run `./gradlew ktlintFormat`.
2023-09-01 23:02:18 -04:00

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,
)
}
}
}