mihon/app/src/main/java/eu/kanade/tachiyomi/data
Two-Ai bd2cb97179
Replace RxJava in DownloadQueue (#9016)
* Misc cleanup

- Replace !List.isEmpty with List.isNotEmpty
- Remove redundant case in MoreScreenModel
- Drop no-op StateFlow.catch
  - From lint warning:
> SharedFlow never completes, so this operator typically has not
> effect, it can only catch exceptions from 'onSubscribe' operator

* Convert DownloadQueue queue to MutableStateFlow

Replace delegation to a MutableList with an internal
MutableStateFlow<List>.

In order to avoid modifying every usage of the queue as a list, add
passthrough functions for the currently used list functions. This
should be later refactored, possibly by inlining DownloadQueue
into Downloader.

DownloadQueue.updates was a SharedFlow which updated every time a
change was made to the queue. This is now equivalent to the queue
StateFlow.

Simultaneous assignments to _state.value could cause concurrency
issues. To avoid this, always modify the queue using _state.update.

* Add Download.statusFlow/progressFlow

progressFlow is based on the DownloadQueueScreenModel implementation
rather than the DownloadQueue implementation.

* Reimplement DownloadQueue.statusFlow/progressFlow

Use StateFlow<List<T>>.flatMapLatest() and List<Flow<T>>.merge() to
replicate the effect of PublishSubject.

Use drop(1) to avoid re-emitting the state of each download each time
the merged flow is recreated.

* fixup! Reimplement DownloadQueue.statusFlow/progressFlow
2023-02-07 22:13:19 -05:00
..
backup Misc Service cleanup (#9005) 2023-01-30 17:25:54 -05:00
cache Move more models to domain module 2023-01-22 10:54:28 -05:00
coil Move more things around 2023-01-27 22:31:12 -05:00
database/models Move more models to domain module 2023-01-22 10:54:28 -05:00
download Replace RxJava in DownloadQueue (#9016) 2023-02-07 22:13:19 -05:00
library Misc Service cleanup (#9005) 2023-01-30 17:25:54 -05:00
notification Move more things around 2023-01-27 22:31:12 -05:00
preference Split the rest of the preferences in PreferencesHelper (#8074) 2022-09-25 10:07:06 -04:00
saver Move more things around 2023-01-27 22:31:12 -05:00
track Move more things around 2023-01-27 22:31:12 -05:00
updater Misc Service cleanup (#9005) 2023-01-30 17:25:54 -05:00