* Move LibraryItem vars to constructor vals
* Convert LibraryItem to data class
Remove redundant equals and hashCode
* Remove unused LibraryItem.displayMode
* Simplify LibraryItem.matches()
* Align types in LibraryItem and LibraryBadges
* fixup! Simplify LibraryItem.matches()
No more trampolining, and stuff.
It's pretty much straight copy-paste from the service, with
some changes related to cancellation handling. Manual updates
will also runs with workman job so auto update work
scheduling need some adjustments too.
Bumped version code to re-enqueue auto update job with the
new spec.
Co-authored-by: arkon <arkon@users.noreply.github.com>
* 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
This reverts commit 6bb3070c57.
This doesn't quite work correctly, so reverting for now.
We'll have to have more robust states or something to deal with this in the
future.
* Simplify DownloadService wake lock handling
_isRunning is only modified in onCreate/onDestroy, so the listener
job is redundant.
* Drop superclass calls to Service.onCreate/onDestroy
From https://developer.android.com/guide/components/services
> Note: Unlike the activity lifecycle callback methods, you are not
> required to call the superclass implementation of these callback
> methods.
Fixes#8962.
withTimeout throws a TimeoutCancellationException if the timeout
expires. To avoid crashing renewalJob when there are no extensions,
use withTimeoutOrNull which does not throw on timeout.
Fixup for e4bc8990 (#8955)
HttpSource.fetchImage() uses Call.asObservableSuccess(), which
cancels the call on unsubscribe. This causes the call to be cancelled
before it is used, leading to a "java.net.SocketException: Socket is
closed" when trying to use the response in putImageToCache().
To fix this, use Call.awaitSuccess() via a new HttpSource.getImage()
suspending function. This addition to source-api is only intended for
app use, so it will not be added to the extensions-api stubs.
To keep the commit from being 100+ files the interactors wasn't moved.
The domain module like the data module uses `tachiyomi` instead of `eu.kanade.tachiyomi` for package names
Fixes#8881
The actual issue is that the ViewModel migration actually differs between what the current `init` block
and previous `onSave` methods did; where the `init` block does not get triggered on saving the
instance on config changes.
Not entirely sure why onSaveInstanceState was explicitly avoided for config changes before, but we
just do it all the time now and end up updating the requestedPage with the current page.
* Convert downloader Observable to flow
Uses `runInterruptible` to turn the blocking call to `queue.take()`
into a cancellable call.
Flow collection is ended by cancelling the scope in `recycle`. This
means the `HttpPageLoader` can't be reused after calling `recycle`,
but this was true with the `Observable` as well.)
* Convert load Observables to suspending function
Inlining the Observables allows for some simplification of the error
handling. Behavior should be otherwise identical.
* Convert cleanup Completable to coroutine
Uses global `launchIO`, not ideal but similar to previous behavior.
Can't be scheduled on the local `scope` as this runs after `scope` is
cancelled.
* Revert "Recreate reader settings when opening sheet (#8054)"
This reverts commit acb8ab15b2.
* Revert "Fix stacking of Settings menu in the reader on multiple taps (#8002)"
This reverts commit 30ac94181b.
* Fix reader settings sheet not updated