Glimpse: Flow content provides flows on IO dispatcher

Change-Id: Idfa0bc09dda0eb71835c1b8d3c9572b5a757bb43
This commit is contained in:
Luca Stefani 2023-08-19 18:10:52 +02:00 committed by Sebastiano Barezzi
parent 3107835489
commit 1baef233ff
No known key found for this signature in database
GPG Key ID: 763BD3AE91A7A13F
1 changed files with 6 additions and 4 deletions

View File

@ -6,13 +6,15 @@
package org.lineageos.glimpse.repository
import android.content.Context
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.flowOn
import org.lineageos.glimpse.flow.AlbumsFlow
import org.lineageos.glimpse.flow.MediaFlow
@Suppress("Unused")
class MediaRepository(private val context: Context) {
fun media(bucketId: Int? = null) = MediaFlow(context, bucketId).flowData()
fun mediaCursor(bucketId: Int? = null) = MediaFlow(context, bucketId).flowCursor()
fun albums() = AlbumsFlow(context).flowData()
fun albumsCursor() = AlbumsFlow(context).flowCursor()
fun media(bucketId: Int? = null) = MediaFlow(context, bucketId).flowData().flowOn(Dispatchers.IO)
fun mediaCursor(bucketId: Int? = null) = MediaFlow(context, bucketId).flowCursor().flowOn(Dispatchers.IO)
fun albums() = AlbumsFlow(context).flowData().flowOn(Dispatchers.IO)
fun albumsCursor() = AlbumsFlow(context).flowCursor().flowOn(Dispatchers.IO)
}