Add option to reset viewer flags (#7062)
* Add option to reset viewer flags * Review Changes * Run `resetViewerFlags()` content with `launchIO`
This commit is contained in:
@@ -3,7 +3,9 @@ package eu.kanade.data.manga
|
||||
import eu.kanade.data.DatabaseHandler
|
||||
import eu.kanade.domain.manga.model.Manga
|
||||
import eu.kanade.domain.manga.repository.MangaRepository
|
||||
import eu.kanade.tachiyomi.util.system.logcat
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import logcat.LogPriority
|
||||
|
||||
class MangaRepositoryImpl(
|
||||
private val databaseHandler: DatabaseHandler,
|
||||
@@ -12,4 +14,14 @@ class MangaRepositoryImpl(
|
||||
override fun getFavoritesBySourceId(sourceId: Long): Flow<List<Manga>> {
|
||||
return databaseHandler.subscribeToList { mangasQueries.getFavoriteBySourceId(sourceId, mangaMapper) }
|
||||
}
|
||||
|
||||
override suspend fun resetViewerFlags(): Boolean {
|
||||
return try {
|
||||
databaseHandler.await { mangasQueries.resetViewerFlags() }
|
||||
true
|
||||
} catch (e: Exception) {
|
||||
logcat(LogPriority.ERROR, e)
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user