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
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
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.
(cherry picked from commit 2ebc8d9ae51f84b0f69dee603a5448a72013f734)
# Conflicts:
# app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt
* 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.
(cherry picked from commit e4bc8990fbe2aa4bc31977f1061bac0c70d7a58f)
# Conflicts:
# app/src/main/java/eu/kanade/tachiyomi/ui/reader/loader/HttpPageLoader.kt
The underlying ZipFile is leaking. To fix, store a reference to the
ZipPageLoader and recycle it on recycle.
(cherry picked from commit 8c494f314cf77e54675f8d9742d50ed0ef94df59)
* Revert "Recreate reader settings when opening sheet (#8054)"
This reverts commit acb8ab15b2e73ba2f161eb201e93ba3a36df2867.
* Revert "Fix stacking of Settings menu in the reader on multiple taps (#8002)"
This reverts commit 30ac94181b2c410aedead964a815b080ef3e62ee.
* Fix reader settings sheet not updated
(cherry picked from commit 0861c5618c097f89bec75ffeed1359e345532d89)
This is surfaced in recents on Pixel devices for example.
Docs: https://developer.android.com/guide/app-actions/assistant-sharing
Co-authored-by: Jays2Kings <Jays2Kings@users.noreply.github.com>
(cherry picked from commit 3749cee28f269aabe5ea18ffb62483a28d0c75e7)
# Conflicts:
# app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/BrowseSourceScreen.kt
# app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt
# app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreen.kt
* Fade transition between main navigation tabs
* Shared axis X between screen stacks
Activity transition is using a "close enough" shared axis X xml animation
(cherry picked from commit 82a3a98a5ae7153d5edb2bcef7a13d7474e24e03)
# Conflicts:
# app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt
includes:
* Use coroutines in more places
* Use domain Manga data class and effectively changing the state system
* Replace deprecated onBackPress method
Co-authored-by: arkon <arkon@users.noreply.github.com>
(cherry picked from commit f7a92cf6ac58cae26b09b02578318e12cd888f4c)
# Conflicts:
# .github/renovate.json
# app/src/main/java/eu/kanade/domain/manga/model/Manga.kt
# app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt
# app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderViewModel.kt