Commit Graph

1390 Commits

Author SHA1 Message Date
arkon
3ad4f1114a Cleanup related to fetch interval display 2023-07-29 10:29:53 -04:00
Quang Kieu
cb639f4e90 Update Manga in Expected Period (#5734)
* Add Predict Interval Test

* Get mangas next update and interval in library update

* Get next update and interval in backup restore

* Display and set intervals, nextUpdate in Manga Info

* Move logic function to MangeScreen and InfoHeader

Update per suggestion

---------

Co-authored-by: arkon <arkon@users.noreply.github.com>
2023-07-28 23:10:02 -04:00
arkon
cdc1c5efa3 Better handle saving animated drawables 2023-07-26 23:26:58 -04:00
arkon
abae9bf37d Minor cleanup 2023-07-23 20:03:37 -04:00
arkon
2556e9f08c Refactor duplicate chapter number formatters 2023-07-23 18:09:08 -04:00
KaiserBh
7b2764e8f7
Refactor backup and restore to support cross device sync. (#9699)
* refactor: backup and restore to support cross device sync.

* chore: Updated string resources

* refactor: change function name.

* refactor: Use URI SyncHolder.kt not needed anymore.
2023-07-22 18:39:56 -04:00
arkon
46e3b9e40d Use previously updated track item when binding start date
Fixes #9743
2023-07-22 09:32:17 -04:00
arkon
ac306547a0 Bump dependencies 2023-07-18 19:12:04 -04:00
arkon
ef7b285151 Minor refactoring 2023-07-16 19:18:38 -04:00
arkon
818471b7e1 Set start date when tracker is bound if any chapters are already read
Closes #6734
2023-07-16 15:01:04 -04:00
arkon
01553b1ed8 Don't update chapter progress if current page is errored
Closes #5355
2023-07-16 09:11:57 -04:00
arkon
9a817e49be Set proper defaults for new table columns 2023-07-10 16:44:48 -04:00
KaiserBh
a577f5534f
Database changes to support library syncing (#9683)
* feat: added migrations.

* feat: create triggers, account for new installs.

* feat: update mappers to include the new field.

* feat: update backupManga and backupChapter.

Include the new fields to be backed up as well.

* feat: add sql query to fetch all manga with `last_favorited_at` field.

* feat: version bump.

* chore: revert and refactor.

* chore: forgot to lower case the field name.

* chore: added getAllManga query as well renamed `fetchMangaWithLastFavorite` to `getMangasWithFavoriteTimestamp`

* chore: oops that's not meant to be there.

* feat: back fill and set last_modified_at to not null.

* chore: remove redundant triggers.

* fix: build error, accidentally removed insert.

* fix: build error, accidentally removed insert.

* refactor: review pointer, make fields not null.
2023-07-10 15:52:57 -04:00
arkon
88e9fefa59 Retry LibraryUpdateJob later if Wi-Fi condition not met 2023-06-25 14:31:28 -04:00
arkon
42bc2b07ce Minor cleanup 2023-06-23 22:39:59 -04:00
Shamicen
fcfa62f220
Better handle decimal chapter numbers and add categories in ComicInfo.xml files (#9604)
* Serialize whole chapter numbers without decimal point and add library categories to genre

* added Tachiyomi specific ComicInfo Category field

* lint

* implemented requested changes
2023-06-23 17:56:01 -04:00
zaghdaneh
b36b3bfcab
Remove manga from trackers (#9535)
* Dialog for service tracker removal added, anilist query prepared

* added API delete requests for Mal and Kitsu

* implement and fix tracker delete for anilist, shikimori, mangaupdates

* implement and test mal delete request

* Update to dialog text to reflect current tracker

* finish kitsu api request and block bangumi tracker removal

* Change delete flag into interface, localise strings, clean up logs

* Add shikimori delete compatibility for already existing entries

* update track delete dialog prompt to include checkbox, update strings

* Update i18n/src/main/res/values/strings.xml

Co-authored-by: stevenyomi <95685115+stevenyomi@users.noreply.github.com>

* Update i18n/src/main/res/values/strings.xml

---------

Co-authored-by: unknown <zaghdane@fireflow.de>
Co-authored-by: arkon <arkon@users.noreply.github.com>
Co-authored-by: stevenyomi <95685115+stevenyomi@users.noreply.github.com>
2023-06-22 22:06:43 -04:00
arkon
ee95c1439f Blur manga info header image
Similar to J2K. This only applies on Android 12+.
2023-06-13 20:36:33 -04:00
arkon
1a1f16f44a Bump dependencies 2023-05-31 22:48:13 -04:00
arkon
431f8772f8 Address minor build warnings 2023-05-31 22:47:31 -04:00
arkon
8735f3566f Fix bookmarked chapters being deleted after manually marked as read
Fixes #9520
2023-05-27 18:30:59 -04:00
Two-Ai
3ae1e37c40
Replace RxJava in Downloader (#9256)
* 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.
2023-05-24 18:02:27 -04:00
Ivan Iskandar
73118d4af7
DownloadCache: Fix freezing on initial loading of cache file (#9523) 2023-05-19 22:06:06 -04:00
Two-Ai
c27bf4e866
Minor Downloader cleanup (#9511)
* Inline completeDownload

* Consolidate queueState updates in removeFromQueue

* Inline post-download steps into downloadChapter
2023-05-19 17:16:32 -04:00
arkon
fb38d30775 Avoid attempts to renaming download dirs if name hasn't actually changed
Maybe fixes #9503
2023-05-14 12:24:40 -04:00
AntsyLich
f70d5ea976
Delay automatic backup when restoring (#9492) 2023-05-12 18:02:11 -04:00
arkon
b051e37ab7 Address minor build warnings 2023-05-06 23:11:14 -04:00
Two-Ai
bbe0ab1dd0
Fix delay between URL fetch and image download (#9452)
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.
2023-05-05 22:17:51 -04:00
Two-Ai
cb2d43c0d1
Ensure final download status is always set (#9453) 2023-05-05 22:17:05 -04:00
arkon
14c465d36f Get current track services when composing LibrarySettingsDialog
Fixes #9431
2023-05-03 14:41:08 -04:00
Andreas
02864ebd60
Move GitHub Release/App Update logic to data (#9422)
* Move GitHub Release/App Update logic to data

* Add tests for GetApplicationRelease

* Review changes
2023-04-29 22:14:49 -04:00
Quang Kieu
41c89eb61d
Add interval data layer (#9398)
* Update Manga classes for fetch interval data

* Update per review

bump version

---------

Co-authored-by: quangkieu <qkieu>
2023-04-27 22:27:12 -04:00
arkon
67b4e53a58 Minor cleanup 2023-04-23 10:11:26 -04:00
Pauline
41cc1fe723
Fallback chapter name if it ends up as blank (#9220)
* 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
2023-04-22 11:11:56 -04:00
Eshlender
564a0980b9
Update track domain shikimori.me (#9333)
shikimori.me
2023-04-14 21:57:05 -04:00
arkon
75460e01c8 Remove crash log notification in favor of sharing directly 2023-04-02 15:30:22 -04:00
arkon
be54b8862e Refactor away some unnecessary lambda expressions 2023-03-26 13:27:31 -04:00
arkon
1986042277 Skip POST_NOTIFICATIONS permission check for now
Fixes #9265
2023-03-26 12:34:32 -04:00
arkon
cb4699a5bb Bump dependencies 2023-03-22 22:58:42 -04:00
arkon
ac0596a53d Revert "Always attempt to split tall images when downloading"
This partially reverts commit 2769525b2c.

Keeps the change to silently ignore spliting errors since it falls back to
the original images in those cases.
2023-03-20 08:45:36 -04:00
arkon
3cca460282 Misc cleanup 2023-03-19 22:38:14 -04:00
arkon
859601a46e Clean up WorkManager usages a bit 2023-03-19 18:19:40 -04:00
arkon
cdc160afc2 Convert BackupRestoreService to a WorkManager job
Co-authored-by: Jays2Kings <Jays2Kings@users.noreply.github.com>
2023-03-19 17:28:59 -04:00
arkon
7d8a865cac Simplify some of the notification builders 2023-03-19 16:24:37 -04:00
Andreas
dfdb688b43
Migrate things to use newer data models (#9239)
* Remove old database models from Coil

* Remove old database models from TrackInfoDialogHome

* Remove old database models from Backup Manager
2023-03-19 13:11:58 -04:00
arkon
f3ca4e76a8 Re-enable ComicInfo.xml generation on download
Closes #8537
2023-03-19 13:02:38 -04:00
arkon
2769525b2c Always attempt to split tall images when downloading 2023-03-19 12:57:16 -04:00
Ivan Iskandar
4d3e13b0d1
Initialize download index disk cache (#9179) 2023-03-16 22:18:11 -04:00
arkon
47a2d06682 Refactor tracker status string mappings
Should fix #9195
2023-03-10 23:01:10 -05:00
arkon
bebd4be43d Move more things to domain/data modules 2023-03-07 22:38:02 -05:00
arkon
ad4912803b Refactor SourceManager/StubSource to domain module 2023-03-05 12:38:31 -05:00
arkon
f96f0c5889 Move some preferences into domain module 2023-03-05 12:11:47 -05:00
Two-Ai
b41565f879
Inline DownloadQueue into Downloader (#9159)
* Move statusFlow and progressFlow to DownloadManager

* Inline DownloadQueue into Downloader

* Move reorderQueue implementation to Downloader
2023-02-28 22:13:13 -05:00
Andreas
f27dc19b37
Move Local Source to separate module (#9152)
* Move Local Source to separate module

* Review changes
2023-02-26 16:16:49 -05:00
Two-Ai
0505906e7a
Move all DownloadService.stop calls to Downloader (#9146)
Downloader.stop is now the sole responsible for stopping the
DownloadService. This will help cleanly removing
DownloadService.stop when migrating to coroutines.
2023-02-25 15:40:22 -05:00
Two-Ai
79662a5866
Misc Downloader state cleanup (#9145)
* Replace Downloader CompositeSubscription with nullable Subscription

* Derive Downloader.isRunning from subscription

Also simplify usages of isRunning

* Move DownloadNotifier.paused to Downloader.isPaused

* Remove unused DownloadNotifier.errorThrown
2023-02-25 14:43:00 -05:00
Two-Ai
86b9262a7e
Make DownloadManager the sole entry point for DownloadService (#9140)
* 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
2023-02-24 22:07:30 -05:00
Two-Ai
83a4e34095
Remove redundant Downloader isNotification argument (#9139)
DownloadQueue.clear() already sets QUEUE downloads to NOT_DOWNLOADED.
2023-02-24 15:11:51 -05:00
Two-Ai
fa61c8fe6f
Convert downloadChapter to suspend function (#9127)
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.
2023-02-21 23:02:10 -05:00
Two-Ai
779df32e98
Fix download queue page count display bug (#9126)
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.
2023-02-21 18:21:00 -05:00
arkon
93523ef50b Remove dependency injection from core module and data module from presentation-widget module
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
2023-02-20 19:02:38 -05:00
arkon
d400ac2a49 Remove unnecessary usages of NotificationManagerCompat to actually create notifications 2023-02-18 17:10:45 -05:00
arkon
f816196df2 Move more things to domain module 2023-02-18 15:14:04 -05:00
arkon
b49280e347 Remove unused Rx/Coroutines converters 2023-02-18 10:16:05 -05:00
arkon
4d607c4aed Don't apply Wi-Fi network restriction for manual library update jobs
Fixes #9074
2023-02-12 23:15:16 -05:00
arkon
42954609b9 Remove background app update check
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.
2023-02-12 22:44:39 -05:00
arkon
ab6dfe9e25 Bump dependencies
Fixes #8168, I think.
2023-02-08 22:53:42 -05:00
Ivan Iskandar
ef9dacde79
Fully utilize WorkManager for library updates (#9007)
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>
2023-02-07 22:37:20 -05:00
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
Two-Ai
aca65f13bb
Misc Service cleanup (#9005)
* 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.
2023-01-30 17:25:54 -05:00
arkon
f2c48480b6 Move some interactors to domain module 2023-01-27 22:37:17 -05:00
arkon
1730dd6af1 Move more things around 2023-01-27 22:31:12 -05:00
Andreas
2501fef9e4
Split UpdatesGridGlanceWidget into smaller bits (#8991)
- Renamed Composables
- Moved Constants to core module
2023-01-27 14:49:57 -05:00
beerpsi
c892c793a8
[BackupRestorer] Handle uncompressed backups (#8988)
[Backups] Handle uncompressed backups
2023-01-26 09:14:18 -05:00
Two-Ai
3a82b4d924
Don't crash on timeout in renewCache() (#8986)
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.
2023-01-25 18:18:17 -05:00
stevenyomi
448702e5be
OkHttp Call: split await() and awaitSuccess() (#8980) 2023-01-24 22:34:31 -05:00
Andreas
cdf242e8c8
Move more to data and domain modules (#8973) 2023-01-22 16:19:22 -05:00
Andreas
aee785a8bb
Move more implementation to data module (#8971) 2023-01-22 11:44:39 -05:00
arkon
14500ba4f8 Move more repositories to domain module 2023-01-22 10:59:52 -05:00
arkon
345e9c2a9a Move more models to domain module 2023-01-22 10:54:28 -05:00
arkon
b53e24e0db Move more models to domain module 2023-01-22 10:37:13 -05:00
Andreas
d3a73fc228
Move Category model and repository to domain and data layer (#8967)
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
2023-01-22 10:12:29 -05:00
Andreas
823749fc1e
Move SQLDelight to data module (#8954)
And use tachiyomi instead of eu.kanade.tachiyomi for package names in the module
2023-01-21 10:37:07 -05:00
beerpsi
b7e6b4c28a
[MyAnimeList] Handle cases where my_list_status.status is not present (#8931) 2023-01-16 21:59:07 -05:00
arkon
5b5eb92184 Fix checking downloads banner showing up incorrectly 2023-01-14 20:04:36 -05:00
Two-Ai
58ebf14691
Convert PageLoader.getPages to suspending function (#8917) 2023-01-14 19:45:15 -05:00
Aria Moradi
c54d77333f
Suwayomi Tracker: sync changes with Tachidesk v0.6.6 (#8902)
* Suwayomi Tracker: sync changes with Tachidesk v0.6.6

* replace var with val
2023-01-13 22:31:04 -05:00
Two-Ai
8cea78de83
Fix ChapterCache.isImageInCache() resource leak (#8907)
diskCache.get() returns a DiskLruCache.Snapshot which must be closed.
2023-01-13 22:30:26 -05:00
arkon
b6468c7e31 Only how indexing downloads banner the first time
Closes #8903
2023-01-13 18:40:59 -05:00
arkon
a2ee4e63ae Minor cleanup 2023-01-12 22:53:28 -05:00
Two-Ai
2245658363
Replace RxJava in DownloadQueueScreenModel (#8872) 2023-01-09 23:08:04 -05:00
arkon
48cab708ce Show available but not installed enhanced trackers
Closes #8859
2023-01-08 10:37:30 -05:00
Aria Moradi
c4c9931ae2
add Suwayomi tracker (#8489)
* add Suwayomi Tracker

* fix compile
2023-01-07 14:27:44 -05:00
arkon
a0f10f868e Handle file names with multiple ".cbz" occurrences properly
Fixes #8838
2023-01-05 21:59:18 -05:00
arkon
5cc84403e1 Debounce reindexing banner
Helps avoid showing it for short-lived jobs
2023-01-02 21:58:48 -05:00
arkon
01ec26842d Unify layout for new update and crash screens 2022-12-30 23:14:29 -05:00
jobobby04
611ec8103c
Handle 1000+ pages properly in the downloader (#8818) 2022-12-30 22:20:06 -05:00
Henrik
12c672667c
filter mangaupdates search (#8813) 2022-12-30 22:11:40 -05:00
Ivan Iskandar
8552838bda
Update WorkManager (#8772) 2022-12-18 12:14:06 -05:00
Ivan Iskandar
235bc77457
Fix indexing notif not showing (#8758) 2022-12-17 10:32:49 -05:00