Inline readImageHeaderSubscription in PageHolder
Inline readImageHeaderSubscription in PagerPageHolder and
WebtoonPageHolder by converting setImage() into a suspend function.
The image processing runs in the loadPageAndProcessStatus
continuation.
Use suspendCancellableCoroutine as a substitute for doOnUnsubscribe
in WebtoonPageHolder.
Closing openStream after the frame.setImage but before the PageHolder
is recycled causes the page display to fail for reasons that are not
currently understood.
Remove subscription handling from WebtoonViewer/WebtoonBaseHolder as
it is no longer used.
(cherry picked from commit ffa8c8fd0746863e08b839f9d91102fe6d5d7887)
# Conflicts:
# app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerPageHolder.kt
# app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/webtoon/WebtoonPageHolder.kt
Inline statusJob into loadJob, using supervisorScope to load the page
and track status changes in parallel.
- supervisorScope does not complete until both the child loadPage
coroutine and statusFlow.collectLatest have completed.
- Cancelling supervisorScope cancels the child loadPage coroutine and
statusFlow.collectLatest.
- Use supervisorScope instead of coroutineScope to let status
collection continue if loadPage fails.
Inline progressJob into loadJob, using collectLatest's cancellation
to avoid cancelling the progressFlow collection explicitly.
- collectLatest cancels the previous action block when the flow
emits a new value. This means the DOWNLOAD_IMAGE
progressFlow.collectLatest gets automatically cancelled when
statusFlow emits a new state.
Convert launchLoadJob to suspend function, move job launch to caller,
and rename as loadPageAndProcessStatus.
(cherry picked from commit 4635e58405eedce0b49fc69f7ccb190a7c600da9)
# Conflicts:
# app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerPageHolder.kt
* Rework the wheel picker
doesn't need for the animation to stop to change the value
* fix
---------
Co-authored-by: arkon <arkon@users.noreply.github.com>
(cherry picked from commit be4072c86b9251bb7110f873c9332a2890ca69ef)
# Conflicts:
# .github/renovate.json
# app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsLibraryScreen.kt
Same reasoning as removing app update check. It gets kicked off in the foreground now too.
(cherry picked from commit 2970eca9e4b56ede7549eb6d49841b7011fe0741)
# Conflicts:
# app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsBrowseScreen.kt
# app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt
We already check in the foreground. If the app isn't being foregrounded at all, then there isn't much
point in checking for an update.
(cherry picked from commit 42954609b94e13d8fadbf1f3769e9f32fa9e8447)
# Conflicts:
# app/build.gradle.kts
# app/src/main/java/eu/kanade/tachiyomi/data/updater/AppUpdateJob.kt
* 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()
(cherry picked from commit 7b118eba22b6c9caccf09cbd53f846869d5c6f2a)
# Conflicts:
# app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryItem.kt
Simplifies things and maybe discourages whacky downloading behavior?
Users can still range select in the chapters list to download custom amounts.
(cherry picked from commit f6e6a7ddf1d32a55da81344b1ae360e16e5560e4)
# Conflicts:
# app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryScreenModel.kt
# app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryTab.kt
# app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreenModel.kt
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>
(cherry picked from commit ef9dacde79b1803ec117aae4ea948194b6394605)
# Conflicts:
# app/build.gradle.kts
# app/src/main/java/eu/kanade/presentation/more/settings/screen/SettingsAdvancedScreen.kt
# app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateService.kt
# app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryTab.kt
* 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
(cherry picked from commit bd2cb97179de60dded147f1ec9cdb55f70f28e74)
* Show exception class in snackbar message
* omit IOException too
(cherry picked from commit 589bdba0b1538266b7786591046f88a1159cbb8c)
# Conflicts:
# app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreenModel.kt
* 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.
(cherry picked from commit aca65f13bb94b6c0c4a77a9d426491d3667f4a7d)
Move Widget to seperate module
- Create a core module for presentation. Widget and App will share some resources and hopefully composables
(cherry picked from commit 12e41b6e6f3b5d95d19e1caa6c9fbe5eb6c9749c)
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.
(cherry picked from commit 3a82b4d924ae7207f7d1c1b23d2a71a1e7d09258)
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.
(cherry picked from commit b4b3a4d2869fae7839b4b3111e289056e33cfea8)
# Conflicts:
# app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/HttpPageLoader.kt
* Follow page status via StateFlow
Keep getPage subscription since it's needed to load the pages
* Replace PageLoader.getPage with PageLoader.loadPage
(cherry picked from commit 2ef1f07aaea0852c13a4eb4096ac96c8aa507c39)
# Conflicts:
# app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/HttpPageLoader.kt
# app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerPageHolder.kt