#8 Configure sort order for each favourites category

This commit is contained in:
Koitharu
2021-08-04 08:32:20 +03:00
parent 6f7efa9e26
commit fbd0f25b8f
19 changed files with 201 additions and 45 deletions

View File

@@ -8,6 +8,7 @@ import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.flow.retry
import org.koitharu.kotatsu.core.model.SortOrder
import org.koitharu.kotatsu.favourites.domain.FavouritesRepository
import org.koitharu.kotatsu.history.domain.HistoryRepository
import org.koitharu.kotatsu.utils.ext.processLifecycleScope
@@ -17,7 +18,7 @@ import org.koitharu.kotatsu.widget.shelf.ShelfWidgetProvider
class WidgetUpdater(private val context: Context) {
fun subscribeToFavourites(repository: FavouritesRepository) {
repository.observeAll()
repository.observeAll(SortOrder.NEWEST)
.onEach { updateWidget(ShelfWidgetProvider::class.java) }
.retry { error -> error !is CancellationException }
.launchIn(processLifecycleScope)