There seems to be little value in this feature, and juggling flag masks is annoying.
Per-category sorting is still a thing, but could be refactored away from the flag in the feature.
* Replace RxJava in extension installer
Replace common downloadsRelay with Map of individual StateFlows
* Drop RxRelay dependency
* Simplify updateAllExtensions
* Simplify addDownloadState/removeDownloadState
Use immutable Map functions instead of converting to MutableMap
* Add Grace Period value and settings
* Add functions to calculate nextUpdate
* update per review
* Move more into SetMangaUpdateInterval, keep wrapper
The Dialog is handling it anyway, so this doesn't really do anything useful.
We might need to add this back if Dialog actually handles edge-to-edge properly.
* Rename removeFromQueueByPredicate to removeFromQueueIf
Follow-up to PR comment in #9511
* Make Download hashCode stable
Mutating pages would previously change the Download hashCode, which
breaks HashMap lookups.
* Convert Donwloader subscription to coroutine
Replace downloadsRelay with activeDownloadsFlow. Instead of managing
a PublishRelay independent from the queue, derive a Flow of active
downloads directly from the queue StateFlow. (This will allow
updating the queue without pausing the downloader, to be done in a
follow-up PR.)
When a download completes successfully, the downloads is removed from
queueState. This updates activeDownloadsFlow and causes the
downloaderJob start the download job for the next active download.
When a download fails, the download is left in the queue, so
queueState is not modified. To make activeDownloadsFlow update
without a change to queueState, use transformLatest and use the
Download statusFlows to suspend until a download reaches the ERROR
state.
To avoid stopping and starting downloads every time
activeDownloadsFlow emits a new value, maintain a map of current
download Jobs and only start/stop jobs in the difference between
downloadJobs and activeDownloads. To make sure all child download
jobs are cancelled when the top-level downloader job is cancelled,
use supervisorScope.
* Remove obsolete main thread references in Downloader
Thread safety of the queue state used to be guaranteed by running all
queue mutation on the main thread, but this has not been true for
some time. Since the queue state is now backed by a StateFlow,
queueState can be safely updated by any thread.
Issues:
- Apache implementation relies on methods unavailable on lower Android API levels
- Using input stream implementation doesn't seem to read some files properly, but using
ZipFile implementation still requires reading the entire thing into memory
Fetch each source image URL immediately before downloading each image
instead of fetching all URLs and then downloading all images.
Source image URLs may change, so the downloader may fail if there is
too long a delay between fetching the image URL and downloading the
image.
Closes#9255, sort of. The example is a bad edge case though, where chapter numbers are repeated across versions,
so realistically only the first 113 will appear but the later 113(s) won't despite being "different". Those realistically
should be in different manga entries, not all mixed together, so this is just a crappy source.
* Double tap zoom toggle
Implements a toggle that allows users to disable double tap zoom including QuickScaling for webtoons. Partially resolves#4145
* Update i18n/src/main/res/values/strings.xml
---------
Co-authored-by: arkon <arkon@users.noreply.github.com>
* added chapter swipe
* Rework corner animtion
* Update i18n/src/main/res/values/strings.xml
Co-authored-by: arkon <arkon@users.noreply.github.com>
* Replace LTR/RTL with Start/End layout
* Added label to the animation so the warning will go away
* Getting rid of the swipe threshold setting
* adding disabled option, renaming stuff, other stuff?
* Getting rid of the snackbar
* Getting rid of unecessary strings
* changing enum names as requested
* Renaming Raio to Ratio (I need a better keyboard as well -__-)
* Replacing error with download icon and action
* backup
* minor cleanup
* fixing an nasty edge case
* fixing mistakes in the previous conflict
* space
* fixing bug
fixed bug where the user could dismiss already dismissed item leading to item getting stuck
* fixing lint errors
* fixing lints (hopefully)
* Added "swipe disabled" to the list of actions
* Replacing string value and moving value as requested
* replacing rest of the strings with generic ones
---------
Co-authored-by: arkon <arkon@users.noreply.github.com>
* Extract downloaded archives to tmp folder when loading for viewing
* Generate sequence of entries from ZipInputStream instead of loading entire ZipFile
* change the directory's name for a download when the chapter's name is only composed of numbers or is blank
* maj in case the chapter name is blank or empty
* clean code
When restarting a download, the page count would display as 0 until
the first page download completion, after all the existing pages were
rechecked.
To fix, calculate downloadedImages from pages instead of relying on
the downloader to reset and increment the count.
(cherry picked from commit 779df32e98)
* Show soft keyboard when the text field is composed (a redo)
* Clear focus on text field when soft keyboard is hidden
* Request focus on text field and show soft keyboard
when clear button is clicked
This was effectively DDoSing sources as it does a request for every entry to get the details (primarily a cover image).
The expectation now is that users have to open individual entries to load the details/cover if needed.
This isn't necessary for most sources, which are able to provide covers as part of the listing normally.
* Drop duplicate initial call in Preference.asHotFlow
Preference.changes() always starts by returning the current value of
the preference, so asHotFlow calls block twice on the initial value.
Possible breaking change: As implemented, asHotFlow ran block(get())
before returning the flow. After this change, the first call to block
will run within the flow collection. This might cause concurrency
issues if the flow collection is late to execute.
* Inline Preference.asHotFlow
The Preference.changes().onEach().launchIn() pattern is used widely,
so the asHotFlow extension method is redundant.
This partially reverts commit 2769525b2c.
Keeps the change to silently ignore spliting errors since it falls back to
the original images in those cases.
Jetpack Compose treats mouse input differently than just mimicking a touch input, so dragging doesn't actually
invoke the pull to refresh. If that changes in the future, we could consider removing these.
Doesn't seem too necessary for the extensions list, so I skipped that.
Closes#8455
Downloader.stop is now the sole responsible for stopping the
DownloadService. This will help cleanly removing
DownloadService.stop when migrating to coroutines.
* Rename functions for DownloadService internal use
* Call DownloadService.start via DownloadManager
* Inline DownloadService.stop into pauseDownloads
* Inline DownloadService.stop into clearQueue
NotificationReceiver will now also stop the DownloadService when
receiving ACTION_CLEAR_DOWNLOADS.
* Provide DownloadService.isRunning via DownloadManager
1:1 translation from the RxJava implementation, should match the
previous behavior.
Dropped the return value from functions of the form
```
fun foo(t: T, ...): Observable<T>
```
where the Observable produced the original argument `t`.
The caller already has the result if necessary.
While this conversion is not flow-based overall, some sections use
flows to use the flatMapMerge and retryWhen operators.
Removed RetryWithDelay as it was only used here.
Inlined fetchAllImageUrlsFromPageList instead of converting it to a
suspending equivalent. fetchAllImageUrlsFromPageList is no longer
used in the app, but was not removed as it is part of source-api.
(However, it does not seem to be used exposed in extensions-lib or
used in tachiyomi-extensions.)
runBlocking is used as a temporary stop-gap.
When restarting a download, the page count would display as 0 until
the first page download completion, after all the existing pages were
rechecked.
To fix, calculate downloadedImages from pages instead of relying on
the downloader to reset and increment the count.
Includes side effects:
- No longer need to restart app for user agent string change to take effect
- parseAs extension function requires a Json instance in the calling context, which doesn't necessarily need to be the default one provided by Injekt
`it.id` is the source ID of the source being sorted.
`state.value.manga!!.id` is the manga ID of the selected manga.
`state.value.manga!!.source` is the source ID of the selected manga.
(cherry picked from commit dc2eaf0788)
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.
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.
`it.id` is the source ID of the source being sorted.
`state.value.manga!!.id` is the manga ID of the selected manga.
`state.value.manga!!.source` is the source ID of the selected manga.
* 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>
* 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()