0
0
mirror of https://github.com/mediathekview/zapp.git synced 2024-09-20 04:12:14 +02:00

Fix unneeded changes triggered by MediathekRepository

This commit is contained in:
Christine Coenen 2022-10-28 20:20:30 +02:00
parent 28d09c7e0f
commit 72b3bfa6c9

View File

@ -6,10 +6,7 @@ import de.christinecoenen.code.zapp.models.shows.MediathekShow
import de.christinecoenen.code.zapp.models.shows.PersistedMediathekShow
import de.christinecoenen.code.zapp.persistence.Database
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.filterNotNull
import kotlinx.coroutines.flow.flowOn
import kotlinx.coroutines.flow.onStart
import kotlinx.coroutines.flow.*
import kotlinx.coroutines.withContext
import org.joda.time.DateTime
@ -27,6 +24,7 @@ class MediathekRepository(private val database: Database) {
database
.mediathekShowDao()
.getFromApiId(show.apiId)
.distinctUntilChanged()
.flowOn(Dispatchers.IO)
}
@ -61,6 +59,7 @@ class MediathekRepository(private val database: Database) {
return database
.mediathekShowDao()
.getFromId(id)
.distinctUntilChanged()
.flowOn(Dispatchers.IO)
}
@ -68,6 +67,7 @@ class MediathekRepository(private val database: Database) {
return database
.mediathekShowDao()
.getCompletedDownloads()
.distinctUntilChanged()
.flowOn(Dispatchers.IO)
}
@ -75,6 +75,7 @@ class MediathekRepository(private val database: Database) {
return database
.mediathekShowDao()
.getFromApiId(apiId)
.distinctUntilChanged()
.filterNotNull()
.flowOn(Dispatchers.IO)
}
@ -83,6 +84,7 @@ class MediathekRepository(private val database: Database) {
return database
.mediathekShowDao()
.getFromDownloadId(downloadId)
.distinctUntilChanged()
.flowOn(Dispatchers.IO)
}
@ -90,6 +92,7 @@ class MediathekRepository(private val database: Database) {
return database
.mediathekShowDao()
.getDownloadStatus(id)
.distinctUntilChanged()
.onStart { emit(DownloadStatus.NONE) }
.flowOn(Dispatchers.IO)
}
@ -98,6 +101,7 @@ class MediathekRepository(private val database: Database) {
return database
.mediathekShowDao()
.getDownloadProgress(id)
.distinctUntilChanged()
.flowOn(Dispatchers.IO)
}
@ -118,6 +122,7 @@ class MediathekRepository(private val database: Database) {
return database
.mediathekShowDao()
.getPlaybackPositionPercent(apiId)
.distinctUntilChanged()
.filterNotNull()
.onStart { emit(0f) }
.flowOn(Dispatchers.IO)