Compare commits

...

313 Commits

Author SHA1 Message Date
a6ac2fbc9a Release v0.13.0 2022-01-31 15:32:08 -05:00
3da8677e32 Disable update/download warnings for stable release 2022-01-31 15:28:14 -05:00
4d0d7d5ad6 Weblate translations (#6494)
Co-authored-by: Ahmad Azwar Annas <ahmadazw2@gmail.com>
Co-authored-by: Ajeje Brazorf <lmelonimamo@yahoo.it>
Co-authored-by: Alessandro Jean <alessandrojean@gmail.com>
Co-authored-by: Allen Sam <allenaizen@pm.me>
Co-authored-by: DarKCroX <darkcrox.2020@outlook.com>
Co-authored-by: DatTran MLL <tranthanhdat1142003@gmail.com>
Co-authored-by: Eric <alchemillatruth@purelymail.com>
Co-authored-by: Eugene <e.shlyapkin99@gmail.com>
Co-authored-by: FateXBlood <zecrofelix@gmail.com>
Co-authored-by: Garutmaan Garuda <garutmaangaruda@gmail.com>
Co-authored-by: Giorgio Sanna <sannagiorgio1997@gmail.com>
Co-authored-by: Hosted Weblate <hosted@weblate.org>
Co-authored-by: Huang Zhiyi <hzy980512@126.com>
Co-authored-by: J. Lavoie <j.lavoie@net-c.ca>
Co-authored-by: Jendrej <ejjendrej@gmail.com>
Co-authored-by: Lyfja <yassinelaoud@gmail.com>
Co-authored-by: Lzmxya <lzmxya@gmail.com>
Co-authored-by: Matyáš Caras <contact@hernikplays.cz>
Co-authored-by: Paulo Pinho <kebrus@gmail.com>
Co-authored-by: Pitpe11 <giorgos2550@gmail.com>
Co-authored-by: Shjosan <shjosan@kakmix.co>
Co-authored-by: Swyter <swyterzone@gmail.com>
Co-authored-by: altinat <poiiiii4yy@gmail.com>
Co-authored-by: jdkdklsls dkdkdk <accshared420@gmail.com>
Co-authored-by: Роман <Rozhenkov69@gmail.com>
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/cs/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/de/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/el/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/es/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/fr/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/hi/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/hr/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/id/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/it/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/ja/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/ml/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/ms/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/ne/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/pl/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/pt/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/pt_BR/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/ru/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/sa/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/sc/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/sv/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/te/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/th/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/vi/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/zh_Hans/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/zh_Hant/
Translation: Tachiyomi/Tachiyomi 0.x

Co-authored-by: Hosted Weblate <hosted@weblate.org>
Co-authored-by: Ahmad Azwar Annas <ahmadazw2@gmail.com>
Co-authored-by: Ajeje Brazorf <lmelonimamo@yahoo.it>
Co-authored-by: Alessandro Jean <alessandrojean@gmail.com>
Co-authored-by: Allen Sam <allenaizen@pm.me>
Co-authored-by: DarKCroX <darkcrox.2020@outlook.com>
Co-authored-by: DatTran MLL <tranthanhdat1142003@gmail.com>
Co-authored-by: Eric <alchemillatruth@purelymail.com>
Co-authored-by: Eugene <e.shlyapkin99@gmail.com>
Co-authored-by: FateXBlood <zecrofelix@gmail.com>
Co-authored-by: Garutmaan Garuda <garutmaangaruda@gmail.com>
Co-authored-by: Giorgio Sanna <sannagiorgio1997@gmail.com>
Co-authored-by: Huang Zhiyi <hzy980512@126.com>
Co-authored-by: J. Lavoie <j.lavoie@net-c.ca>
Co-authored-by: Jendrej <ejjendrej@gmail.com>
Co-authored-by: Lyfja <yassinelaoud@gmail.com>
Co-authored-by: Lzmxya <lzmxya@gmail.com>
Co-authored-by: Matyáš Caras <contact@hernikplays.cz>
Co-authored-by: Paulo Pinho <kebrus@gmail.com>
Co-authored-by: Pitpe11 <giorgos2550@gmail.com>
Co-authored-by: Shjosan <shjosan@kakmix.co>
Co-authored-by: Swyter <swyterzone@gmail.com>
Co-authored-by: altinat <poiiiii4yy@gmail.com>
Co-authored-by: jdkdklsls dkdkdk <accshared420@gmail.com>
Co-authored-by: Роман <Rozhenkov69@gmail.com>
2022-01-31 15:28:05 -05:00
8c4ece4b2d Fix selection state appearance in clear database list (fixes #6526) 2022-01-31 15:01:01 -05:00
bf3bb8a378 Remove more formatting span types in SearchView (maybe fixes #6495) 2022-01-30 10:51:49 -05:00
cf5e60f8eb MangaSummaryView: Fix incomplete description on tablet ui (#6518) 2022-01-30 10:47:53 -05:00
7de707c60a Avoid invalid unset default browser (fixes #6520) 2022-01-30 10:46:46 -05:00
5cd11ad8c3 Fix bottom nav showing on resume when action mode is active (#6514) 2022-01-29 13:55:33 -05:00
6bba52a2b6 Always try to use default browser when opening custom tabs on all Android versions 2022-01-29 10:12:46 -05:00
54b476df4e [skip ci] add note about issue taking in contribution guide 2022-01-28 10:20:51 -05:00
a68f123594 TachiyomiAppBarLayout: Use insetter to handle inset (#6506)
This requires adding the status bar foreground drawing logic since the parent
class wouldn't know the inset changes anymore.
2022-01-28 10:14:13 -05:00
08ad4f96b9 Tweaked Yin & Yang theme a little (#6507) 2022-01-27 08:24:32 -05:00
77a3acf5cc Fix search inputs accepting formatted text (#6501)
* Fix Global and extension search input accepts formatted text #6495

* Code change as requested because of performance issue

* code changes as requested

* minor code changes
2022-01-26 23:37:26 -05:00
dea585e69b add extra space before error in log description (#6505)
to make it easier to read if the log reader using word wrap
2022-01-26 23:29:38 -05:00
879dacfba6 Copy source ID to clipboard when long pressing source in migrate list (closes #6479) 2022-01-26 23:00:43 -05:00
b459234ddc Try to show more relevant exception messages when failing to restore a backup 2022-01-26 22:43:27 -05:00
76d2c676fd Discard backup file if it fails to be created properly (e.g. fails validation) 2022-01-26 22:32:06 -05:00
d5015d37e1 Show error toast if empty URI is passed when trying to create/restore a backup 2022-01-26 22:31:28 -05:00
1b71e4cee7 Write job failure exceptions to error log 2022-01-26 22:21:01 -05:00
18ef5c6ff9 Update to AGP 7.1.0 2022-01-25 22:49:50 -05:00
35e0561950 Replace custom download dialog buttons with MaterialButtons 2022-01-25 08:41:15 -05:00
adab8e3ed8 Allow choosing browser apps from WebView even when extension deep links are verified in Android 12+ 2022-01-24 09:26:08 -05:00
89dbb4d300 Avoid migration failing if previous source doesn't exist 2022-01-23 17:21:23 -05:00
e3f3686b8a Allow Samsung devices on Android 12+ to use dynamic theme
Since it seems to work fine, regardless of what the Material Components library seems to dictate.
2022-01-22 14:53:12 -05:00
9984e983b4 Fix tab underline in chapter settings sheet 2022-01-22 14:43:11 -05:00
4ebe67ef53 Spacing adjustments in reader settings sheet 2022-01-22 14:39:05 -05:00
1a11d4153e Fix solid background behind text selection UI in dialogs 2022-01-22 14:38:18 -05:00
cd7cf3583e fix: handle Komga tracks during manga migration (#6463)
* fix: handle Komga tracks during manga migration

closes #6354

* refactor: remove Komga direct reference
2022-01-22 14:25:05 -05:00
66a180bc36 Add ability to open FAQ and Guide, and Changelog in extension repository (#6469) 2022-01-22 14:17:43 -05:00
eb06667455 Weblate translations (#6429)
Co-authored-by: Ahmad Azwar Annas <ahmadazw2@gmail.com>
Co-authored-by: Ajeje Brazorf <lmelonimamo@yahoo.it>
Co-authored-by: Alessandro Jean <alessandrojean@gmail.com>
Co-authored-by: Alifian Caesar <alifiancaesar@gmail.com>
Co-authored-by: Arun <arun007@pm.me>
Co-authored-by: AsyJAIZ <2007andrylavr@gmail.com>
Co-authored-by: Blue <bluestuffish@gmail.com>
Co-authored-by: Colin Tirion <grotehoed@gmail.com>
Co-authored-by: DarKCroX <darkcrox.2020@outlook.com>
Co-authored-by: DatTran MLL <tranthanhdat1142003@gmail.com>
Co-authored-by: Eric <alchemillatruth@purelymail.com>
Co-authored-by: Eugene <e.shlyapkin99@gmail.com>
Co-authored-by: FateXBlood <zecrofelix@gmail.com>
Co-authored-by: Giorgio Sanna <sannagiorgio1997@gmail.com>
Co-authored-by: Hosted Weblate <hosted@weblate.org>
Co-authored-by: Huang Zhiyi <hzy980512@126.com>
Co-authored-by: I. Musthafa <i.musthafa66@gmail.com>
Co-authored-by: J. Lavoie <j.lavoie@net-c.ca>
Co-authored-by: Jendrej <ejjendrej@gmail.com>
Co-authored-by: Jetspectre <jetspectre1@gmail.com>
Co-authored-by: Johkum <jacobomur@gmail.com>
Co-authored-by: Jozef Hollý <j2.00ghz@gmail.com>
Co-authored-by: Luiz-bro <luiznneto1@gmail.com>
Co-authored-by: Lyfja <yassinelaoud@gmail.com>
Co-authored-by: Lzmxya <lzmxya@gmail.com>
Co-authored-by: Manu <manularrosa96@mailbox.org>
Co-authored-by: Marco Santos <enum.scima@gmail.com>
Co-authored-by: Milo Ivir <mail@milotype.de>
Co-authored-by: Nabin Dhakal <nabin6707@gmail.com>
Co-authored-by: Niko Strijbol <strijbol.niko@gmail.com>
Co-authored-by: Oğuz Ersen <oguzersen@protonmail.com>
Co-authored-by: Pitpe11 <giorgos2550@gmail.com>
Co-authored-by: Rostyslav <info@ubilling.net.ua>
Co-authored-by: Sergio Gomez Damas <sergio.gomezdamas@gmail.com>
Co-authored-by: Soare Robert Daniel <soare.robert.daniel@protonmail.com>
Co-authored-by: StirCrazy <camigames252@gmail.com>
Co-authored-by: Swyter <swyterzone@gmail.com>
Co-authored-by: Unai <uesandi@gmail.com>
Co-authored-by: Yahya Kerba <yahyakerba97@gmail.com>
Co-authored-by: Zakhar Timoshenko <vp1984tanki@gmail.com>
Co-authored-by: altinat <poiiiii4yy@gmail.com>
Co-authored-by: ssantos <ssantos@web.de>
Co-authored-by: Роман <Rozhenkov69@gmail.com>
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/ar/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/ca/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/cs/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/de/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/el/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/es/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/es_419/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/eu/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/fil/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/fr/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/gl/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/hi/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/hr/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/id/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/it/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/ja/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/ms/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/ne/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/nl/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/pl/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/pt/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/pt_BR/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/ro/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/ru/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/sc/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/th/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/tr/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/uk/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/vi/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/zh_Hans/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/zh_Hant/
Translation: Tachiyomi/Tachiyomi 0.x

Co-authored-by: Hosted Weblate <hosted@weblate.org>
Co-authored-by: Ahmad Azwar Annas <ahmadazw2@gmail.com>
Co-authored-by: Ajeje Brazorf <lmelonimamo@yahoo.it>
Co-authored-by: Alessandro Jean <alessandrojean@gmail.com>
Co-authored-by: Alifian Caesar <alifiancaesar@gmail.com>
Co-authored-by: Arun <arun007@pm.me>
Co-authored-by: AsyJAIZ <2007andrylavr@gmail.com>
Co-authored-by: Blue <bluestuffish@gmail.com>
Co-authored-by: Colin Tirion <grotehoed@gmail.com>
Co-authored-by: DarKCroX <darkcrox.2020@outlook.com>
Co-authored-by: DatTran MLL <tranthanhdat1142003@gmail.com>
Co-authored-by: Eric <alchemillatruth@purelymail.com>
Co-authored-by: Eugene <e.shlyapkin99@gmail.com>
Co-authored-by: FateXBlood <zecrofelix@gmail.com>
Co-authored-by: Giorgio Sanna <sannagiorgio1997@gmail.com>
Co-authored-by: Huang Zhiyi <hzy980512@126.com>
Co-authored-by: I. Musthafa <i.musthafa66@gmail.com>
Co-authored-by: J. Lavoie <j.lavoie@net-c.ca>
Co-authored-by: Jendrej <ejjendrej@gmail.com>
Co-authored-by: Jetspectre <jetspectre1@gmail.com>
Co-authored-by: Johkum <jacobomur@gmail.com>
Co-authored-by: Luiz-bro <luiznneto1@gmail.com>
Co-authored-by: Lyfja <yassinelaoud@gmail.com>
Co-authored-by: Lzmxya <lzmxya@gmail.com>
Co-authored-by: Manu <manularrosa96@mailbox.org>
Co-authored-by: Marco Santos <enum.scima@gmail.com>
Co-authored-by: Milo Ivir <mail@milotype.de>
Co-authored-by: Nabin Dhakal <nabin6707@gmail.com>
Co-authored-by: Niko Strijbol <strijbol.niko@gmail.com>
Co-authored-by: Oğuz Ersen <oguzersen@protonmail.com>
Co-authored-by: Pitpe11 <giorgos2550@gmail.com>
Co-authored-by: Rostyslav <info@ubilling.net.ua>
Co-authored-by: Sergio Gomez Damas <sergio.gomezdamas@gmail.com>
Co-authored-by: Soare Robert Daniel <soare.robert.daniel@protonmail.com>
Co-authored-by: StirCrazy <camigames252@gmail.com>
Co-authored-by: Swyter <swyterzone@gmail.com>
Co-authored-by: Unai <uesandi@gmail.com>
Co-authored-by: Yahya Kerba <yahyakerba97@gmail.com>
Co-authored-by: Zakhar Timoshenko <vp1984tanki@gmail.com>
Co-authored-by: altinat <poiiiii4yy@gmail.com>
Co-authored-by: ssantos <ssantos@web.de>
Co-authored-by: Роман <Rozhenkov69@gmail.com>
2022-01-22 13:26:46 -05:00
0ff8966a27 Fix pages not being serializable for chapter cache (fixes #6483) 2022-01-20 17:48:25 -05:00
2cc6794db5 Revert "Update core-splashscreen (#6471)"
This reverts commit 46ec655db5.

This broke the background color in Android 12+.
2022-01-18 22:51:43 -05:00
0cb4094dd9 Update dependencies 2022-01-18 18:03:16 -05:00
edd213343b Remove some dead code 2022-01-18 17:54:17 -05:00
46ec655db5 Update core-splashscreen (#6471) 2022-01-18 17:51:14 -05:00
769efd9d06 HistoryController: Drop first search event (#6465)
Removes unnecessary data set changes when entering history screen
2022-01-14 22:25:05 -05:00
49cb3b6aa7 MangaInfo: Don't apply appbar padding on tablet ui (#6464) 2022-01-14 22:24:55 -05:00
8ad98b67d2 Change library list item title style (#6457) 2022-01-09 12:10:01 -05:00
8a8f1d3205 Update crop border shortcut state when reading mode or manga set (fixes #6441) 2022-01-09 10:53:06 -05:00
4a27f0546c Fix bottom nav being visible when resuming app (fixes #6012) 2022-01-09 10:26:51 -05:00
727a7e4b2d Change Toolbar to MaterialToolbar (#6456) 2022-01-09 09:55:16 -05:00
2b5e8241ab Fix more crashes 2022-01-08 16:23:55 -05:00
3dc4fd8dd1 Make tracker status wording/ordering more consistent 2022-01-08 15:49:39 -05:00
375a27a93d Add new manga statuses
To be exposed in extension-lib 1.3
2022-01-08 15:39:45 -05:00
544387d1a0 Avoid reader crash 2022-01-08 15:06:44 -05:00
cb8120d38f Update to Conductor 3.1.2 2022-01-08 15:01:42 -05:00
78a261f5d3 Reduce stutter when entering Browse screen (#6435)
* More coil

* ExtensionController: Drop first text change event

* Browse-Source: Remove unnecessary load

* ExtensionPresenter: Increase debounce timeout

To avoid heavy list reload during first enter animation
2022-01-08 12:55:22 -05:00
b8f7653fb2 Use material components on reader error views (#6447)
* Use material components on reader error views

* Adjust image loading behavior

Don't set automatic background color right away and keep show progress indicator
until the page image is fully loaded.
2022-01-08 12:53:20 -05:00
e0d2a01bc8 Add DoH abbreviation to preference title so it's searchable 2022-01-06 22:57:22 -05:00
560be9f553 Remove clutter in main (#6437) 2022-01-06 22:54:51 -05:00
47723042c5 Fallback to preference title if dialog title isn't set 2022-01-06 22:53:54 -05:00
d04d676d2f URL encode Kitsu search queries (fixes #5712) 2022-01-05 17:43:11 -05:00
3435636ca0 Replace use-experimental Kotlin compiler flags with opt-in 2022-01-05 17:43:11 -05:00
2e1572d7cc fix crash in ReaderActivity (#6439) 2022-01-04 21:29:14 -05:00
938339690e Custom Cloudflare failure exception to avoid user-facing "java.lang.Exception" text 2022-01-02 17:57:20 -05:00
dbb2c523c1 Avoid crashes in tracker interceptor errors 2022-01-02 17:56:49 -05:00
0b9d436753 Fix some crashes 2022-01-02 11:25:35 -05:00
2d03f3ce1e Add QuickJS dependency to eventually replace Duktape 2022-01-02 11:25:23 -05:00
c4a476d0d2 Handle renaming existing downloaded CBZ chapters on update 2022-01-01 15:22:03 -05:00
5122aed332 Weblate translations (#6352)
Co-authored-by: Ajeje Brazorf <lmelonimamo@yahoo.it>
Co-authored-by: Alessandro Jean <alessandrojean@gmail.com>
Co-authored-by: Alifian Caesar <alifiancaesar@gmail.com>
Co-authored-by: Andre Rahardjo <zertozzf@gmail.com>
Co-authored-by: Aviv Ben Ami <avivbenami@gmail.com>
Co-authored-by: DarKCroX <darkcrox.2020@outlook.com>
Co-authored-by: DatTran MLL <tranthanhdat1142003@gmail.com>
Co-authored-by: Eric <spice2wolf@gmail.com>
Co-authored-by: Flamm <robindevaux25@gmail.com>
Co-authored-by: Giorgio Sanna <sannagiorgio1997@gmail.com>
Co-authored-by: HaruSasaki <aiqusubaru@gmail.com>
Co-authored-by: Hossain Rizbi <rsajib387@gmail.com>
Co-authored-by: Hosted Weblate <hosted@weblate.org>
Co-authored-by: Huang Zhiyi <hzy980512@126.com>
Co-authored-by: Italian Translator <nekoxtranslator@etlgr.com>
Co-authored-by: J. Lavoie <j.lavoie@net-c.ca>
Co-authored-by: Jagadeesh Vijay Varma <jagadeeshvarma.b@gmail.com>
Co-authored-by: Jan Obst <macek04@volny.cz>
Co-authored-by: Jetspectre <jetspectre1@gmail.com>
Co-authored-by: Jozef Hollý <j2.00ghz@gmail.com>
Co-authored-by: KasukeLp <kasukelp23@yahoo.com>
Co-authored-by: Lyaiya <hipsnafoha@outlook.com>
Co-authored-by: Lyfja <yassinelaoud@gmail.com>
Co-authored-by: Lzmxya <lzmxya@gmail.com>
Co-authored-by: Marco Santos <enum.scima@gmail.com>
Co-authored-by: Matyáš Caras <contact@hernikplays.cz>
Co-authored-by: Milo Ivir <mail@milotype.de>
Co-authored-by: Neterskian <neterskian@gmail.com>
Co-authored-by: Nikola Perović <nikolaperovicccc@gmail.com>
Co-authored-by: Oğuz Ersen <oguzersen@protonmail.com>
Co-authored-by: Pitpe11 <giorgos2550@gmail.com>
Co-authored-by: Rikishaaa <jebote90@gmail.com>
Co-authored-by: Rostyslav <info@ubilling.net.ua>
Co-authored-by: Swyter <swyterzone@gmail.com>
Co-authored-by: Unai <uesandi@gmail.com>
Co-authored-by: Viktoria PETROVA <victoriaapetrova@gmail.com>
Co-authored-by: Zakhar Timoshenko <vp1984tanki@gmail.com>
Co-authored-by: Zero O <godarms2010@live.com>
Co-authored-by: f3rr31 <5920873@disroot.org>
Co-authored-by: stevenlele <stevenlele@126.com>
Co-authored-by: typek52 <typek52@gmail.com>
Co-authored-by: Роман <Rozhenkov69@gmail.com>
Co-authored-by: Тимур <tucirs@gmail.com>
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/bg/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/bn/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/cs/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/de/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/el/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/es/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/eu/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/fil/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/fr/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/he/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/hr/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/hu/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/id/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/it/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/ja/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/ms/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/pl/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/pt_BR/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/ru/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/sc/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/sk/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/sr/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/te/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/tr/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/uk/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/vi/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/zh_Hans/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/zh_Hant/
Translation: Tachiyomi/Tachiyomi 0.x

Co-authored-by: Hosted Weblate <hosted@weblate.org>
Co-authored-by: Ajeje Brazorf <lmelonimamo@yahoo.it>
Co-authored-by: Alessandro Jean <alessandrojean@gmail.com>
Co-authored-by: Alifian Caesar <alifiancaesar@gmail.com>
Co-authored-by: Andre Rahardjo <zertozzf@gmail.com>
Co-authored-by: Aviv Ben Ami <avivbenami@gmail.com>
Co-authored-by: DarKCroX <darkcrox.2020@outlook.com>
Co-authored-by: DatTran MLL <tranthanhdat1142003@gmail.com>
Co-authored-by: Eric <spice2wolf@gmail.com>
Co-authored-by: Flamm <robindevaux25@gmail.com>
Co-authored-by: Giorgio Sanna <sannagiorgio1997@gmail.com>
Co-authored-by: HaruSasaki <aiqusubaru@gmail.com>
Co-authored-by: Hossain Rizbi <rsajib387@gmail.com>
Co-authored-by: Huang Zhiyi <hzy980512@126.com>
Co-authored-by: Italian Translator <nekoxtranslator@etlgr.com>
Co-authored-by: J. Lavoie <j.lavoie@net-c.ca>
Co-authored-by: Jagadeesh Vijay Varma <jagadeeshvarma.b@gmail.com>
Co-authored-by: Jan Obst <macek04@volny.cz>
Co-authored-by: Jetspectre <jetspectre1@gmail.com>
Co-authored-by: KasukeLp <kasukelp23@yahoo.com>
Co-authored-by: Lyaiya <hipsnafoha@outlook.com>
Co-authored-by: Lyfja <yassinelaoud@gmail.com>
Co-authored-by: Lzmxya <lzmxya@gmail.com>
Co-authored-by: Marco Santos <enum.scima@gmail.com>
Co-authored-by: Matyáš Caras <contact@hernikplays.cz>
Co-authored-by: Milo Ivir <mail@milotype.de>
Co-authored-by: Neterskian <neterskian@gmail.com>
Co-authored-by: Nikola Perović <nikolaperovicccc@gmail.com>
Co-authored-by: Oğuz Ersen <oguzersen@protonmail.com>
Co-authored-by: Pitpe11 <giorgos2550@gmail.com>
Co-authored-by: Rikishaaa <jebote90@gmail.com>
Co-authored-by: Rostyslav <info@ubilling.net.ua>
Co-authored-by: Swyter <swyterzone@gmail.com>
Co-authored-by: Unai <uesandi@gmail.com>
Co-authored-by: Viktoria PETROVA <victoriaapetrova@gmail.com>
Co-authored-by: Zakhar Timoshenko <vp1984tanki@gmail.com>
Co-authored-by: Zero O <godarms2010@live.com>
Co-authored-by: f3rr31 <5920873@disroot.org>
Co-authored-by: stevenlele <stevenlele@126.com>
Co-authored-by: typek52 <typek52@gmail.com>
Co-authored-by: Роман <Rozhenkov69@gmail.com>
Co-authored-by: Тимур <tucirs@gmail.com>
2022-01-01 14:57:22 -05:00
5336c5b46e Add compress to CBZ on download (#6360) 2022-01-01 14:46:43 -05:00
22615f5981 Fixes descriptive notification message for errors (#6413)
* Fixes descriptive notification message for errors
Fixes #6401

* Fixes descriptive notification message for errors
Fixes #6401
2022-01-01 13:13:44 -05:00
bdf4b4b679 Add AppInfo functions to replace BuildConfig usages in extensions 2022-01-01 11:30:18 -05:00
548e300c4b Remove unused Nsfw annotation
Extensions now purely declare it through the Gradle config
2022-01-01 10:51:27 -05:00
8a5d8c96ef Remove explicit option to store downloads in app data folder
App data is typically deleted during app uninstallation, which some users are unaware of. The folder is also inaccessible externally by default in Android 11+, which is also annoying to users.
2022-01-01 10:44:27 -05:00
78c2631b6f Move preference extension functions to utils 2021-12-31 16:32:24 -05:00
7c246ffc71 Add link to troubleshooting guide in library update error log file 2021-12-31 15:16:44 -05:00
8bb85753cc Update versions and about libraries plugins 2021-12-31 14:40:12 -05:00
abfdde28ef Swallow observable errors instead of crashing 2021-12-31 13:21:32 -05:00
9801f1edfa Update analytics dependencies 2021-12-31 13:21:31 -05:00
fc3a200a63 Fix Crash while trying to search in Settings (#6397)
* Fix Crash while trying to search in Settings

* Use already provided categories
2021-12-31 13:21:05 -05:00
6a00658119 Update wording of pref_remove_after_marked_as_read (#6418) 2021-12-31 13:20:21 -05:00
353485054e Fix some crashes 2021-12-28 16:53:35 -05:00
800583b5e2 Actually Fix #6341 (#6392) 2021-12-26 15:45:29 -05:00
2db2b7348d Fix crash for bound intListPreferences 2021-12-26 15:44:34 -05:00
f3718257f5 Reduce redundancy in some preference declarations
The remaining ones could also be converted to FlowPreferences for this, but it's not really necessary.
2021-12-26 12:44:38 -05:00
5500762acd Update "Library updates restrictions" wording (#6371)
* Update "Library updates restrictions" wording

Co-Authored-By: OncePunchedMan <64155117+OncePunchedMan@users.noreply.github.com>
Co-Authored-By: nicki <72807749+curche@users.noreply.github.com>
Co-Authored-By: Soitora <simon.mattila@protonmail.com>
Co-Authored-By: FourTOne5 <59261191+FourTOne5@users.noreply.github.com>

* Update strings.xml

Co-Authored-By: loocool2 <36128021+loocool2@users.noreply.github.com>

Co-authored-by: OncePunchedMan <64155117+OncePunchedMan@users.noreply.github.com>
Co-authored-by: nicki <72807749+curche@users.noreply.github.com>
Co-authored-by: Soitora <simon.mattila@protonmail.com>
Co-authored-by: FourTOne5 <59261191+FourTOne5@users.noreply.github.com>
Co-authored-by: loocool2 <36128021+loocool2@users.noreply.github.com>
2021-12-26 11:49:27 -05:00
4c8f5e1f7a Use animation to hide/show fab (#6385) 2021-12-26 11:38:35 -05:00
733cf99bb4 Fix incorrect locale name casing in extension details (fixes #6391)
Also closing https://github.com/tachiyomiorg/tachiyomi-extensions/issues/10007 since multisource extensions aren't really a thing anymore.
2021-12-26 11:35:28 -05:00
58c2f22120 Truncate MAL search queries to first 64 characters (closes #6314)
Is it worth telling the user? ¯\_(ツ)_/¯
2021-12-26 11:35:28 -05:00
42accebeca Case insensitive sort in extension list. (#6375)
* Sort Extension irrespective of it's name's case.

* Avoid creating unnecessary strings

Co-Authored-By: arkon <arkon@users.noreply.github.com>

Co-authored-by: arkon <arkon@users.noreply.github.com>
2021-12-24 14:55:11 -05:00
1c5c370c12 Avoid unnecessary string creation when sorting 2021-12-24 10:26:24 -05:00
448645d83a Don't recompute constant device info 2021-12-24 10:25:02 -05:00
09b6a3b41e Rename night theme color files too 2021-12-24 09:55:22 -05:00
74206d60ce Rename theme color value files so they are not scattered (#6384) 2021-12-24 09:53:10 -05:00
c3a0de7fab Update dependencies 2021-12-24 09:45:56 -05:00
7edf7a434f Avoid crash on Samsung devices on Android 12
Co-authored-by: Jays2Kings <Jays2Kings@users.noreply.github.com>
2021-12-24 09:42:45 -05:00
b701821550 Handle potentially missing sources list in extensions JSON
Can happen in:
- Unofficial repos
- If the inspector breaks
2021-12-24 09:32:44 -05:00
d022bf2673 Fix Global Search ignoring incognito mode when setting last used source. (#6374) 2021-12-24 09:32:19 -05:00
7eed8c440c Fix readded chapters polluting 'Updates' tab. (#6377) 2021-12-24 09:28:48 -05:00
1ab12e380a Fix #6341 (#6383) 2021-12-24 09:28:23 -05:00
728e14e8e4 TachiyomiCoordinatorLayout: Remove app bar lift mechanism for view pager (#6379)
This is a follow up to 845e061382
...jk i actually forgot about it
2021-12-24 09:27:57 -05:00
8aa402526a Fix #6366 (#6372) 2021-12-21 09:35:00 -05:00
4793ee4786 Update some wording in Delete Chapters preference. (#6365) 2021-12-19 09:09:48 -05:00
a09d6c0470 Better Upload Date to not have a single blank upload date. (#6358) 2021-12-18 14:47:07 -05:00
9e83130bd8 Add Better Extension Search (#6359)
Add support to searching with source name, id and baseUrl for a extension's sources.
2021-12-18 14:46:45 -05:00
2ed01af723 Action toolbar adjustments (#6353)
* Pair ActionToolbar with ActionMode

This makes ActionToolbar an activity object that can be configured in the
similar way as ActionMode

* Remove action toolbar workaround now that it stays in activity layout

5924

* Set status bar color when action mode is active

6256

* Adjust fab show timing after action mode finished

* Adjust action toolbar layout and animation

Default corner size and use bottom sheet animation

6069

* Adjust action toolbar layout on large screen

Right half of the screen
2021-12-18 14:16:26 -05:00
afc80d6a7c Adjust global update preference wording and visibility 2021-12-17 14:14:48 -05:00
532a1b1aba Address some IDE warnings 2021-12-17 12:30:41 -05:00
65062b4bcb Remove library update order setting
This doesn't make sense to have if the intention is to have reasonably sized global updates. Opting to remove it to remove complexity instead.
2021-12-17 12:29:54 -05:00
c16206d816 [skip ci] update workflow actions 2021-12-17 10:47:55 -05:00
185283f864 [skip ci] fix thread locking workflow to actually be daily 2021-12-17 10:40:52 -05:00
7d1f5c7383 Hide irrelevant settings if global update isn't enabled 2021-12-17 10:14:04 -05:00
945afc71ef Refactor dependant preference visibility flows 2021-12-17 10:11:07 -05:00
818fe50f77 Combine global update item restrictions 2021-12-17 09:57:37 -05:00
6fddad7a77 Add option for library update only update completely read manga (#6323)
* Add option for library update only update completely read manga

only check manga for updates if there is no unread chapter

* sum
2021-12-17 09:40:54 -05:00
38d131be37 Workaround cleanup (#6350)
* Remove material-components workaround that was fixed upstream

* Remove unused toolbar workaround

* Fix cover dialog navigation icon
2021-12-17 09:32:42 -05:00
aeff846e1f Update dependencies 2021-12-16 23:00:04 -05:00
6b52fc1e2d Use elevated overlay on reader menu (#6347) 2021-12-16 22:57:31 -05:00
0671b530ba Update to Kotlin 1.6.10 2021-12-15 17:45:33 -05:00
207f9c26ae Add link to privacy policy 2021-12-15 17:45:33 -05:00
6367ce5e5e sfix some colors and going back to original pink-ish color (#6344) 2021-12-13 11:09:36 -05:00
ba1a2e9942 Remove Gson dependencies
All official extensions no longer use Gson and Kotson
2021-12-12 18:06:04 -05:00
7f998ecdbd Revert download notification icon changes 2021-12-12 11:14:47 -05:00
ecd5414287 Move custom brightness slider to top of filter sheet (closes #6205)
Brightness should be modified more often than the color filter. Since this will always be visible even when the sheet is half expanded, you have a better idea of its effect.
2021-12-11 14:07:18 -05:00
6107f5f3d2 Refactor backup restore process to stop relying on file extension 2021-12-11 13:53:49 -05:00
13afa9f476 Show version name in new update notification 2021-12-11 13:09:16 -05:00
cd87c7e88e Don't preselect any options in library remove manga/downloads dialog (closes #6333)
Since apparently people don't read and either option is considered destructive to different people.
2021-12-11 13:05:13 -05:00
ed4dea8686 Update notification icons
Although no recent version of Android even shows these....
2021-12-11 12:59:05 -05:00
808177f8c9 Add download action to New Chapters Notification (#6336) 2021-12-11 12:51:30 -05:00
aed51251b3 Update AGP and Gradle 2021-12-11 11:24:58 -05:00
1c2730163d Apply dialog theme to Material Alert Dialog Theme (#6340) 2021-12-11 10:16:00 -05:00
0de86dfe6f Fix back button having wrong tint in Toolbar (#6339) 2021-12-11 08:44:05 -05:00
7a1b99be46 Tweak Midnight Dusk colors (#6327)
* tweak midnight dusk colors

* more tweaking and change pure black dark mode option visibility

* revert changing pure black dark mode option visibility

* change tertiary color on light theme to match dark theme
2021-12-09 18:00:43 -05:00
9b64b0139c Check if dynamic colors are available using official API 2021-12-05 11:37:03 -05:00
0a6160d7cf Add sui support (#6318)
* Update shizuku api version

* SettingsAdvanced Controller: Verify if Sui is available
2021-12-05 11:19:37 -05:00
e51a6d332e SourcePreferencesController: Also call onBindEditText listener set by extension (#6310) 2021-12-04 10:52:52 -05:00
a9d2741e6a Automatically set tracker as completed after reading the last chapter (#6289)
* Automatically set tracker as completed after reading the last chapter.

* use integer value in comparison

* also set `started_reading` date

* don't use source manga's status

* remove useless line
2021-12-04 09:59:39 -05:00
12bd7268d2 Remove unnecessary tab style 2021-12-04 09:58:41 -05:00
be0a23d9ad Tabbed bottom sheet adjustments (#6309)
* SimpleNavigationView: Don't set background and elevation

* Add divider for tabs in bottom sheet
2021-12-04 09:57:29 -05:00
458a0e608a Apply elevation overlay to colored navbar (#6308) 2021-12-04 09:57:02 -05:00
32f3a50def Update dependencies 2021-12-02 23:09:38 -05:00
7de4226d80 [skip ci] Update gradle-command-action 2021-11-28 19:08:42 -05:00
6a39c8fc13 Avoid loading available extensions list if it seems too small 2021-11-28 18:29:22 -05:00
dc39669321 Use default snackbar styles (fixes unreadable text)
Sorry AMOLED users, you'll just have to deal with the brief light snackbars.
2021-11-28 15:30:51 -05:00
be4f27028c Throw exceptions if some of the deprecated source methods are used 2021-11-28 15:27:21 -05:00
60e73e2d1f Allow loading extension-lib 1.3
(Which doesn't actually exist yet, but will at some point after the next major release)
2021-11-28 14:55:03 -05:00
e8f284d377 Add convenience extension functions for rate limit interceptors
To be included in extension-lib 1.3 as a replacement for the lib that's currently compiled in tachiyomi-extensions.
2021-11-28 14:41:46 -05:00
3ea3b0bf2e Add UnmeteredSource interface
To be included in extension-lib 1.3 (or whatever it's going to be). This applies to sources like Komga or Lanragi, where large numbers of update/download aren't of concern since they're (usually) self-hosted.
2021-11-28 14:41:03 -05:00
e1a43d2e7d Update dependencies 2021-11-28 14:24:43 -05:00
2e918fe1d6 [skip ci] update issue-moderator-action 2021-11-27 22:33:52 -05:00
601309c7cc Weblate translations (#6179)
Co-authored-by: Ajeje Brazorf <lmelonimamo@yahoo.it>
Co-authored-by: Alessandro Jean <alessandrojean@gmail.com>
Co-authored-by: Alifian Caesar <alifiancaesar@gmail.com>
Co-authored-by: Anup Pandey <pandeyanup58@gmail.com>
Co-authored-by: Arunava Ghosh <senseiarunava@gmail.com>
Co-authored-by: Blue <bluestuffish@gmail.com>
Co-authored-by: DarKCroX <darkcrox.2020@outlook.com>
Co-authored-by: DatTran MLL <tranthanhdat1142003@gmail.com>
Co-authored-by: Eric <spice2wolf@gmail.com>
Co-authored-by: FateXBlood <zecrofelix@gmail.com>
Co-authored-by: Giorgio Sanna <sannagiorgio1997@gmail.com>
Co-authored-by: Guerilla Girl <tnfgdqzx@guerrillamail.info>
Co-authored-by: Haithem Djabi <zabiz9632@gmail.com>
Co-authored-by: HaruSasaki <aiqusubaru@gmail.com>
Co-authored-by: HeavenShadow <heavenshadow@outlook.com>
Co-authored-by: Hosted Weblate <hosted@weblate.org>
Co-authored-by: Huang Zhiyi <hzy980512@126.com>
Co-authored-by: Italian Translator <nekoxtranslator@etlgr.com>
Co-authored-by: J. Lavoie <j.lavoie@net-c.ca>
Co-authored-by: Jendrej <ejjendrej@gmail.com>
Co-authored-by: Jozef Hollý <j2.00ghz@gmail.com>
Co-authored-by: KasukeLp <kasukelp23@yahoo.com>
Co-authored-by: Lyfja <yassinelaoud@gmail.com>
Co-authored-by: Lzmxya <lzmxya@gmail.com>
Co-authored-by: Marco Santos <enum.scima@gmail.com>
Co-authored-by: Milo Ivir <mail@milotype.de>
Co-authored-by: Nepx <anandabaskara@outlook.com>
Co-authored-by: Neterskian <neterskian@gmail.com>
Co-authored-by: Oğuz Ersen <oguzersen@protonmail.com>
Co-authored-by: Pavka <pavel-mosein@yandex.ru>
Co-authored-by: Pitpe11 <giorgos2550@gmail.com>
Co-authored-by: Raven Neil Ocampo <ocamporavenneil@gmail.com>
Co-authored-by: Rostyslav <info@ubilling.net.ua>
Co-authored-by: Shjosan <shjosan@kakmix.co>
Co-authored-by: Swyter <swyterzone@gmail.com>
Co-authored-by: Tom de Groot <ikbeniemanddieheet@gmail.com>
Co-authored-by: Zakhar Timoshenko <vp1984tanki@gmail.com>
Co-authored-by: anenasa <anenasaa@yahoo.com>
Co-authored-by: pepe1987 <killyourpepe@gmail.com>
Co-authored-by: ricardofontao2000 <up201806317@fe.up.pt>
Co-authored-by: sebastians17 <sebastians117.ss@gmail.com>
Co-authored-by: swastik <smokexd676@gmail.com>
Co-authored-by: zm-dksg <zemariadekonincksg@gmail.com>
Co-authored-by: Újvári Marcell <mmarci72@gmail.com>
Co-authored-by: Роман <Rozhenkov69@gmail.com>
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/ar/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/bn/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/cs/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/de/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/el/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/es/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/es_419/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/fil/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/fr/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/hi/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/hr/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/hu/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/id/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/it/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/ja/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/ms/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/ne/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/nl/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/pl/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/pt/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/pt_BR/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/ru/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/sc/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/sr/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/sv/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/tl/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/tr/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/uk/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/vi/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/zh_Hans/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/zh_Hant/
Translation: Tachiyomi/Tachiyomi 0.x

Co-authored-by: Hosted Weblate <hosted@weblate.org>
Co-authored-by: Ajeje Brazorf <lmelonimamo@yahoo.it>
Co-authored-by: Alessandro Jean <alessandrojean@gmail.com>
Co-authored-by: Alifian Caesar <alifiancaesar@gmail.com>
Co-authored-by: Anup Pandey <pandeyanup58@gmail.com>
Co-authored-by: Arunava Ghosh <senseiarunava@gmail.com>
Co-authored-by: Blue <bluestuffish@gmail.com>
Co-authored-by: DarKCroX <darkcrox.2020@outlook.com>
Co-authored-by: DatTran MLL <tranthanhdat1142003@gmail.com>
Co-authored-by: Eric <spice2wolf@gmail.com>
Co-authored-by: FateXBlood <zecrofelix@gmail.com>
Co-authored-by: Giorgio Sanna <sannagiorgio1997@gmail.com>
Co-authored-by: Guerilla Girl <tnfgdqzx@guerrillamail.info>
Co-authored-by: Haithem Djabi <zabiz9632@gmail.com>
Co-authored-by: HaruSasaki <aiqusubaru@gmail.com>
Co-authored-by: HeavenShadow <heavenshadow@outlook.com>
Co-authored-by: Huang Zhiyi <hzy980512@126.com>
Co-authored-by: Italian Translator <nekoxtranslator@etlgr.com>
Co-authored-by: J. Lavoie <j.lavoie@net-c.ca>
Co-authored-by: Jendrej <ejjendrej@gmail.com>
Co-authored-by: KasukeLp <kasukelp23@yahoo.com>
Co-authored-by: Lyfja <yassinelaoud@gmail.com>
Co-authored-by: Lzmxya <lzmxya@gmail.com>
Co-authored-by: Marco Santos <enum.scima@gmail.com>
Co-authored-by: Milo Ivir <mail@milotype.de>
Co-authored-by: Nepx <anandabaskara@outlook.com>
Co-authored-by: Neterskian <neterskian@gmail.com>
Co-authored-by: Oğuz Ersen <oguzersen@protonmail.com>
Co-authored-by: Pavka <pavel-mosein@yandex.ru>
Co-authored-by: Pitpe11 <giorgos2550@gmail.com>
Co-authored-by: Raven Neil Ocampo <ocamporavenneil@gmail.com>
Co-authored-by: Rostyslav <info@ubilling.net.ua>
Co-authored-by: Shjosan <shjosan@kakmix.co>
Co-authored-by: Swyter <swyterzone@gmail.com>
Co-authored-by: Tom de Groot <ikbeniemanddieheet@gmail.com>
Co-authored-by: Zakhar Timoshenko <vp1984tanki@gmail.com>
Co-authored-by: anenasa <anenasaa@yahoo.com>
Co-authored-by: pepe1987 <killyourpepe@gmail.com>
Co-authored-by: ricardofontao2000 <up201806317@fe.up.pt>
Co-authored-by: sebastians17 <sebastians117.ss@gmail.com>
Co-authored-by: swastik <smokexd676@gmail.com>
Co-authored-by: zm-dksg <zemariadekonincksg@gmail.com>
Co-authored-by: Újvári Marcell <mmarci72@gmail.com>
Co-authored-by: Роман <Rozhenkov69@gmail.com>
2021-11-27 13:27:51 -05:00
10ddeeb799 Fix local source cover changing (#6252)
* fix local source cover changing

* Remove unnecessary check for `exists()`

* fix for when there is no thumbnail_url in the db
2021-11-27 12:49:26 -05:00
3463d6c752 MinMaxNumberPicker: Set IME input to use number only (#6286)
* MinMaxNumberPicker: Set IME input to use number only

* MinMaxNumberPicker: Auto disable keyboard input when needed
2021-11-27 12:48:49 -05:00
8acce011b5 fix MAL search novel filter (#6279) 2021-11-25 12:55:52 -05:00
fe9ea50356 Change Tako dark elevation overlay color (#6255) 2021-11-24 17:38:23 -05:00
e6f29ae57f Tweak Teal & Turquoise color for new M3 (#6268)
* Tweak Teal & Turquoise color for new M3

* capitalize

* tweak elevationOverlayColor

* more tweak
2021-11-24 17:38:17 -05:00
6cfd2c510b Fix crash in clear database screen (fixes #6271) 2021-11-24 17:34:39 -05:00
430ff80198 Add tertiary badge in appearance preview (closes #5867) 2021-11-19 17:39:30 -05:00
230fa76d57 Add divider under extension details header 2021-11-19 16:42:28 -05:00
46a4b0e0b6 Partially migrate LocalSource to 1.x methods 2021-11-19 16:42:19 -05:00
5b3cadb7a8 Clean up some tablet dimension values 2021-11-19 14:06:43 -05:00
3153071a8a Update to Conductor 3.1.1 2021-11-19 14:06:11 -05:00
bba7372556 Add ability to clear cookies per-extension (closes #3153) 2021-11-19 11:28:59 -05:00
9fe1a7e2ae Add feature to clear database manga by source (#6241)
* Implement feature to selectively clear manga from database based on it's source

* Code cleanup and refactoring
2021-11-19 11:24:46 -05:00
98822a39d9 Option to clear chapter cache when MainActivity is closed (closes #5651) 2021-11-19 10:50:52 -05:00
a2c830b908 Tweak app theme preference selection (closes #5866) 2021-11-19 10:35:48 -05:00
bdef2cfdfb Replace Resume FAB reveal animation with container transform (#6250) 2021-11-19 10:16:39 -05:00
f229a5e2ec Tweak relative date function (#6249)
* Tweak relative date function

* Cleanup
2021-11-19 10:05:39 -05:00
845e061382 Reinstate elevation overlay (#6243)
* Theme default elevation overlay

* Fix app bar elevation overlay

Elevation overlay is disabled when tabs are visible

* Remove custom elevation overlay in tracking sheet item

* upsi
2021-11-18 10:47:24 -05:00
e7d4eb1ae3 Rework the Library icon for the third time (#6237)
Power outtage made me lose an hour of work sadg
2021-11-18 10:44:56 -05:00
b4ba56bfb4 Update dependencies 2021-11-18 10:42:09 -05:00
25784d1fe5 Clean up ActionMode styles 2021-11-15 10:48:07 -05:00
619eca7a51 Use outlined cards in tracker search 2021-11-15 10:45:04 -05:00
f3d85655a0 Adjust manga genre chip style 2021-11-15 10:44:52 -05:00
9600675677 Adjust CardView styles 2021-11-15 10:11:47 -05:00
ce8a759192 Fix colorFilterActive in Tako theme 2021-11-15 10:11:16 -05:00
88bc0bf613 Adapt App Themes to M3 Color System (#6230)
* Adapt Default theme to M3 color system

* Adapt Dynamic theme to M3 color system

* Adapt Midnight Dusk theme to M3 color system

* Adapt Strawberry Daiquiri theme to M3 color system

* Adapt Yotsuba theme to M3 color system

* Adapt Tako theme to M3 color system

* Adapt Green Apple theme to M3 color system

* Adapt Teal & Turquoise theme to M3 color system

* Adapt Yin & Yang theme to M3 color system

* Remove old theme colors

* Yotsuba theme adjustments

Co-authored-by: ztimms73 <vp1984tanki@gmail.com>

* Green Apple theme adjustments

Co-authored-by: Soitora <10836780+Soitora@users.noreply.github.com>

* Tako theme adjustments

* Midnight Dusk theme adjustments

* Use colorSurfaceVariant for colorControlHighlight

* Nits

Co-authored-by: ztimms73 <vp1984tanki@gmail.com>
Co-authored-by: Soitora <10836780+Soitora@users.noreply.github.com>
2021-11-15 09:53:57 -05:00
b508e4208a Fix library animation lag (#6233) 2021-11-15 09:52:07 -05:00
c74d8cf499 Fix overflowed action toolbar items 2021-11-15 09:51:02 -05:00
a34c2b082f Remove outline from download queue items 2021-11-15 09:50:53 -05:00
ad49a02879 Address some Android lint warnings 2021-11-14 11:16:18 -05:00
e985ffc690 Remove custom tab indicator style
M3 TabLayout has the same style built-in.
2021-11-14 10:52:21 -05:00
6cbb02f02d Adapt M3 Typography (#6228) 2021-11-14 10:23:44 -05:00
c0d0ff66b6 Fix "Check for updates" not working due to time cooldown (#6232)
* Fix "Check for updates" not working due to time cooldown

* Update AppUpdateChecker.kt

Co-authored-by: arkon <arkon@users.noreply.github.com>
2021-11-14 10:23:12 -05:00
1e4d7f8c6e Only allow digits in custom download range dialog (closes #6220) 2021-11-13 10:14:55 -05:00
a8a761aa5f Initial pass of Material 3 styling
Adjustments/fixes to follow.
2021-11-13 10:08:01 -05:00
41952f0215 Added tabletUI option: "Automatic" (#6208)
* added automatic tablet ui option; useful for foldables

* set automatic as default, rename setting

* remove redundant checks

Co-authored-by: Ivan Iskandar <12537387+ivaniskandar@users.noreply.github.com>

* remove redundant checks

Co-authored-by: Ivan Iskandar <12537387+ivaniskandar@users.noreply.github.com>

* fix defaultValue

Co-authored-by: Ivan Iskandar <12537387+ivaniskandar@users.noreply.github.com>
2021-11-11 16:32:28 -05:00
bfcc883f01 Update dependencies 2021-11-11 16:25:45 -05:00
39722055f5 Don't auto-download chapters if excluded but no categories selected (fixes #6126) 2021-11-11 16:25:38 -05:00
f85dfa90b8 Remove legacy blue theme
Causing too many theming issues/complexity. This will make the Material 3 transition easier.
2021-11-10 09:15:13 -05:00
0a4163d236 Default to only updating non-completed manga 2021-11-10 09:09:29 -05:00
78de11a9e3 Fix SwipeRefresh initial position in MangaController (#6211)
* Lower position of swipe refresh

* Tweak existing code that sets swipe refresh position
2021-11-07 11:58:45 -05:00
d2fc6d9f44 Use sw720dp for tablet UI threshold 2021-11-07 11:55:18 -05:00
abf31f4a79 Fix cutoff ripple for extension install cancel button 2021-11-07 09:49:40 -05:00
f28dd4f4de Disable some unnecessary build features 2021-11-07 09:20:13 -05:00
55b64899f5 Update dependencies 2021-11-07 09:20:00 -05:00
d4aeeadb26 Avoid crashing when notification channels can't be created/deleted
For example, the application may be launched from a service, where channels cannot be deleted.
2021-11-07 09:11:41 -05:00
7ce0110158 Disable updates badge by default 2021-11-03 09:21:01 -04:00
7c1e55eb7f Update metadata in same scope as the rest of library update (fixes #5702, probably) 2021-11-02 17:27:25 -04:00
27542bc81d Fix crash when updating library whithout manga to update (#6181) 2021-10-31 14:25:32 -04:00
9ebbfb2d90 Clean up local source chapter name cleaning (closes #5969) 2021-10-30 18:36:23 -04:00
701b1ee744 Fix bottom nav sometimes appearing within navbar area 2021-10-30 18:03:29 -04:00
0edc981cd2 Move app and extension update notifications to new channels/group (closes #6168) 2021-10-30 17:42:06 -04:00
da5942b398 Remove unused fast scroll bubble drawable and accidentally committed file 2021-10-30 13:14:34 -04:00
709de81814 Move unread chapters badge setting to General section 2021-10-30 12:48:37 -04:00
90b312a56e Extension "Update all" button (#6171)
Disabled for legacy installer
2021-10-30 12:34:26 -04:00
459759bfe5 Add badge to bottom bar Updates tab indicating how many unread chapter updates are available (#5620)
Co-authored-by: arkon <arkon@users.noreply.github.com>
2021-10-30 12:32:51 -04:00
00817aacfe Remove translations of non-translatable strings 2021-10-30 12:25:18 -04:00
e306eb0874 Weblate translations (#6118)
Co-authored-by: Ajeje Brazorf <lmelonimamo@yahoo.it>
Co-authored-by: Alessandro Jean <alessandrojean@gmail.com>
Co-authored-by: Alifian Caesar <alifiancaesar@gmail.com>
Co-authored-by: Allan Nordhøy <epost@anotheragency.no>
Co-authored-by: Areen Anwar <areenanwar66@gmail.com>
Co-authored-by: Blue <bluestuffish@gmail.com>
Co-authored-by: DarKCroX <darkcrox.2020@outlook.com>
Co-authored-by: DatTran MLL <tranthanhdat1142003@gmail.com>
Co-authored-by: Eric <spice2wolf@gmail.com>
Co-authored-by: Giorgio Sanna <sannagiorgio1997@gmail.com>
Co-authored-by: Hautzii <am.03012002@gmail.com>
Co-authored-by: Hosted Weblate <hosted@weblate.org>
Co-authored-by: Huang Zhiyi <hzy980512@126.com>
Co-authored-by: J. Lavoie <j.lavoie@net-c.ca>
Co-authored-by: Jozef Hollý <j2.00ghz@gmail.com>
Co-authored-by: KasukeLp <kasukelp23@yahoo.com>
Co-authored-by: Lyfja <yassinelaoud@gmail.com>
Co-authored-by: Lzmxya <lzmxya@gmail.com>
Co-authored-by: Marco Santos <enum.scima@gmail.com>
Co-authored-by: Neterskian <neterskian@gmail.com>
Co-authored-by: Nin Gun <luis_noxer@hotmail.es>
Co-authored-by: Oğuz Ersen <oguzersen@protonmail.com>
Co-authored-by: Pitpe11 <giorgos2550@gmail.com>
Co-authored-by: Rafi <ziomeq65@gmail.com>
Co-authored-by: Resshi <jyxo@centrum.cz>
Co-authored-by: Shjosan <shjosan@kakmix.co>
Co-authored-by: Soitora <simon.mattila@protonmail.com>
Co-authored-by: Swyter <swyterzone@gmail.com>
Co-authored-by: jTnqr <juliuspanjul25@gmail.com>
Co-authored-by: monolifed <monolifed@protonmail.com>
Co-authored-by: sebastians17 <sebastians117.ss@gmail.com>
Co-authored-by: Роман <Rozhenkov69@gmail.com>
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/cs/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/de/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/el/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/es/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/es_419/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/fil/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/fr/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/id/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/it/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/ja/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/ms/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/nb_NO/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/nl/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/pl/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/pt_BR/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/ru/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/sc/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/sdh/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/sr/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/sv/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/tr/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/vi/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/zh_Hans/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/zh_Hant/
Translation: Tachiyomi/Tachiyomi 0.x

Co-authored-by: Hosted Weblate <hosted@weblate.org>
Co-authored-by: Ajeje Brazorf <lmelonimamo@yahoo.it>
Co-authored-by: Alessandro Jean <alessandrojean@gmail.com>
Co-authored-by: Alifian Caesar <alifiancaesar@gmail.com>
Co-authored-by: Allan Nordhøy <epost@anotheragency.no>
Co-authored-by: Areen Anwar <areenanwar66@gmail.com>
Co-authored-by: Blue <bluestuffish@gmail.com>
Co-authored-by: DarKCroX <darkcrox.2020@outlook.com>
Co-authored-by: DatTran MLL <tranthanhdat1142003@gmail.com>
Co-authored-by: Eric <spice2wolf@gmail.com>
Co-authored-by: Giorgio Sanna <sannagiorgio1997@gmail.com>
Co-authored-by: Hautzii <am.03012002@gmail.com>
Co-authored-by: Huang Zhiyi <hzy980512@126.com>
Co-authored-by: J. Lavoie <j.lavoie@net-c.ca>
Co-authored-by: KasukeLp <kasukelp23@yahoo.com>
Co-authored-by: Lyfja <yassinelaoud@gmail.com>
Co-authored-by: Lzmxya <lzmxya@gmail.com>
Co-authored-by: Marco Santos <enum.scima@gmail.com>
Co-authored-by: Neterskian <neterskian@gmail.com>
Co-authored-by: Nin Gun <luis_noxer@hotmail.es>
Co-authored-by: Oğuz Ersen <oguzersen@protonmail.com>
Co-authored-by: Pitpe11 <giorgos2550@gmail.com>
Co-authored-by: Rafi <ziomeq65@gmail.com>
Co-authored-by: Resshi <jyxo@centrum.cz>
Co-authored-by: Shjosan <shjosan@kakmix.co>
Co-authored-by: Soitora <simon.mattila@protonmail.com>
Co-authored-by: Swyter <swyterzone@gmail.com>
Co-authored-by: jTnqr <juliuspanjul25@gmail.com>
Co-authored-by: monolifed <monolifed@protonmail.com>
Co-authored-by: sebastians17 <sebastians117.ss@gmail.com>
Co-authored-by: Роман <Rozhenkov69@gmail.com>
2021-10-30 12:22:17 -04:00
33a02b47d5 Hide cutout toggle button if fullscreen is off (#6150) 2021-10-30 12:19:15 -04:00
f0a5557e60 Fix storing covers for local manga (#6127)
getCoverFile only returns a cover if it already exists, meaning
the block of code to write it from the inputstream never executes.
If getCoverFile returns null, then use previous behaviour of setting
it to cover.jpg so that if the file doesn't exist it's created
2021-10-30 12:16:29 -04:00
58a871c8cc Allow manga titles to update from source if they are not in library (#6177)
The previous rationale for not allowing manga titles to update (at all) was that it would be confusing for users if a manga's title arbitrarily changed when the source changed it. Presumably, users would care less about this arbitrary change for manga that is not in library, so this provides a path for getting a manga's title updated, and prevents incorrect titles from persisting in the DB for manga that get title updates but aren't in library.
2021-10-30 12:15:48 -04:00
4f56071786 Validate backup during creation 2021-10-28 22:40:53 -04:00
f8b2c79aef Update dependencies 2021-10-28 22:40:53 -04:00
8f00d34b0b Change zoom from 3x to 5x (#6164)
Because some people actually read images with really small text

*I hope they have some extreme high quality pictures else I don't know how they read the raster images*
2021-10-27 23:33:36 -04:00
6129519e5a More sensical string for 'pref_hide_threshold' (#6157) 2021-10-24 10:21:13 -04:00
593091a5e3 Sync view state with controller on activity resume
Hopefully fixes some weird states where the bottom nav shows up when it shouldn't.
2021-10-23 17:30:56 -04:00
22ed163c8f Fix what's new link in dialog 2021-10-23 17:29:27 -04:00
93e2b88d41 Minor cleanup 2021-10-23 17:29:13 -04:00
7cd54dc8f0 Launch the download warning toast in the UI thread
Co-authored-by: jobobby04 <jobobby04@users.noreply.github.com>
2021-10-23 17:05:34 -04:00
ccd7c8df53 Fix double increment when updating covers (#6138)
* Fix double increment when updating covers

* Remove redundant block
2021-10-20 20:10:55 -04:00
5b3bd3f470 Remove jcenter usage (closes #4387) 2021-10-18 12:39:41 -04:00
bf1b7f44b6 Change tablet UI threshold to w720dp (closes #6054)
Was previously sw720dp. Now matches J2K.
2021-10-18 11:03:27 -04:00
538dd60580 Adjust update/download warnings
- Uses toasts now
- Adjusted wording to emphasize effect on sources
- Download warning has a different threshold (15 chapters per source, vs. 60 entries per source for library update)
2021-10-18 10:46:07 -04:00
f453236840 [6068] - Use semibold text for Browse items primary text (#6087)
* Changing the text on source title (browse items) to semibold and fixing the color of the subtitle on global search

* Updated history_item, updates_item and global_search to not have bold titles

* Changing global_search_controller_card

* Changing back history_item
2021-10-18 10:05:54 -04:00
bfe7aa1ed2 Minor cleanup 2021-10-18 10:02:25 -04:00
9e2ef82902 Remove global update intervals below 12 hours, add every 3 day interval
Users with smaller libraries have a lower change of getting updates frequently. "Power users" are actively hurting sources by updating frequently.
2021-10-18 10:02:18 -04:00
9352e249ee Make tapping library update and backup restore error notifications open log 2021-10-18 09:58:35 -04:00
3800065230 Fix crashing when clicking the search icon (#6128) 2021-10-18 09:57:52 -04:00
ebc2c4f73a Remove paused text when resuming downloads with info hidden (fixes #6119) 2021-10-16 17:40:56 -04:00
f057440cc1 Use natural ordering when sorting by chapter numbers (fixes #6121) 2021-10-16 17:37:51 -04:00
506f9cfca8 Weblate translations (#6047)
Co-authored-by: Ajeje Brazorf <lmelonimamo@yahoo.it>
Co-authored-by: Alessandro Jean <alessandrojean@gmail.com>
Co-authored-by: Allan Nordhøy <epost@anotheragency.no>
Co-authored-by: Archie <careless.archie@gmail.com>
Co-authored-by: DarKCroX <darkcrox.2020@outlook.com>
Co-authored-by: DatTran MLL <tranthanhdat1142003@gmail.com>
Co-authored-by: Eric <spice2wolf@gmail.com>
Co-authored-by: Forqen <krecio555@gmail.com>
Co-authored-by: Giorgio Sanna <sannagiorgio1997@gmail.com>
Co-authored-by: Hosted Weblate <hosted@weblate.org>
Co-authored-by: Huang Zhiyi <hzy980512@126.com>
Co-authored-by: J. Lavoie <j.lavoie@net-c.ca>
Co-authored-by: Jendrej <ejjendrej@gmail.com>
Co-authored-by: Jetspectre <jetspectre1@gmail.com>
Co-authored-by: Jozef Hollý <j2.00ghz@gmail.com>
Co-authored-by: KasukeLp <kasukelp23@yahoo.com>
Co-authored-by: Lyfja <yassinelaoud@gmail.com>
Co-authored-by: Lzmxya <lzmxya@gmail.com>
Co-authored-by: Marco Santos <enum.scima@gmail.com>
Co-authored-by: Matey Krastev <matey_krastev2@abv.bg>
Co-authored-by: Pedro <pedro-mediavilla@hotmail.com>
Co-authored-by: Pitpe11 <giorgos2550@gmail.com>
Co-authored-by: Ric <rikku.debec@gmail.com>
Co-authored-by: Rostyslav <info@ubilling.net.ua>
Co-authored-by: Shippo <shiposhouyou@gmail.com>
Co-authored-by: Shjosan <shjosan@kakmix.co>
Co-authored-by: Swyter <swyterzone@gmail.com>
Co-authored-by: jTnqr <juliuspanjul25@gmail.com>
Co-authored-by: monolifed <monolifed@protonmail.com>
Co-authored-by: swastik <smokexd676@gmail.com>
Co-authored-by: turhv jbufv <turhvjbufv@gmail.com>
Co-authored-by: Роман <Rozhenkov69@gmail.com>
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/ar/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/bg/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/cs/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/de/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/el/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/es/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/es_419/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/fil/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/fr/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/he/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/hi/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/id/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/it/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/ja/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/ms/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/nb_NO/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/pl/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/pt_BR/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/ru/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/sc/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/sv/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/tr/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/uk/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/vi/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/zh_Hans/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/zh_Hant/
Translation: Tachiyomi/Tachiyomi 0.x

Co-authored-by: Hosted Weblate <hosted@weblate.org>
Co-authored-by: Ajeje Brazorf <lmelonimamo@yahoo.it>
Co-authored-by: Alessandro Jean <alessandrojean@gmail.com>
Co-authored-by: Allan Nordhøy <epost@anotheragency.no>
Co-authored-by: Archie <careless.archie@gmail.com>
Co-authored-by: DarKCroX <darkcrox.2020@outlook.com>
Co-authored-by: DatTran MLL <tranthanhdat1142003@gmail.com>
Co-authored-by: Eric <spice2wolf@gmail.com>
Co-authored-by: Forqen <krecio555@gmail.com>
Co-authored-by: Giorgio Sanna <sannagiorgio1997@gmail.com>
Co-authored-by: Huang Zhiyi <hzy980512@126.com>
Co-authored-by: J. Lavoie <j.lavoie@net-c.ca>
Co-authored-by: Jendrej <ejjendrej@gmail.com>
Co-authored-by: Jetspectre <jetspectre1@gmail.com>
Co-authored-by: KasukeLp <kasukelp23@yahoo.com>
Co-authored-by: Lyfja <yassinelaoud@gmail.com>
Co-authored-by: Lzmxya <lzmxya@gmail.com>
Co-authored-by: Marco Santos <enum.scima@gmail.com>
Co-authored-by: Matey Krastev <matey_krastev2@abv.bg>
Co-authored-by: Pedro <pedro-mediavilla@hotmail.com>
Co-authored-by: Pitpe11 <giorgos2550@gmail.com>
Co-authored-by: Ric <rikku.debec@gmail.com>
Co-authored-by: Rostyslav <info@ubilling.net.ua>
Co-authored-by: Shippo <shiposhouyou@gmail.com>
Co-authored-by: Shjosan <shjosan@kakmix.co>
Co-authored-by: Swyter <swyterzone@gmail.com>
Co-authored-by: jTnqr <juliuspanjul25@gmail.com>
Co-authored-by: monolifed <monolifed@protonmail.com>
Co-authored-by: swastik <smokexd676@gmail.com>
Co-authored-by: turhv jbufv <turhvjbufv@gmail.com>
Co-authored-by: Роман <Rozhenkov69@gmail.com>
2021-10-16 12:05:39 -04:00
8a70c3353f Change global update unmetered connection restriction to connected to Wi-Fi (closes #6117) 2021-10-16 11:10:05 -04:00
3d8f123e05 Add notification action to open GitHub release page
Co-authored-by: Jays2Kings <Jays2Kings@users.noreply.github.com>
2021-10-16 10:42:14 -04:00
a8c8f15e07 Update dependencies 2021-10-16 10:21:25 -04:00
21e647017b Rename app updating classes
So I stop confusing it for updaters of other things.
2021-10-16 10:21:15 -04:00
2a1bb3dc27 Fix reappearing indicator in the History tab (#6105) 2021-10-15 22:14:45 -04:00
55a3094a65 Fix AppBar lift state when snapped (#6103)
status bar foreground alpha is now handled separately
2021-10-15 22:09:19 -04:00
b4490e209b Fix inset not applying when in landscape (#6104)
Reverts inset change from #5997, was changed due to it not changing the padding when using setPadding
2021-10-15 22:08:37 -04:00
9aa676333c Use default source filters in global search (fixes #5583)
Based on 45fbd9d2f5
2021-10-15 22:06:16 -04:00
71b23e57ff [skip ci] Avoid building PRs that only affect Markdown docs or string translations 2021-10-13 09:29:07 -04:00
2c76bc99fc Add ability to copy a genre/tag to clipboard by long-pressing it's chip (#6084)
* Allow copying a genre by long-pressing it's chip

* Make chip click listeners nullable, and only attach if not-null
2021-10-13 09:23:59 -04:00
bb06895145 Fix MangaController fast scroller position (#6090) 2021-10-13 09:23:46 -04:00
684965f3e5 MangaController optimizations (#6089)
* MangaController: Fix ignored stable ids

* MangaController: Replace notifyDataSetChanged

* ChaptersSettingsSheet: Optimizations
2021-10-13 09:23:38 -04:00
e621f4e2fa Add migration to add "all" to enabled langauges
Co-authored-by: Jays2Kings <Jays2Kings@users.noreply.github.com>
2021-10-13 09:18:43 -04:00
028ea57232 Update missing chapters warning
Co-authored-by: Jays2Kings <Jays2Kings@users.noreply.github.com>
2021-10-13 09:17:26 -04:00
718fa25c10 Bump queue warning threshold to 60
Aligns with J2K.
2021-10-13 09:16:19 -04:00
90c9f28818 Update AGP 2021-10-13 09:15:46 -04:00
cb9c5a35cb Minor cleanup 2021-10-13 09:13:38 -04:00
fadaefeaef Handle HTTP 403 responses with CloudflareInterceptor
Based on 8d34da591e

Co-authored-by: jmir1 <jmir1@users.noreply.github.com>
2021-10-11 16:12:26 -04:00
b17b882a3b Adjust update/download warning threshold 2021-10-11 16:08:32 -04:00
f0f3afd5f1 Fix issues with NSFW sources setting (#6085) 2021-10-11 13:51:20 -04:00
42026b49bf Allow hiding "All" section in extensions list (closes #6081) 2021-10-11 10:29:08 -04:00
151193c4c3 Reword missing chapters warning (closes #6074) 2021-10-11 10:22:31 -04:00
3448751e0e Fix crash when deleting last item in library (#6079) 2021-10-11 10:17:01 -04:00
aae011ed83 Use SwitchMaterial for preferences too (closes #5724) 2021-10-09 17:47:04 -04:00
c95a269460 Use single layout for grid badges 2021-10-09 17:26:53 -04:00
98c0e5271f Reword badge titles 2021-10-09 17:16:01 -04:00
f343131802 Require authentication to toggle showing NSFW sources 2021-10-09 17:10:04 -04:00
ea34ba53b9 Allow searching for multiple extensions at once (closes #5922) 2021-10-09 16:59:18 -04:00
b8d8cf19d9 Add some info about automatic backups 2021-10-09 16:48:20 -04:00
c9be4093e7 Smaller font size for reader page indicator (closes #6071) 2021-10-09 16:48:02 -04:00
082eef708f Add warnings when library and download queues are considered large (closes #5950)
Arbitrarily set at a size of 100 for now. We could adjust this in the future as appropriate if needed.
2021-10-09 14:55:21 -04:00
9106fc5b94 Grouped chapter download list by source (#5575) 2021-10-09 11:41:45 -04:00
918502742d [5893] - Implemented Language Badge (#6050)
* Implemented language badge on library items

* Added left margin for better viewing the badge on list view

* Adjusting borders on badges, cleaning string interpolation and cleaning code

* Improving readability on Holders and removing unused background and text on grid items
2021-10-09 11:10:36 -04:00
f32f1eeaa5 Manga description adjustments (#6011)
* Manga description adjustments

- Animated state changes
- Adjust scrim position to fully show 2 lines when shrunk
- Set minLines to avoid scrim hiding oneliner

* Change icon and adjust animation

* Revert fancy scrim animation
2021-10-09 11:02:45 -04:00
2d1404d155 Fix Local and Other lang sources showing up in seperate Other Categories (#6024)
* group LocalSource and Other lang source together

* use better kotlin syntactic sugar

* add lang "other" to local

* remove duplicate LocalSource entries in Browse

* linting

* revert unnecessary linting

was a manually adding change

* Revert previous two commit but not the most recent

This reverts commit 30250f2f82fc5e38a1b30c7b55c445efec23a114
This also reversts commit 359ed5a8cda91577216b593a4138280e971e0126

* better way to avoid duplicate Local Sources

* more linting by plugin

* `""` lang is no longer used anywhere
2021-10-09 11:01:22 -04:00
a56997e98c Hide slider tooltip label everywhere 2021-10-09 10:44:08 -04:00
ef918078d1 Update dependencies 2021-10-09 10:40:30 -04:00
7e61900cf5 Add new build type for weekly preview (#6067)
This adds new build type for minified non-debuggable preview builds.
"debugFull" is removed and "debug" will be unminified.

**It means preview build action needs to be updated to build "standardPreview"**
2021-10-09 10:28:43 -04:00
e98f90b099 [6059] - Pending downloads count on Download queue screen (#6064)
* Updating the download queue label to account for pending downloads even on paused state

* changing separator

* Created observer to update the TitleBar of the controller to reflect pending downloads

* Reverting changes from MoreController that were made in an another commit

* Refactoring updateTitle method
2021-10-07 22:13:35 -04:00
2e127dff1f Replace Timber with Square Logcat and make logging configurable (#6062)
* Replace Timber with Square Logcat

* Configurable logger
2021-10-07 22:12:55 -04:00
828db19e02 [5753] - Add pending downloads count on Download queue (#6049)
* Updating the download queue label to account for pending downloads even on paused state

* changing separator
2021-10-06 22:03:07 -04:00
99aa3f5713 Weblate translations (#6046)
Co-authored-by: AHmed HarBy <themagic1093@gmail.com>
Co-authored-by: Afiq Nazrie <afnazrie@gmail.com>
Co-authored-by: Ainārs Lapkovskis <ainarslapkovskis@gmail.com>
Co-authored-by: Ajeje Brazorf <lmelonimamo@yahoo.it>
Co-authored-by: Albedo <Illiator27@gmail.com>
Co-authored-by: Alessandro Jean <alessandrojean@gmail.com>
Co-authored-by: Alifian Caesar <alifiancaesar@gmail.com>
Co-authored-by: Allan Nordhøy <epost@anotheragency.no>
Co-authored-by: Blue <bluestuffish@gmail.com>
Co-authored-by: Christian Elbrianno <christian.elbrianno41@gmail.com>
Co-authored-by: DarKCroX <darkcrox.2020@outlook.com>
Co-authored-by: Druvvaldis <druvvaldisr@gmail.com>
Co-authored-by: Emerson Nunes <emerson.nunes.ds@gmail.com>
Co-authored-by: Emma Jane Bonestell <EmmaJaneBonestell@gmail.com>
Co-authored-by: Eric <spice2wolf@gmail.com>
Co-authored-by: Fernando Sanchez <cheeze.sprinkels@gmail.com>
Co-authored-by: Forqen <krecio555@gmail.com>
Co-authored-by: Francesco Zanella <franzghosts@gmail.com>
Co-authored-by: Giorgio Sanna <sannagiorgio1997@gmail.com>
Co-authored-by: Hassay Ádám Tamás <hassayadam@gmail.com>
Co-authored-by: Hosted Weblate <hosted@weblate.org>
Co-authored-by: Huang Zhiyi <hzy980512@126.com>
Co-authored-by: J. Lavoie <j.lavoie@net-c.ca>
Co-authored-by: Jakub Fabijan <jakubfabijan@tuta.io>
Co-authored-by: Junan Chk <junanchakma2000@gmail.com>
Co-authored-by: K. Sz. Bence <tudi20@protonmail.com>
Co-authored-by: Kaleb <kalebcarvalho1@gmail.com>
Co-authored-by: Krishna Chand <krishna_chand67@naver.com>
Co-authored-by: LoneHash <sameepsk2@gmail.com>
Co-authored-by: Luna Jernberg <droidbittin@gmail.com>
Co-authored-by: Lyfja <yassinelaoud@gmail.com>
Co-authored-by: Lzmxya <lzmxya@gmail.com>
Co-authored-by: Marco Santos <enum.scima@gmail.com>
Co-authored-by: Matyáš Caras <contact@hernikplays.cz>
Co-authored-by: Miguel Alexandro Manzano Guerra <kuro_eis@hotmail.com>
Co-authored-by: Milo Ivir <mail@milotype.de>
Co-authored-by: Nishant Bodkhe <nishantbodkhe44@gmail.com>
Co-authored-by: Oğuz Ersen <oguzersen@protonmail.com>
Co-authored-by: Pedro <pedro-mediavilla@hotmail.com>
Co-authored-by: Pitpe11 <giorgos2550@gmail.com>
Co-authored-by: Redy Apriyadi <redy.apriyadi@gmail.com>
Co-authored-by: Ric <rikku.debec@gmail.com>
Co-authored-by: Shjosan <shjosan@kakmix.co>
Co-authored-by: Sieg Jaeger <zekerett@gmail.com>
Co-authored-by: Steven Pedroza <stevenpedroza56@gmail.com>
Co-authored-by: Temporary Person <TemporaryPerson@protonmail.com>
Co-authored-by: Zero O <godarms2010@live.com>
Co-authored-by: ZiomaleQ <r.partyka30@gmail.com>
Co-authored-by: crackheadakira <lasn.mine@gmail.com>
Co-authored-by: dmswd <Bmswad1@gmail.com>
Co-authored-by: julptk <julptk8@gmail.com>
Co-authored-by: monolifed <monolifed@protonmail.com>
Co-authored-by: phannhanhn201 <phannhanhn201@gmail.com>
Co-authored-by: rytis sertvytis <knysliukas2002@gmail.com>
Co-authored-by: soplatnik <jestapom@protonmail.com>
Co-authored-by: Роман <Rozhenkov69@gmail.com>
Co-authored-by: พรหมชัย ชูแสง <promchai2sin@gmail.com>
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/aii/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/ar/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/bn/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/cs/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/de/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/el/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/eo/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/es/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/es_419/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/fil/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/fr/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/hi/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/hr/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/hu/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/id/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/it/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/ja/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/jv/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/lt/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/lv/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/mr/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/ms/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/nb_NO/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/ne/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/nl/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/pl/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/pt/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/pt_BR/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/ru/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/sc/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/sv/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/th/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/tr/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/vi/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/zh_Hans/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/zh_Hant/
Translation: Tachiyomi/Tachiyomi 0.x

Co-authored-by: Hosted Weblate <hosted@weblate.org>
Co-authored-by: AHmed HarBy <themagic1093@gmail.com>
Co-authored-by: Afiq Nazrie <afnazrie@gmail.com>
Co-authored-by: Ainārs Lapkovskis <ainarslapkovskis@gmail.com>
Co-authored-by: Ajeje Brazorf <lmelonimamo@yahoo.it>
Co-authored-by: Albedo <Illiator27@gmail.com>
Co-authored-by: Alessandro Jean <alessandrojean@gmail.com>
Co-authored-by: Alifian Caesar <alifiancaesar@gmail.com>
Co-authored-by: Allan Nordhøy <epost@anotheragency.no>
Co-authored-by: Blue <bluestuffish@gmail.com>
Co-authored-by: Christian Elbrianno <christian.elbrianno41@gmail.com>
Co-authored-by: DarKCroX <darkcrox.2020@outlook.com>
Co-authored-by: Druvvaldis <druvvaldisr@gmail.com>
Co-authored-by: Emerson Nunes <emerson.nunes.ds@gmail.com>
Co-authored-by: Emma Jane Bonestell <EmmaJaneBonestell@gmail.com>
Co-authored-by: Eric <spice2wolf@gmail.com>
Co-authored-by: Fernando Sanchez <cheeze.sprinkels@gmail.com>
Co-authored-by: Forqen <krecio555@gmail.com>
Co-authored-by: Francesco Zanella <franzghosts@gmail.com>
Co-authored-by: Giorgio Sanna <sannagiorgio1997@gmail.com>
Co-authored-by: Hassay Ádám Tamás <hassayadam@gmail.com>
Co-authored-by: Huang Zhiyi <hzy980512@126.com>
Co-authored-by: J. Lavoie <j.lavoie@net-c.ca>
Co-authored-by: Jakub Fabijan <jakubfabijan@tuta.io>
Co-authored-by: Junan Chk <junanchakma2000@gmail.com>
Co-authored-by: K. Sz. Bence <tudi20@protonmail.com>
Co-authored-by: Kaleb <kalebcarvalho1@gmail.com>
Co-authored-by: Krishna Chand <krishna_chand67@naver.com>
Co-authored-by: LoneHash <sameepsk2@gmail.com>
Co-authored-by: Luna Jernberg <droidbittin@gmail.com>
Co-authored-by: Lyfja <yassinelaoud@gmail.com>
Co-authored-by: Lzmxya <lzmxya@gmail.com>
Co-authored-by: Marco Santos <enum.scima@gmail.com>
Co-authored-by: Matyáš Caras <contact@hernikplays.cz>
Co-authored-by: Miguel Alexandro Manzano Guerra <kuro_eis@hotmail.com>
Co-authored-by: Milo Ivir <mail@milotype.de>
Co-authored-by: Nishant Bodkhe <nishantbodkhe44@gmail.com>
Co-authored-by: Oğuz Ersen <oguzersen@protonmail.com>
Co-authored-by: Pedro <pedro-mediavilla@hotmail.com>
Co-authored-by: Pitpe11 <giorgos2550@gmail.com>
Co-authored-by: Redy Apriyadi <redy.apriyadi@gmail.com>
Co-authored-by: Ric <rikku.debec@gmail.com>
Co-authored-by: Shjosan <shjosan@kakmix.co>
Co-authored-by: Sieg Jaeger <zekerett@gmail.com>
Co-authored-by: Steven Pedroza <stevenpedroza56@gmail.com>
Co-authored-by: Temporary Person <TemporaryPerson@protonmail.com>
Co-authored-by: Zero O <godarms2010@live.com>
Co-authored-by: ZiomaleQ <r.partyka30@gmail.com>
Co-authored-by: crackheadakira <lasn.mine@gmail.com>
Co-authored-by: dmswd <Bmswad1@gmail.com>
Co-authored-by: julptk <julptk8@gmail.com>
Co-authored-by: monolifed <monolifed@protonmail.com>
Co-authored-by: phannhanhn201 <phannhanhn201@gmail.com>
Co-authored-by: rytis sertvytis <knysliukas2002@gmail.com>
Co-authored-by: soplatnik <jestapom@protonmail.com>
Co-authored-by: Роман <Rozhenkov69@gmail.com>
Co-authored-by: พรหมชัย ชูแสง <promchai2sin@gmail.com>
2021-10-05 11:09:05 -04:00
1a568e2961 Fix stuck display mode for when not using per category setting (#6044) 2021-10-05 11:03:51 -04:00
e863e8c64b Adjust Wi-Fi connection check (related to #6038) 2021-10-04 17:06:24 -04:00
f5b591430c Release v0.12.3 2021-10-04 15:55:06 -04:00
8cfaf8eb51 Weblate translations (#5913)
Co-authored-by: AHmed HarBy <themagic1093@gmail.com>
Co-authored-by: Ainārs Lapkovskis <ainarslapkovskis@gmail.com>
Co-authored-by: Ajeje Brazorf <lmelonimamo@yahoo.it>
Co-authored-by: Albedo <Illiator27@gmail.com>
Co-authored-by: Alessandro Jean <alessandrojean@gmail.com>
Co-authored-by: Alifian Caesar <alifiancaesar@gmail.com>
Co-authored-by: Allan Nordhøy <epost@anotheragency.no>
Co-authored-by: Blue <bluestuffish@gmail.com>
Co-authored-by: Christian Elbrianno <christian.elbrianno41@gmail.com>
Co-authored-by: DarKCroX <darkcrox.2020@outlook.com>
Co-authored-by: Druvvaldis <druvvaldisr@gmail.com>
Co-authored-by: Emerson Nunes <emerson.nunes.ds@gmail.com>
Co-authored-by: Emma Jane Bonestell <EmmaJaneBonestell@gmail.com>
Co-authored-by: Eric <spice2wolf@gmail.com>
Co-authored-by: Fernando Sanchez <cheeze.sprinkels@gmail.com>
Co-authored-by: Forqen <krecio555@gmail.com>
Co-authored-by: Francesco Zanella <franzghosts@gmail.com>
Co-authored-by: Giorgio Sanna <sannagiorgio1997@gmail.com>
Co-authored-by: Hassay Ádám Tamás <hassayadam@gmail.com>
Co-authored-by: Hosted Weblate <hosted@weblate.org>
Co-authored-by: Huang Zhiyi <hzy980512@126.com>
Co-authored-by: J. Lavoie <j.lavoie@net-c.ca>
Co-authored-by: Jakub Fabijan <jakubfabijan@tuta.io>
Co-authored-by: Junan Chk <junanchakma2000@gmail.com>
Co-authored-by: K. Sz. Bence <tudi20@protonmail.com>
Co-authored-by: Kaleb <kalebcarvalho1@gmail.com>
Co-authored-by: Krishna Chand <krishna_chand67@naver.com>
Co-authored-by: LoneHash <sameepsk2@gmail.com>
Co-authored-by: Luna Jernberg <droidbittin@gmail.com>
Co-authored-by: Lyfja <yassinelaoud@gmail.com>
Co-authored-by: Lzmxya <lzmxya@gmail.com>
Co-authored-by: Marco Santos <enum.scima@gmail.com>
Co-authored-by: Matyáš Caras <contact@hernikplays.cz>
Co-authored-by: Miguel Alexandro Manzano Guerra <kuro_eis@hotmail.com>
Co-authored-by: Milo Ivir <mail@milotype.de>
Co-authored-by: Nishant Bodkhe <nishantbodkhe44@gmail.com>
Co-authored-by: Oğuz Ersen <oguzersen@protonmail.com>
Co-authored-by: Pedro <pedro-mediavilla@hotmail.com>
Co-authored-by: Pitpe11 <giorgos2550@gmail.com>
Co-authored-by: Redy Apriyadi <redy.apriyadi@gmail.com>
Co-authored-by: Ric <rikku.debec@gmail.com>
Co-authored-by: Shjosan <shjosan@kakmix.co>
Co-authored-by: Sieg Jaeger <zekerett@gmail.com>
Co-authored-by: Steven Pedroza <stevenpedroza56@gmail.com>
Co-authored-by: Temporary Person <TemporaryPerson@protonmail.com>
Co-authored-by: Zero O <godarms2010@live.com>
Co-authored-by: ZiomaleQ <r.partyka30@gmail.com>
Co-authored-by: crackheadakira <lasn.mine@gmail.com>
Co-authored-by: dmswd <Bmswad1@gmail.com>
Co-authored-by: julptk <julptk8@gmail.com>
Co-authored-by: monolifed <monolifed@protonmail.com>
Co-authored-by: phannhanhn201 <phannhanhn201@gmail.com>
Co-authored-by: rytis sertvytis <knysliukas2002@gmail.com>
Co-authored-by: soplatnik <jestapom@protonmail.com>
Co-authored-by: Роман <Rozhenkov69@gmail.com>
Co-authored-by: พรหมชัย ชูแสง <promchai2sin@gmail.com>
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/aii/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/ar/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/bn/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/cs/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/de/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/el/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/eo/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/es/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/es_419/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/fil/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/fr/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/hi/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/hr/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/hu/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/id/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/it/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/ja/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/jv/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/lt/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/lv/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/mr/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/ms/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/nb_NO/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/ne/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/nl/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/pl/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/pt/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/pt_BR/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/ru/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/sc/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/sv/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/th/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/tr/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/vi/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/zh_Hans/
Translate-URL: https://hosted.weblate.org/projects/tachiyomi/strings/zh_Hant/
Translation: Tachiyomi/Tachiyomi 0.x

Co-authored-by: Hosted Weblate <hosted@weblate.org>
Co-authored-by: AHmed HarBy <themagic1093@gmail.com>
Co-authored-by: Ainārs Lapkovskis <ainarslapkovskis@gmail.com>
Co-authored-by: Ajeje Brazorf <lmelonimamo@yahoo.it>
Co-authored-by: Albedo <Illiator27@gmail.com>
Co-authored-by: Alessandro Jean <alessandrojean@gmail.com>
Co-authored-by: Alifian Caesar <alifiancaesar@gmail.com>
Co-authored-by: Allan Nordhøy <epost@anotheragency.no>
Co-authored-by: Blue <bluestuffish@gmail.com>
Co-authored-by: Christian Elbrianno <christian.elbrianno41@gmail.com>
Co-authored-by: DarKCroX <darkcrox.2020@outlook.com>
Co-authored-by: Druvvaldis <druvvaldisr@gmail.com>
Co-authored-by: Emerson Nunes <emerson.nunes.ds@gmail.com>
Co-authored-by: Emma Jane Bonestell <EmmaJaneBonestell@gmail.com>
Co-authored-by: Eric <spice2wolf@gmail.com>
Co-authored-by: Fernando Sanchez <cheeze.sprinkels@gmail.com>
Co-authored-by: Forqen <krecio555@gmail.com>
Co-authored-by: Francesco Zanella <franzghosts@gmail.com>
Co-authored-by: Giorgio Sanna <sannagiorgio1997@gmail.com>
Co-authored-by: Hassay Ádám Tamás <hassayadam@gmail.com>
Co-authored-by: Huang Zhiyi <hzy980512@126.com>
Co-authored-by: J. Lavoie <j.lavoie@net-c.ca>
Co-authored-by: Jakub Fabijan <jakubfabijan@tuta.io>
Co-authored-by: Junan Chk <junanchakma2000@gmail.com>
Co-authored-by: K. Sz. Bence <tudi20@protonmail.com>
Co-authored-by: Kaleb <kalebcarvalho1@gmail.com>
Co-authored-by: Krishna Chand <krishna_chand67@naver.com>
Co-authored-by: LoneHash <sameepsk2@gmail.com>
Co-authored-by: Luna Jernberg <droidbittin@gmail.com>
Co-authored-by: Lyfja <yassinelaoud@gmail.com>
Co-authored-by: Lzmxya <lzmxya@gmail.com>
Co-authored-by: Marco Santos <enum.scima@gmail.com>
Co-authored-by: Matyáš Caras <contact@hernikplays.cz>
Co-authored-by: Miguel Alexandro Manzano Guerra <kuro_eis@hotmail.com>
Co-authored-by: Milo Ivir <mail@milotype.de>
Co-authored-by: Nishant Bodkhe <nishantbodkhe44@gmail.com>
Co-authored-by: Oğuz Ersen <oguzersen@protonmail.com>
Co-authored-by: Pedro <pedro-mediavilla@hotmail.com>
Co-authored-by: Pitpe11 <giorgos2550@gmail.com>
Co-authored-by: Redy Apriyadi <redy.apriyadi@gmail.com>
Co-authored-by: Ric <rikku.debec@gmail.com>
Co-authored-by: Shjosan <shjosan@kakmix.co>
Co-authored-by: Sieg Jaeger <zekerett@gmail.com>
Co-authored-by: Steven Pedroza <stevenpedroza56@gmail.com>
Co-authored-by: Temporary Person <TemporaryPerson@protonmail.com>
Co-authored-by: Zero O <godarms2010@live.com>
Co-authored-by: ZiomaleQ <r.partyka30@gmail.com>
Co-authored-by: crackheadakira <lasn.mine@gmail.com>
Co-authored-by: dmswd <Bmswad1@gmail.com>
Co-authored-by: julptk <julptk8@gmail.com>
Co-authored-by: monolifed <monolifed@protonmail.com>
Co-authored-by: phannhanhn201 <phannhanhn201@gmail.com>
Co-authored-by: rytis sertvytis <knysliukas2002@gmail.com>
Co-authored-by: soplatnik <jestapom@protonmail.com>
Co-authored-by: Роман <Rozhenkov69@gmail.com>
Co-authored-by: พรหมชัย ชูแสง <promchai2sin@gmail.com>
2021-10-04 15:41:54 -04:00
675c0cefc3 Fix crash in single-page chapters 2021-10-04 11:06:23 -04:00
1a52385b78 Formatting 2021-10-04 10:50:13 -04:00
372e500590 Remove extra padding when using list with Per Category setting (#5997)
* Remove padding when using list with Per Category setting (fixes #5636)

* Add view type to RecyclerViewPagerAdapter

Correctly this time (ノ◕ヮ◕)ノ*:・゚✧

* Minor tweaks
2021-10-04 10:41:20 -04:00
cc1a317439 enable "ALL" in Browse by default (#6023)
some extensions, including self-hosted ones, have the "ALL" label and
sometimes users get confused with not having enabled "ALL" after
installing new extensions
2021-10-03 15:40:51 -04:00
6d650518a1 App-wide typography adjustments (#5931)
* Manga detail

Also adjust chapter item layout to accommodate bigger
display/font size

* Library

* Updates

* History

* Browse

* Preferences

* Button

* Navigation view

* category-download

* Google Sans

* Reader

* Chips

* Revert "Google Sans"

This reverts commit 5dd4c41f

* Misc

* Cleanups

* Section header text appearance

* Increase library manga title size

* Revert "Increase library manga title size"

This reverts commit 474be913

* Increase section header letter spacing

* Derps
2021-10-03 12:32:04 -04:00
7940117577 Sort and remove duplicates in genres (#6021)
* Sort and remove duplicates in genres

Co-authored-by: ivaniskandar <12537387+ivaniskandar@users.noreply.github.com>

* Remove Sort and filter out blank genre

Co-authored-by: ivaniskandar <12537387+ivaniskandar@users.noreply.github.com>
2021-10-03 12:19:37 -04:00
b0f87fdd21 LicensesController: Move item init to IO thread (#6020) 2021-10-03 12:00:00 -04:00
dc92ffed87 Switch to Material Slider in color filter settings 2021-10-03 11:58:52 -04:00
4af578e310 Apply navigation bar insets to fast scroller and settings search list (#6015) 2021-10-03 11:28:20 -04:00
e22825d818 Check if wifi is connected rather than enabled while downloading. (#5967)
* Fixxy Wixxy

* Downgrade check from Android S to Android Q
2021-10-03 11:27:56 -04:00
e2da6259e7 Update AboutLib plugin 2021-10-03 11:14:56 -04:00
d149017c60 Switch to Material Slider for reader seekbar
Co-authored-by: Jays2Kings <Jays2Kings@users.noreply.github.com>
2021-10-03 11:14:49 -04:00
afc400121b Update dependencies 2021-10-01 18:28:02 -04:00
ef993515c6 Fix MangaController toolbar title showing when editing category (#6005) 2021-10-01 17:52:06 -04:00
edb1d21ddc Don't bury sort menu in overflow in Migrate screen 2021-10-01 17:41:14 -04:00
ba8abd94a8 Ability to order sources by library count when migrating (#6000)
* order sources by library count when migrating (closes #4703)

* Use plain menu instead of full-on sheet
2021-10-01 17:37:43 -04:00
c6d4e4c15f Move extensions enabled languages on top (closes #5694) (#5998) 2021-10-01 09:15:04 -04:00
09f0ac866f Fix incorrect appbar lift state when opening MangaController in hidden state (#5990) 2021-10-01 09:13:00 -04:00
7ed25704d6 Add chapter bookmarking feature to Updates screen (#5984) 2021-10-01 08:11:31 -04:00
2196dac63e Fix variable name in isOnline (#5991) 2021-10-01 08:09:46 -04:00
c8f70efded ReaderActivity: Block focus on viewer (#5996) 2021-10-01 08:09:36 -04:00
ea97488670 Revert parseAs inline function change
Some people sometimes get compile issues?
2021-09-30 17:52:07 -04:00
c2255b0a0f Mark installer names as non-translatable 2021-09-25 21:08:31 -04:00
f754b081ce Use data class to parse extensions list 2021-09-25 14:57:54 -04:00
07771cb5e4 Update kotlinx.serialization 2021-09-25 14:41:48 -04:00
690d8e43ae Show message in migrate screen if library is empty 2021-09-25 14:41:35 -04:00
82f14a7d59 Hide soft keyboard after submitting search query throughout app (#5837)
* Clear focus from SearchView when submitting a search query in BrowseSourceController

* Revert "Clear focus from SearchView when submitting a search query"

* Implement SearchView focus clearing in Tachiyomi's subclass to enable feature throughout app

* Add support for keyboard Enter key

Pressing enter on a keyboard (when using the emulator for example) now also submits the query
2021-09-25 14:32:19 -04:00
b284384f0a Implement new extension install methods (#5904)
* Implement new extension install methods

* Fixes

* Resolve feedback

* Keep pending status when waiting to install

* Cancellable installation

* Remove auto error now that we have cancellable job
2021-09-25 14:31:52 -04:00
1ae0d1b5d0 Reattach after slight delay instead on every db update (#5956) 2021-09-23 18:45:55 -04:00
9de08c8166 Update dependencies 2021-09-20 14:33:35 -04:00
a2d007f2a9 Toolbar and bottom nav scroll snap (#5915) 2021-09-18 16:41:23 -04:00
774f818bbb Fix setting search re-animating on activity recreation (fixes #5882) 2021-09-18 16:28:58 -04:00
0ec7121b8f Adjust snackbar durations (closes #5932) 2021-09-18 16:17:07 -04:00
d7d46f4447 Minor cleanup 2021-09-18 16:13:14 -04:00
45fad147bf Remove spaces at end of line before removing multiple new lines (#5928) 2021-09-18 15:16:03 -04:00
3664195c71 rewrite getFormat the kotlin way (#5930) 2021-09-18 15:15:38 -04:00
fce3cd00a1 Remove setting to disable update error notifications and split out notification channel
Users can exclude things from updating if needed, or disable the notification channel from system settings.
2021-09-17 19:14:30 -04:00
33b3be0d0e Move extension app info button
Aligns with TachiyomiJ2K.
2021-09-16 17:57:41 -04:00
cfd1b4a6c6 Fix toolbar title alpha (#5910) 2021-09-16 17:39:13 -04:00
d45fefd6f0 handle maxNumberSort from API (#5917) 2021-09-16 17:37:42 -04:00
f125ab01ee Change how the bottom navigation is hidden (#5823)
* Change how the bottom navigation is hidden

Modifies the translationY instead of the height.

* Cleanups
2021-09-16 17:37:17 -04:00
be001d090c [skip ci] Update issue closer to ignore myanimelist (#5911)
Not sure if there's any limitation for the regex but this will ignore myanimelist strings, in practice.
2021-09-14 11:50:21 -04:00
971d8a7e40 Allow preferences to multi-line (#5905) 2021-09-13 18:39:14 -04:00
a2cf210a52 Unify NSFW flagging for sources/extensions
Since multisource extensions are no longer a thing, we now simply rely on the flag at the extension level, i.e. the per-Source/SourceFactory `@Nsfw` annotation is no longer checked.
We'll have to remove all of the annotation usages from the existing sources, which will also effectively break the setting for older versions of the app.
2021-09-13 17:49:58 -04:00
455 changed files with 13595 additions and 7843 deletions

View File

@ -3,7 +3,7 @@
I acknowledge that:
- I have updated:
- To the latest version of the app (stable is v0.12.2)
- To the latest version of the app (stable is v0.12.3)
- All extensions
- I have tried the troubleshooting guide: https://tachiyomi.org/help/guides/troubleshooting-problems/
- If this is an issue with an extension, that I should be opening an issue in https://github.com/tachiyomiorg/tachiyomi-extensions

View File

@ -53,7 +53,7 @@ body:
label: Tachiyomi version
description: You can find your Tachiyomi version in **More → About**.
placeholder: |
Example: "0.12.2"
Example: "0.12.3"
validations:
required: true
@ -98,7 +98,7 @@ body:
required: true
- label: I have tried the [troubleshooting guide](https://tachiyomi.org/help/guides/troubleshooting/).
required: true
- label: I have updated the app to version **[0.12.2](https://github.com/tachiyomiorg/tachiyomi/releases/latest)**.
- label: I have updated the app to version **[0.12.3](https://github.com/tachiyomiorg/tachiyomi/releases/latest)**.
required: true
- label: I have updated all installed extensions.
required: true

View File

@ -33,7 +33,7 @@ body:
required: true
- label: If this is an issue with an extension, I should be opening an issue in the [extensions repository](https://github.com/tachiyomiorg/tachiyomi-extensions/issues/new/choose).
required: true
- label: I have updated the app to version **[0.12.2](https://github.com/tachiyomiorg/tachiyomi/releases/latest)**.
- label: I have updated the app to version **[0.12.3](https://github.com/tachiyomiorg/tachiyomi/releases/latest)**.
required: true
- label: I will fill out all of the requested information in this form.
required: true

View File

@ -1,6 +1,9 @@
name: PR build check
on:
pull_request:
paths-ignore:
- '**.md'
- 'app/src/main/res/**/strings.xml'
jobs:
build:
@ -25,9 +28,6 @@ jobs:
cp .github/runner-files/ci-gradle.properties ~/.gradle/gradle.properties
- name: Build app
uses: gradle/gradle-command-action@v1
uses: gradle/gradle-command-action@v2
with:
arguments: assembleStandardRelease
distributions-cache-enabled: true
dependencies-cache-enabled: true
configuration-cache-enabled: true

View File

@ -13,9 +13,10 @@ jobs:
steps:
- name: Cancel previous runs
uses: styfle/cancel-workflow-action@0.5.0
uses: styfle/cancel-workflow-action@0.9.1
with:
access_token: ${{ github.token }}
all_but_latest: true
- name: Clone repo
uses: actions/checkout@v2
@ -34,12 +35,9 @@ jobs:
cp .github/runner-files/ci-gradle.properties ~/.gradle/gradle.properties
- name: Build app
uses: gradle/gradle-command-action@v1
uses: gradle/gradle-command-action@v2
with:
arguments: assembleStandardRelease
distributions-cache-enabled: true
dependencies-cache-enabled: true
configuration-cache-enabled: true
# Sign APK and create release for tags

View File

@ -10,6 +10,7 @@ jobs:
cancel:
runs-on: ubuntu-latest
steps:
- uses: styfle/cancel-workflow-action@0.8.0
- uses: styfle/cancel-workflow-action@0.9.1
with:
all_but_latest: true
workflow_id: ${{ github.event.workflow.id }}

View File

@ -25,7 +25,7 @@ jobs:
},
{
"type": "both",
"regex": ".*(aniyomi|anime).*",
"regex": "^(?!.*myanimelist.*).*(aniyomi|anime).*$",
"ignoreCase": true,
"message": "Tachiyomi does not support anime, and has no plans to support anime. In addition Tachiyomi is not affiliated with Aniyomi https://github.com/jmir1/aniyomi"
}

View File

@ -9,6 +9,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Moderate issues
uses: tachiyomiorg/issue-moderator-action@v1.1
uses: tachiyomiorg/issue-moderator-action@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}

View File

@ -3,7 +3,7 @@ name: Lock threads
on:
# Daily
schedule:
- cron: '0 * * * *'
- cron: '0 0 * * *'
# Manual trigger
workflow_dispatch:
inputs:
@ -12,8 +12,8 @@ jobs:
lock:
runs-on: ubuntu-latest
steps:
- uses: dessant/lock-threads@v2
- uses: dessant/lock-threads@v3
with:
github-token: ${{ github.token }}
issue-lock-inactive-days: '2'
pr-lock-inactive-days: '2'
issue-inactive-days: '2'
pr-inactive-days: '2'

View File

@ -10,6 +10,7 @@ Thanks for your interest in contributing to Tachiyomi!
Pull requests are welcome!
If you're interested in taking on [an open issue](https://github.com/tachiyomiorg/tachiyomi/issues), please comment on it so others are aware.
You do not need to ask for permission nor an assignment.
# Translations

View File

@ -28,14 +28,14 @@ android {
applicationId = "eu.kanade.tachiyomi"
minSdk = AndroidConfig.minSdk
targetSdk = AndroidConfig.targetSdk
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
versionCode = 68
versionName = "0.12.2"
versionCode = 73
versionName = "0.13.0"
buildConfigField("String", "COMMIT_COUNT", "\"${getCommitCount()}\"")
buildConfigField("String", "COMMIT_SHA", "\"${getGitSha()}\"")
buildConfigField("String", "BUILD_TIME", "\"${getBuildTime()}\"")
buildConfigField("boolean", "INCLUDE_UPDATER", "false")
buildConfigField("boolean", "PREVIEW", "false")
// Please disable ACRA or use your own instance in forked versions of the project
buildConfigField("String", "ACRA_URI", "\"https://tachiyomi.kanade.eu/crash_report\"")
@ -43,6 +43,8 @@ android {
ndk {
abiFilters += SUPPORTED_ABIS
}
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
splits {
@ -58,25 +60,25 @@ android {
named("debug") {
versionNameSuffix = "-${getCommitCount()}"
applicationIdSuffix = ".debug"
isShrinkResources = true
isMinifyEnabled = true
proguardFiles("proguard-android-optimize.txt", "proguard-rules.pro")
}
create("debugFull") { // Debug without R8
initWith(getByName("debug"))
isShrinkResources = false
isMinifyEnabled = false
}
named("release") {
isShrinkResources = true
isMinifyEnabled = true
proguardFiles("proguard-android-optimize.txt", "proguard-rules.pro")
}
create("preview") {
initWith(getByName("release"))
buildConfigField("boolean", "PREVIEW", "true")
val debugType = getByName("debug")
signingConfig = debugType.signingConfig
versionNameSuffix = debugType.versionNameSuffix
applicationIdSuffix = debugType.applicationIdSuffix
}
}
sourceSets {
getByName("debugFull").res.srcDirs("src/debug/res")
getByName("preview").res.srcDirs("src/debug/res")
}
flavorDimensions.add("default")
@ -98,8 +100,10 @@ android {
"LICENSE.txt",
"META-INF/LICENSE",
"META-INF/LICENSE.txt",
"META-INF/README.md",
"META-INF/NOTICE",
"META-INF/*.kotlin_module",
"META-INF/*.version",
))
}
@ -109,12 +113,17 @@ android {
buildFeatures {
viewBinding = true
// Disable some unused things
aidl = false
renderScript = false
shaders = false
}
lint {
disable("MissingTranslation", "ExtraTranslation")
isAbortOnError = false
isCheckReleaseBuilds = false
disable.addAll(listOf("MissingTranslation", "ExtraTranslation"))
abortOnError = false
checkReleaseBuilds = false
}
compileOptions {
@ -130,7 +139,7 @@ android {
dependencies {
implementation(kotlin("reflect", version = BuildPluginsVersion.KOTLIN))
val coroutinesVersion = "1.5.2"
val coroutinesVersion = "1.6.0"
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutinesVersion")
@ -138,19 +147,20 @@ dependencies {
implementation("org.tachiyomi:source-api:1.1")
// AndroidX libraries
implementation("androidx.annotation:annotation:1.3.0-alpha01")
implementation("androidx.appcompat:appcompat:1.4.0-alpha03")
implementation("androidx.biometric:biometric-ktx:1.2.0-alpha03")
implementation("androidx.browser:browser:1.3.0")
implementation("androidx.constraintlayout:constraintlayout:2.1.0")
implementation("androidx.coordinatorlayout:coordinatorlayout:1.1.0")
implementation("androidx.core:core-ktx:1.7.0-alpha02")
implementation("androidx.core:core-splashscreen:1.0.0-alpha01")
implementation("androidx.recyclerview:recyclerview:1.2.1")
implementation("androidx.annotation:annotation:1.4.0-alpha01")
implementation("androidx.appcompat:appcompat:1.4.1")
implementation("androidx.biometric:biometric-ktx:1.2.0-alpha04")
implementation("androidx.browser:browser:1.4.0")
implementation("androidx.constraintlayout:constraintlayout:2.1.3")
implementation("androidx.coordinatorlayout:coordinatorlayout:1.2.0")
implementation("androidx.core:core-ktx:1.8.0-alpha02")
implementation("androidx.core:core-splashscreen:1.0.0-alpha02")
implementation("androidx.recyclerview:recyclerview:1.3.0-alpha01")
implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.2.0-alpha01")
implementation("androidx.viewpager:viewpager:1.1.0-alpha01")
val lifecycleVersion = "2.4.0-alpha01"
implementation("androidx.lifecycle:lifecycle-common-java8:$lifecycleVersion")
val lifecycleVersion = "2.4.0"
implementation("androidx.lifecycle:lifecycle-common:$lifecycleVersion")
implementation("androidx.lifecycle:lifecycle-process:$lifecycleVersion")
implementation("androidx.lifecycle:lifecycle-runtime-ktx:$lifecycleVersion")
@ -168,25 +178,23 @@ dependencies {
implementation("com.squareup.okhttp3:okhttp:$okhttpVersion")
implementation("com.squareup.okhttp3:logging-interceptor:$okhttpVersion")
implementation("com.squareup.okhttp3:okhttp-dnsoverhttps:$okhttpVersion")
implementation("com.squareup.okio:okio:2.10.0")
implementation("com.squareup.okio:okio:3.0.0")
// TLS 1.3 support for Android < 10
implementation("org.conscrypt:conscrypt-android:2.5.2")
// Data serialization (JSON, protobuf)
val kotlinSerializationVersion = "1.3.0-RC"
val kotlinSerializationVersion = "1.3.2"
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:$kotlinSerializationVersion")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-protobuf:$kotlinSerializationVersion")
// TODO: remove these once they're no longer used in any extensions
implementation("com.google.code.gson:gson:2.8.7")
implementation("com.github.salomonbrys.kotson:kotson:2.5.0")
// JavaScript engine
implementation("app.cash.quickjs:quickjs-android:0.9.2")
// TODO: remove Duktape once all extensions are using QuickJS
implementation("com.squareup.duktape:duktape-android:1.4.0")
// HTML parser
implementation("org.jsoup:jsoup:1.14.2")
implementation("org.jsoup:jsoup:1.14.3")
// Disk
implementation("com.jakewharton:disklrucache:2.0.2")
@ -194,13 +202,13 @@ dependencies {
implementation("com.github.junrar:junrar:7.4.0")
// Database
implementation("androidx.sqlite:sqlite-ktx:2.1.0")
implementation("androidx.sqlite:sqlite-ktx:2.2.0")
implementation("com.github.inorichi.storio:storio-common:8be19de@aar")
implementation("com.github.inorichi.storio:storio-sqlite:8be19de@aar")
implementation("com.github.requery:sqlite-android:3.36.0")
// Preferences
implementation("androidx.preference:preference-ktx:1.1.1")
implementation("androidx.preference:preference-ktx:1.2.0-rc01")
implementation("com.github.tfcporciuncula.flow-preferences:flow-preferences:1.4.0")
// Model View Presenter
@ -212,7 +220,7 @@ dependencies {
implementation("com.github.inorichi.injekt:injekt-core:65b0440")
// Image loading
val coilVersion = "1.3.2"
val coilVersion = "1.4.0"
implementation("io.coil-kt:coil:$coilVersion")
implementation("io.coil-kt:coil-gif:$coilVersion")
@ -225,17 +233,19 @@ dependencies {
implementation("com.github.gpanther:java-nat-sort:natural-comparator-1.1")
// UI libraries
implementation("com.google.android.material:material:1.5.0-alpha03")
implementation("com.google.android.material:material:1.6.0-alpha02")
implementation("com.github.dmytrodanylyk.android-process-button:library:1.0.4")
implementation("eu.davidea:flexible-adapter:5.1.0")
implementation("eu.davidea:flexible-adapter-ui:1.0.0")
implementation("com.github.arkon.FlexibleAdapter:flexible-adapter:c8013533")
implementation("com.github.arkon.FlexibleAdapter:flexible-adapter-ui:c8013533")
implementation("com.nightlynexus.viewstatepageradapter:viewstatepageradapter:1.1.0")
implementation("com.github.chrisbanes:PhotoView:2.3.0")
implementation("com.github.tachiyomiorg:DirectionalViewPager:1.0.0")
implementation("dev.chrisbanes.insetter:insetter:0.6.0")
implementation("com.github.tachiyomiorg:DirectionalViewPager:1.0.0") {
exclude(group = "androidx.viewpager", module = "viewpager")
}
implementation("dev.chrisbanes.insetter:insetter:0.6.1")
// Conductor
val conductorVersion = "3.0.0"
val conductorVersion = "3.1.2"
implementation("com.bluelinelabs:conductor:$conductorVersion")
implementation("com.bluelinelabs:conductor-viewpager:$conductorVersion")
implementation("com.github.tachiyomiorg:conductor-support-preference:$conductorVersion")
@ -249,15 +259,20 @@ dependencies {
implementation("io.github.reactivecircus.flowbinding:flowbinding-viewpager:$flowbindingVersion")
// Logging
implementation("com.jakewharton.timber:timber:5.0.1")
implementation("com.squareup.logcat:logcat:0.1")
// Crash reports/analytics
implementation("ch.acra:acra-http:5.8.1")
"standardImplementation"("com.google.firebase:firebase-analytics:19.0.1")
implementation("ch.acra:acra-http:5.8.4")
"standardImplementation"("com.google.firebase:firebase-analytics-ktx:20.0.2")
// Licenses
implementation("com.mikepenz:aboutlibraries-core:${BuildPluginsVersion.ABOUTLIB_PLUGIN}")
// Shizuku
val shizukuVersion = "12.1.0"
implementation("dev.rikka.shizuku:api:$shizukuVersion")
implementation("dev.rikka.shizuku:provider:$shizukuVersion")
// Tests
testImplementation("junit:junit:4.13.2")
testImplementation("org.assertj:assertj-core:3.16.1")
@ -277,12 +292,12 @@ tasks {
kotlinOptions.freeCompilerArgs += listOf(
"-Xopt-in=kotlin.Experimental",
"-Xopt-in=kotlin.RequiresOptIn",
"-Xuse-experimental=kotlin.ExperimentalStdlibApi",
"-Xuse-experimental=kotlinx.coroutines.FlowPreview",
"-Xuse-experimental=kotlinx.coroutines.ExperimentalCoroutinesApi",
"-Xuse-experimental=kotlinx.coroutines.InternalCoroutinesApi",
"-Xuse-experimental=kotlinx.serialization.ExperimentalSerializationApi",
"-Xuse-experimental=coil.annotation.ExperimentalCoilApi",
"-Xopt-in=kotlin.ExperimentalStdlibApi",
"-Xopt-in=kotlinx.coroutines.FlowPreview",
"-Xopt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
"-Xopt-in=kotlinx.coroutines.InternalCoroutinesApi",
"-Xopt-in=kotlinx.serialization.ExperimentalSerializationApi",
"-Xopt-in=coil.annotation.ExperimentalCoilApi",
)
}

View File

@ -12,6 +12,7 @@
-keep,allowoptimization class com.google.gson.** { public protected *; }
-keep,allowoptimization class com.github.salomonbrys.kotson.** { public protected *; }
-keep,allowoptimization class com.squareup.duktape.** { public protected *; }
-keep,allowoptimization class app.cash.quickjs.** { public protected *; }
-keep,allowoptimization class uy.kohesive.injekt.** { public protected *; }
##---------------Begin: proguard configuration for RxJava 1.x ----------

View File

@ -18,6 +18,7 @@
<!-- For managing extensions -->
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
<uses-permission android:name="android.permission.REQUEST_DELETE_PACKAGES" />
<uses-permission android:name="android.permission.UPDATE_PACKAGES_WITHOUT_USER_ACTION" />
<!-- To view extension packages in API 30+ -->
<uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />
@ -177,7 +178,7 @@
android:exported="false" />
<service
android:name=".data.updater.UpdaterService"
android:name=".data.updater.AppUpdateService"
android:exported="false" />
<service
@ -188,6 +189,9 @@
android:name=".data.backup.BackupRestoreService"
android:exported="false" />
<service android:name=".extension.util.ExtensionInstallService"
android:exported="false" />
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.provider"
@ -198,6 +202,14 @@
android:resource="@xml/provider_paths" />
</provider>
<provider
android:name="rikka.shizuku.ShizukuProvider"
android:authorities="${applicationId}.shizuku"
android:multiprocess="false"
android:enabled="true"
android:exported="true"
android:permission="android.permission.INTERACT_ACROSS_USERS_FULL" />
<meta-data android:name="android.webkit.WebView.EnableSafeBrowsing"
android:value="false" />
<meta-data android:name="android.webkit.WebView.MetricsOptOut"

View File

@ -12,48 +12,50 @@ import android.webkit.WebView
import androidx.appcompat.app.AppCompatDelegate
import androidx.core.app.NotificationManagerCompat
import androidx.core.content.getSystemService
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleObserver
import androidx.lifecycle.OnLifecycleEvent
import androidx.lifecycle.DefaultLifecycleObserver
import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.ProcessLifecycleOwner
import androidx.lifecycle.lifecycleScope
import coil.ImageLoader
import coil.ImageLoaderFactory
import coil.decode.GifDecoder
import coil.decode.ImageDecoderDecoder
import coil.util.DebugLogger
import eu.kanade.tachiyomi.data.coil.ByteBufferFetcher
import eu.kanade.tachiyomi.data.coil.MangaCoverFetcher
import eu.kanade.tachiyomi.data.coil.TachiyomiImageDecoder
import eu.kanade.tachiyomi.data.notification.Notifications
import eu.kanade.tachiyomi.data.preference.PreferenceValues
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
import eu.kanade.tachiyomi.data.preference.asImmediateFlow
import eu.kanade.tachiyomi.network.NetworkHelper
import eu.kanade.tachiyomi.ui.security.SecureActivityDelegate
import eu.kanade.tachiyomi.util.preference.asImmediateFlow
import eu.kanade.tachiyomi.util.system.AuthenticatorUtil
import eu.kanade.tachiyomi.util.system.animatorDurationScale
import eu.kanade.tachiyomi.util.system.logcat
import eu.kanade.tachiyomi.util.system.notification
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
import logcat.AndroidLogcatLogger
import logcat.LogPriority
import logcat.LogcatLogger
import org.acra.config.httpSender
import org.acra.ktx.initAcra
import org.acra.sender.HttpSender
import org.conscrypt.Conscrypt
import timber.log.Timber
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
import uy.kohesive.injekt.injectLazy
import java.security.Security
open class App : Application(), LifecycleObserver, ImageLoaderFactory {
open class App : Application(), DefaultLifecycleObserver, ImageLoaderFactory {
private val preferences: PreferencesHelper by injectLazy()
private val disableIncognitoReceiver = DisableIncognitoReceiver()
override fun onCreate() {
super.onCreate()
if (BuildConfig.DEBUG) Timber.plant(Timber.DebugTree())
super<Application>.onCreate()
// TLS 1.3 support for Android < 10
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) {
@ -111,6 +113,10 @@ open class App : Application(), LifecycleObserver, ImageLoaderFactory {
}
)
}.launchIn(ProcessLifecycleOwner.get().lifecycleScope)
if (!LogcatLogger.isInstalled && preferences.verboseLogging()) {
LogcatLogger.install(AndroidLogcatLogger(LogPriority.VERBOSE))
}
}
override fun newImageLoader(): ImageLoader {
@ -128,12 +134,11 @@ open class App : Application(), LifecycleObserver, ImageLoaderFactory {
okHttpClient(Injekt.get<NetworkHelper>().coilClient)
crossfade((300 * this@App.animatorDurationScale).toInt())
allowRgb565(getSystemService<ActivityManager>()!!.isLowRamDevice)
if (preferences.verboseLogging()) logger(DebugLogger())
}.build()
}
@OnLifecycleEvent(Lifecycle.Event.ON_STOP)
@Suppress("unused")
fun onAppBackgrounded() {
override fun onStop(owner: LifecycleOwner) {
if (!AuthenticatorUtil.isAuthenticating && preferences.lockAppAfter().get() >= 0) {
SecureActivityDelegate.locked = true
}
@ -154,7 +159,11 @@ open class App : Application(), LifecycleObserver, ImageLoaderFactory {
}
protected open fun setupNotificationChannels() {
Notifications.createChannels(this)
try {
Notifications.createChannels(this)
} catch (e: Exception) {
logcat(LogPriority.ERROR, e) { "Failed to modify notification channels" }
}
}
private inner class DisableIncognitoReceiver : BroadcastReceiver() {

View File

@ -0,0 +1,11 @@
package eu.kanade.tachiyomi
/**
* Used by extensions.
*
* @since extension-lib 1.3
*/
object AppInfo {
fun getVersionCode() = BuildConfig.VERSION_CODE
fun getVersionName() = BuildConfig.VERSION_NAME
}

View File

@ -5,16 +5,19 @@ import androidx.core.content.edit
import androidx.preference.PreferenceManager
import eu.kanade.tachiyomi.data.backup.BackupCreatorJob
import eu.kanade.tachiyomi.data.library.LibraryUpdateJob
import eu.kanade.tachiyomi.data.preference.MANGA_ONGOING
import eu.kanade.tachiyomi.data.preference.PreferenceKeys
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
import eu.kanade.tachiyomi.data.track.TrackManager
import eu.kanade.tachiyomi.data.updater.UpdaterJob
import eu.kanade.tachiyomi.data.updater.AppUpdateJob
import eu.kanade.tachiyomi.extension.ExtensionUpdateJob
import eu.kanade.tachiyomi.network.PREF_DOH_CLOUDFLARE
import eu.kanade.tachiyomi.ui.library.LibrarySort
import eu.kanade.tachiyomi.ui.library.setting.SortDirectionSetting
import eu.kanade.tachiyomi.ui.library.setting.SortModeSetting
import eu.kanade.tachiyomi.ui.reader.setting.OrientationType
import eu.kanade.tachiyomi.util.preference.minusAssign
import eu.kanade.tachiyomi.util.preference.plusAssign
import eu.kanade.tachiyomi.util.system.toast
import eu.kanade.tachiyomi.widget.ExtendedNavigationView
import uy.kohesive.injekt.Injekt
@ -38,7 +41,7 @@ object Migrations {
// Always set up background tasks to ensure they're running
if (BuildConfig.INCLUDE_UPDATER) {
UpdaterJob.setupTask(context)
AppUpdateJob.setupTask(context)
}
ExtensionUpdateJob.setupTask(context)
LibraryUpdateJob.setupTask(context)
@ -49,10 +52,12 @@ object Migrations {
return false
}
val prefs = PreferenceManager.getDefaultSharedPreferences(context)
if (oldVersion < 14) {
// Restore jobs after upgrading to Evernote's job scheduler.
if (BuildConfig.INCLUDE_UPDATER) {
UpdaterJob.setupTask(context)
AppUpdateJob.setupTask(context)
}
LibraryUpdateJob.setupTask(context)
}
@ -85,7 +90,7 @@ object Migrations {
if (oldVersion < 43) {
// Restore jobs after migrating from Evernote's job scheduler to WorkManager.
if (BuildConfig.INCLUDE_UPDATER) {
UpdaterJob.setupTask(context)
AppUpdateJob.setupTask(context)
}
LibraryUpdateJob.setupTask(context)
BackupCreatorJob.setupTask(context)
@ -95,8 +100,6 @@ object Migrations {
}
if (oldVersion < 44) {
// Reset sorting preference if using removed sort by source
val prefs = PreferenceManager.getDefaultSharedPreferences(context)
val oldSortingMode = prefs.getInt(PreferenceKeys.librarySortingMode, 0)
@Suppress("DEPRECATION")
@ -108,7 +111,6 @@ object Migrations {
}
if (oldVersion < 52) {
// Migrate library filters to tri-state versions
val prefs = PreferenceManager.getDefaultSharedPreferences(context)
fun convertBooleanPrefToTriState(key: String): Int {
val oldPrefValue = prefs.getBoolean(key, false)
return if (oldPrefValue) ExtendedNavigationView.Item.TriStateGroup.State.INCLUDE.value
@ -137,7 +139,6 @@ object Migrations {
}
if (oldVersion < 57) {
// Migrate DNS over HTTPS setting
val prefs = PreferenceManager.getDefaultSharedPreferences(context)
val wasDohEnabled = prefs.getBoolean("enable_doh", false)
if (wasDohEnabled) {
prefs.edit {
@ -148,7 +149,6 @@ object Migrations {
}
if (oldVersion < 59) {
// Reset rotation to Free after replacing Lock
val prefs = PreferenceManager.getDefaultSharedPreferences(context)
if (prefs.contains("pref_rotation_type_key")) {
prefs.edit {
putInt("pref_rotation_type_key", 1)
@ -157,17 +157,16 @@ object Migrations {
// Disable update check for Android 5.x users
if (BuildConfig.INCLUDE_UPDATER && Build.VERSION.SDK_INT <= Build.VERSION_CODES.M) {
UpdaterJob.cancelTask(context)
AppUpdateJob.cancelTask(context)
}
}
if (oldVersion < 60) {
// Re-enable update check that was prevously accidentally disabled for M
if (BuildConfig.INCLUDE_UPDATER && Build.VERSION.SDK_INT == Build.VERSION_CODES.M) {
UpdaterJob.setupTask(context)
AppUpdateJob.setupTask(context)
}
// Migrate Rotation and Viewer values to default values for viewer_flags
val prefs = PreferenceManager.getDefaultSharedPreferences(context)
val newOrientation = when (prefs.getInt("pref_rotation_type_key", 1)) {
1 -> OrientationType.FREE.flagValue
2 -> OrientationType.PORTRAIT.flagValue
@ -196,8 +195,6 @@ object Migrations {
}
}
if (oldVersion < 64) {
val prefs = PreferenceManager.getDefaultSharedPreferences(context)
val oldSortingMode = prefs.getInt(PreferenceKeys.librarySortingMode, 0)
val oldSortingDirection = prefs.getBoolean(PreferenceKeys.librarySortingDirection, true)
@ -229,6 +226,25 @@ object Migrations {
putString(PreferenceKeys.librarySortingDirection, newSortingDirection.name)
}
}
if (oldVersion < 70) {
if (preferences.enabledLanguages().isSet()) {
preferences.enabledLanguages() += "all"
}
}
if (oldVersion < 71) {
// Handle removed every 3, 4, 6, and 8 hour library updates
val updateInterval = preferences.libraryUpdateInterval().get()
if (updateInterval in listOf(3, 4, 6, 8)) {
preferences.libraryUpdateInterval().set(12)
LibraryUpdateJob.setupTask(context, 12)
}
}
if (oldVersion < 72) {
val oldUpdateOngoingOnly = prefs.getBoolean("pref_update_only_non_completed_key", true)
if (!oldUpdateOngoingOnly) {
preferences.libraryUpdateMangaRestriction() -= MANGA_ONGOING
}
}
return true
}

View File

@ -1,5 +0,0 @@
package eu.kanade.tachiyomi.annotations
@Retention(AnnotationRetention.RUNTIME)
@Target(AnnotationTarget.CLASS)
annotation class Nsfw

View File

@ -21,7 +21,7 @@ abstract class AbstractBackupManager(protected val context: Context) {
internal val trackManager: TrackManager by injectLazy()
protected val preferences: PreferencesHelper by injectLazy()
abstract fun createBackup(uri: Uri, flags: Int, isJob: Boolean): String?
abstract fun createBackup(uri: Uri, flags: Int, isJob: Boolean): String
/**
* Returns manga

View File

@ -14,3 +14,5 @@ abstract class AbstractBackupRestoreValidator {
data class Results(val missingSources: List<String>, val missingTrackers: List<String>)
}
class ValidatorParseException(e: Exception) : RuntimeException(e)

View File

@ -9,6 +9,8 @@ import androidx.work.Worker
import androidx.work.WorkerParameters
import eu.kanade.tachiyomi.data.backup.full.FullBackupManager
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
import eu.kanade.tachiyomi.util.system.logcat
import logcat.LogPriority
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
import java.util.concurrent.TimeUnit
@ -24,6 +26,7 @@ class BackupCreatorJob(private val context: Context, workerParams: WorkerParamet
FullBackupManager(context).createBackup(uri, flags, true)
Result.success()
} catch (e: Exception) {
logcat(LogPriority.ERROR, e)
Result.failure()
}
}

View File

@ -139,10 +139,12 @@ class BackupNotifier(private val context: Context) {
val destFile = File(path, file)
val uri = destFile.getUriCompat(context)
val errorLogIntent = NotificationReceiver.openErrorLogPendingActivity(context, uri)
setContentIntent(errorLogIntent)
addAction(
R.drawable.ic_folder_24dp,
context.getString(R.string.action_show_errors),
NotificationReceiver.openErrorLogPendingActivity(context, uri)
errorLogIntent,
)
}

View File

@ -13,13 +13,14 @@ import eu.kanade.tachiyomi.data.backup.legacy.LegacyBackupRestore
import eu.kanade.tachiyomi.data.notification.Notifications
import eu.kanade.tachiyomi.util.system.acquireWakeLock
import eu.kanade.tachiyomi.util.system.isServiceRunning
import eu.kanade.tachiyomi.util.system.logcat
import kotlinx.coroutines.CoroutineExceptionHandler
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.SupervisorJob
import kotlinx.coroutines.cancel
import kotlinx.coroutines.launch
import timber.log.Timber
import logcat.LogPriority
/**
* Restores backup.
@ -128,7 +129,7 @@ class BackupRestoreService : Service() {
}
val handler = CoroutineExceptionHandler { _, exception ->
Timber.e(exception)
logcat(LogPriority.ERROR, exception)
backupRestore?.writeErrorLog()
notifier.showRestoreError(exception.message)

View File

@ -26,11 +26,12 @@ import eu.kanade.tachiyomi.data.database.models.History
import eu.kanade.tachiyomi.data.database.models.Manga
import eu.kanade.tachiyomi.data.database.models.MangaCategory
import eu.kanade.tachiyomi.data.database.models.Track
import eu.kanade.tachiyomi.util.system.logcat
import kotlinx.serialization.protobuf.ProtoBuf
import logcat.LogPriority
import okio.buffer
import okio.gzip
import okio.sink
import timber.log.Timber
import kotlin.math.max
class FullBackupManager(context: Context) : AbstractBackupManager(context) {
@ -43,7 +44,7 @@ class FullBackupManager(context: Context) : AbstractBackupManager(context) {
* @param uri path of Uri
* @param isJob backup called from job
*/
override fun createBackup(uri: Uri, flags: Int, isJob: Boolean): String? {
override fun createBackup(uri: Uri, flags: Int, isJob: Boolean): String {
// Create root object
var backup: Backup? = null
@ -58,8 +59,9 @@ class FullBackupManager(context: Context) : AbstractBackupManager(context) {
)
}
var file: UniFile? = null
try {
val file: UniFile = (
file = (
if (isJob) {
// Get dir of file and create
var dir = UniFile.fromUri(context, uri)
@ -84,9 +86,15 @@ class FullBackupManager(context: Context) : AbstractBackupManager(context) {
val byteArray = parser.encodeToByteArray(BackupSerializer, backup!!)
file.openOutputStream().sink().gzip().buffer().use { it.write(byteArray) }
return file.uri.toString()
val fileUri = file.uri
// Make sure it's a valid backup file
FullBackupRestoreValidator().validate(context, fileUri)
return fileUri.toString()
} catch (e: Exception) {
Timber.e(e)
logcat(LogPriority.ERROR, e)
file?.delete()
throw e
}
}

View File

@ -4,12 +4,14 @@ import android.content.Context
import android.net.Uri
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.backup.AbstractBackupRestoreValidator
import eu.kanade.tachiyomi.data.backup.ValidatorParseException
import eu.kanade.tachiyomi.data.backup.full.models.BackupSerializer
import okio.buffer
import okio.gzip
import okio.source
class FullBackupRestoreValidator : AbstractBackupRestoreValidator() {
/**
* Checks for critical backup file data.
*
@ -19,14 +21,20 @@ class FullBackupRestoreValidator : AbstractBackupRestoreValidator() {
override fun validate(context: Context, uri: Uri): Results {
val backupManager = FullBackupManager(context)
val backupString = context.contentResolver.openInputStream(uri)!!.source().gzip().buffer().use { it.readByteArray() }
val backup = backupManager.parser.decodeFromByteArray(BackupSerializer, backupString)
val backup = try {
val backupString =
context.contentResolver.openInputStream(uri)!!.source().gzip().buffer()
.use { it.readByteArray() }
backupManager.parser.decodeFromByteArray(BackupSerializer, backupString)
} catch (e: Exception) {
throw ValidatorParseException(e)
}
if (backup.backupManga.isEmpty()) {
throw Exception(context.getString(R.string.invalid_backup_file_missing_manga))
}
val sources = backup.backupSources.map { it.sourceId to it.name }.toMap()
val sources = backup.backupSources.associate { it.sourceId to it.name }
val missingSources = sources
.filter { sourceManager.get(it.key) == null }
.values

View File

@ -4,10 +4,12 @@ import android.content.Context
import android.net.Uri
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.backup.AbstractBackupRestoreValidator
import eu.kanade.tachiyomi.data.backup.ValidatorParseException
import eu.kanade.tachiyomi.data.backup.legacy.models.Backup
import kotlinx.serialization.json.decodeFromStream
class LegacyBackupRestoreValidator : AbstractBackupRestoreValidator() {
/**
* Checks for critical backup file data.
*
@ -17,9 +19,13 @@ class LegacyBackupRestoreValidator : AbstractBackupRestoreValidator() {
override fun validate(context: Context, uri: Uri): Results {
val backupManager = LegacyBackupManager(context)
val backup = backupManager.parser.decodeFromStream<Backup>(
context.contentResolver.openInputStream(uri)!!
)
val backup = try {
backupManager.parser.decodeFromStream<Backup>(
context.contentResolver.openInputStream(uri)!!
)
} catch (e: Exception) {
throw ValidatorParseException(e)
}
if (backup.version == null) {
throw Exception(context.getString(R.string.invalid_backup_file_missing_data))
@ -51,12 +57,10 @@ class LegacyBackupRestoreValidator : AbstractBackupRestoreValidator() {
companion object {
fun getSourceMapping(extensionsMapping: List<String>): Map<Long, String> {
return extensionsMapping
.map {
val items = it.split(":")
items[0].toLong() to items[1]
}
.toMap()
return extensionsMapping.associate {
val items = it.split(":")
items[0].toLong() to items[1]
}
}
}
}

View File

@ -20,7 +20,7 @@ class DbOpenCallback : SupportSQLiteOpenHelper.Callback(DATABASE_VERSION) {
/**
* Version of the database.
*/
const val DATABASE_VERSION = 13
const val DATABASE_VERSION = 14
}
override fun onCreate(db: SupportSQLiteDatabase) = with(db) {
@ -91,6 +91,9 @@ class DbOpenCallback : SupportSQLiteOpenHelper.Callback(DATABASE_VERSION) {
db.execSQL(TrackTable.insertFromTempTable)
db.execSQL(TrackTable.dropTempTable)
}
if (oldVersion < 14) {
db.execSQL(ChapterTable.fixDateUploadIfNeeded)
}
}
override fun onConfigure(db: SupportSQLiteDatabase) {

View File

@ -47,10 +47,10 @@ class CategoryPutResolver : DefaultPutResolver<Category>() {
class CategoryGetResolver : DefaultGetResolver<Category>() {
override fun mapFromCursor(cursor: Cursor): Category = CategoryImpl().apply {
id = cursor.getInt(cursor.getColumnIndex(COL_ID))
name = cursor.getString(cursor.getColumnIndex(COL_NAME))
order = cursor.getInt(cursor.getColumnIndex(COL_ORDER))
flags = cursor.getInt(cursor.getColumnIndex(COL_FLAGS))
id = cursor.getInt(cursor.getColumnIndexOrThrow(COL_ID))
name = cursor.getString(cursor.getColumnIndexOrThrow(COL_NAME))
order = cursor.getInt(cursor.getColumnIndexOrThrow(COL_ORDER))
flags = cursor.getInt(cursor.getColumnIndexOrThrow(COL_FLAGS))
}
}

View File

@ -63,18 +63,18 @@ class ChapterPutResolver : DefaultPutResolver<Chapter>() {
class ChapterGetResolver : DefaultGetResolver<Chapter>() {
override fun mapFromCursor(cursor: Cursor): Chapter = ChapterImpl().apply {
id = cursor.getLong(cursor.getColumnIndex(COL_ID))
manga_id = cursor.getLong(cursor.getColumnIndex(COL_MANGA_ID))
url = cursor.getString(cursor.getColumnIndex(COL_URL))
name = cursor.getString(cursor.getColumnIndex(COL_NAME))
scanlator = cursor.getString(cursor.getColumnIndex(COL_SCANLATOR))
read = cursor.getInt(cursor.getColumnIndex(COL_READ)) == 1
bookmark = cursor.getInt(cursor.getColumnIndex(COL_BOOKMARK)) == 1
date_fetch = cursor.getLong(cursor.getColumnIndex(COL_DATE_FETCH))
date_upload = cursor.getLong(cursor.getColumnIndex(COL_DATE_UPLOAD))
last_page_read = cursor.getInt(cursor.getColumnIndex(COL_LAST_PAGE_READ))
chapter_number = cursor.getFloat(cursor.getColumnIndex(COL_CHAPTER_NUMBER))
source_order = cursor.getInt(cursor.getColumnIndex(COL_SOURCE_ORDER))
id = cursor.getLong(cursor.getColumnIndexOrThrow(COL_ID))
manga_id = cursor.getLong(cursor.getColumnIndexOrThrow(COL_MANGA_ID))
url = cursor.getString(cursor.getColumnIndexOrThrow(COL_URL))
name = cursor.getString(cursor.getColumnIndexOrThrow(COL_NAME))
scanlator = cursor.getString(cursor.getColumnIndexOrThrow(COL_SCANLATOR))
read = cursor.getInt(cursor.getColumnIndexOrThrow(COL_READ)) == 1
bookmark = cursor.getInt(cursor.getColumnIndexOrThrow(COL_BOOKMARK)) == 1
date_fetch = cursor.getLong(cursor.getColumnIndexOrThrow(COL_DATE_FETCH))
date_upload = cursor.getLong(cursor.getColumnIndexOrThrow(COL_DATE_UPLOAD))
last_page_read = cursor.getInt(cursor.getColumnIndexOrThrow(COL_LAST_PAGE_READ))
chapter_number = cursor.getFloat(cursor.getColumnIndexOrThrow(COL_CHAPTER_NUMBER))
source_order = cursor.getInt(cursor.getColumnIndexOrThrow(COL_SOURCE_ORDER))
}
}

View File

@ -47,10 +47,10 @@ open class HistoryPutResolver : DefaultPutResolver<History>() {
class HistoryGetResolver : DefaultGetResolver<History>() {
override fun mapFromCursor(cursor: Cursor): History = HistoryImpl().apply {
id = cursor.getLong(cursor.getColumnIndex(COL_ID))
chapter_id = cursor.getLong(cursor.getColumnIndex(COL_CHAPTER_ID))
last_read = cursor.getLong(cursor.getColumnIndex(COL_LAST_READ))
time_read = cursor.getLong(cursor.getColumnIndex(COL_TIME_READ))
id = cursor.getLong(cursor.getColumnIndexOrThrow(COL_ID))
chapter_id = cursor.getLong(cursor.getColumnIndexOrThrow(COL_CHAPTER_ID))
last_read = cursor.getLong(cursor.getColumnIndexOrThrow(COL_LAST_READ))
time_read = cursor.getLong(cursor.getColumnIndexOrThrow(COL_TIME_READ))
}
}

View File

@ -44,9 +44,9 @@ class MangaCategoryPutResolver : DefaultPutResolver<MangaCategory>() {
class MangaCategoryGetResolver : DefaultGetResolver<MangaCategory>() {
override fun mapFromCursor(cursor: Cursor): MangaCategory = MangaCategory().apply {
id = cursor.getLong(cursor.getColumnIndex(COL_ID))
manga_id = cursor.getLong(cursor.getColumnIndex(COL_MANGA_ID))
category_id = cursor.getInt(cursor.getColumnIndex(COL_CATEGORY_ID))
id = cursor.getLong(cursor.getColumnIndexOrThrow(COL_ID))
manga_id = cursor.getLong(cursor.getColumnIndexOrThrow(COL_MANGA_ID))
category_id = cursor.getInt(cursor.getColumnIndexOrThrow(COL_CATEGORY_ID))
}
}

View File

@ -22,7 +22,6 @@ import eu.kanade.tachiyomi.data.database.tables.MangaTable.COL_GENRE
import eu.kanade.tachiyomi.data.database.tables.MangaTable.COL_ID
import eu.kanade.tachiyomi.data.database.tables.MangaTable.COL_INITIALIZED
import eu.kanade.tachiyomi.data.database.tables.MangaTable.COL_LAST_UPDATE
import eu.kanade.tachiyomi.data.database.tables.MangaTable.COL_NEXT_UPDATE
import eu.kanade.tachiyomi.data.database.tables.MangaTable.COL_SOURCE
import eu.kanade.tachiyomi.data.database.tables.MangaTable.COL_STATUS
import eu.kanade.tachiyomi.data.database.tables.MangaTable.COL_THUMBNAIL_URL
@ -63,7 +62,6 @@ class MangaPutResolver : DefaultPutResolver<Manga>() {
COL_THUMBNAIL_URL to obj.thumbnail_url,
COL_FAVORITE to obj.favorite,
COL_LAST_UPDATE to obj.last_update,
COL_NEXT_UPDATE to obj.next_update,
COL_INITIALIZED to obj.initialized,
COL_VIEWER to obj.viewer_flags,
COL_CHAPTER_FLAGS to obj.chapter_flags,
@ -74,24 +72,23 @@ class MangaPutResolver : DefaultPutResolver<Manga>() {
interface BaseMangaGetResolver {
fun mapBaseFromCursor(manga: Manga, cursor: Cursor) = manga.apply {
id = cursor.getLong(cursor.getColumnIndex(COL_ID))
source = cursor.getLong(cursor.getColumnIndex(COL_SOURCE))
url = cursor.getString(cursor.getColumnIndex(COL_URL))
artist = cursor.getString(cursor.getColumnIndex(COL_ARTIST))
author = cursor.getString(cursor.getColumnIndex(COL_AUTHOR))
description = cursor.getString(cursor.getColumnIndex(COL_DESCRIPTION))
genre = cursor.getString(cursor.getColumnIndex(COL_GENRE))
title = cursor.getString(cursor.getColumnIndex(COL_TITLE))
status = cursor.getInt(cursor.getColumnIndex(COL_STATUS))
thumbnail_url = cursor.getString(cursor.getColumnIndex(COL_THUMBNAIL_URL))
favorite = cursor.getInt(cursor.getColumnIndex(COL_FAVORITE)) == 1
last_update = cursor.getLong(cursor.getColumnIndex(COL_LAST_UPDATE))
next_update = cursor.getLong(cursor.getColumnIndex(COL_NEXT_UPDATE))
initialized = cursor.getInt(cursor.getColumnIndex(COL_INITIALIZED)) == 1
viewer_flags = cursor.getInt(cursor.getColumnIndex(COL_VIEWER))
chapter_flags = cursor.getInt(cursor.getColumnIndex(COL_CHAPTER_FLAGS))
cover_last_modified = cursor.getLong(cursor.getColumnIndex(COL_COVER_LAST_MODIFIED))
date_added = cursor.getLong(cursor.getColumnIndex(COL_DATE_ADDED))
id = cursor.getLong(cursor.getColumnIndexOrThrow(COL_ID))
source = cursor.getLong(cursor.getColumnIndexOrThrow(COL_SOURCE))
url = cursor.getString(cursor.getColumnIndexOrThrow(COL_URL))
artist = cursor.getString(cursor.getColumnIndexOrThrow(COL_ARTIST))
author = cursor.getString(cursor.getColumnIndexOrThrow(COL_AUTHOR))
description = cursor.getString(cursor.getColumnIndexOrThrow(COL_DESCRIPTION))
genre = cursor.getString(cursor.getColumnIndexOrThrow(COL_GENRE))
title = cursor.getString(cursor.getColumnIndexOrThrow(COL_TITLE))
status = cursor.getInt(cursor.getColumnIndexOrThrow(COL_STATUS))
thumbnail_url = cursor.getString(cursor.getColumnIndexOrThrow(COL_THUMBNAIL_URL))
favorite = cursor.getInt(cursor.getColumnIndexOrThrow(COL_FAVORITE)) == 1
last_update = cursor.getLong(cursor.getColumnIndexOrThrow(COL_LAST_UPDATE))
initialized = cursor.getInt(cursor.getColumnIndexOrThrow(COL_INITIALIZED)) == 1
viewer_flags = cursor.getInt(cursor.getColumnIndexOrThrow(COL_VIEWER))
chapter_flags = cursor.getInt(cursor.getColumnIndexOrThrow(COL_CHAPTER_FLAGS))
cover_last_modified = cursor.getLong(cursor.getColumnIndexOrThrow(COL_COVER_LAST_MODIFIED))
date_added = cursor.getLong(cursor.getColumnIndexOrThrow(COL_DATE_ADDED))
}
}

View File

@ -65,19 +65,19 @@ class TrackPutResolver : DefaultPutResolver<Track>() {
class TrackGetResolver : DefaultGetResolver<Track>() {
override fun mapFromCursor(cursor: Cursor): Track = TrackImpl().apply {
id = cursor.getLong(cursor.getColumnIndex(COL_ID))
manga_id = cursor.getLong(cursor.getColumnIndex(COL_MANGA_ID))
sync_id = cursor.getInt(cursor.getColumnIndex(COL_SYNC_ID))
media_id = cursor.getInt(cursor.getColumnIndex(COL_MEDIA_ID))
library_id = cursor.getLong(cursor.getColumnIndex(COL_LIBRARY_ID))
title = cursor.getString(cursor.getColumnIndex(COL_TITLE))
last_chapter_read = cursor.getFloat(cursor.getColumnIndex(COL_LAST_CHAPTER_READ))
total_chapters = cursor.getInt(cursor.getColumnIndex(COL_TOTAL_CHAPTERS))
status = cursor.getInt(cursor.getColumnIndex(COL_STATUS))
score = cursor.getFloat(cursor.getColumnIndex(COL_SCORE))
tracking_url = cursor.getString(cursor.getColumnIndex(COL_TRACKING_URL))
started_reading_date = cursor.getLong(cursor.getColumnIndex(COL_START_DATE))
finished_reading_date = cursor.getLong(cursor.getColumnIndex(COL_FINISH_DATE))
id = cursor.getLong(cursor.getColumnIndexOrThrow(COL_ID))
manga_id = cursor.getLong(cursor.getColumnIndexOrThrow(COL_MANGA_ID))
sync_id = cursor.getInt(cursor.getColumnIndexOrThrow(COL_SYNC_ID))
media_id = cursor.getInt(cursor.getColumnIndexOrThrow(COL_MEDIA_ID))
library_id = cursor.getLong(cursor.getColumnIndexOrThrow(COL_LIBRARY_ID))
title = cursor.getString(cursor.getColumnIndexOrThrow(COL_TITLE))
last_chapter_read = cursor.getFloat(cursor.getColumnIndexOrThrow(COL_LAST_CHAPTER_READ))
total_chapters = cursor.getInt(cursor.getColumnIndexOrThrow(COL_TOTAL_CHAPTERS))
status = cursor.getInt(cursor.getColumnIndexOrThrow(COL_STATUS))
score = cursor.getFloat(cursor.getColumnIndexOrThrow(COL_SCORE))
tracking_url = cursor.getString(cursor.getColumnIndexOrThrow(COL_TRACKING_URL))
started_reading_date = cursor.getLong(cursor.getColumnIndexOrThrow(COL_START_DATE))
finished_reading_date = cursor.getLong(cursor.getColumnIndexOrThrow(COL_FINISH_DATE))
}
}

View File

@ -16,9 +16,6 @@ interface Manga : SManga {
// last time the chapter list changed in any way
var last_update: Long
// predicted next update time based on latest (by date) 4 chapters' deltas
var next_update: Long
var date_added: Long
var viewer_flags: Int
@ -36,7 +33,8 @@ interface Manga : SManga {
}
fun getGenres(): List<String>? {
return genre?.split(", ")?.map { it.trim() }
if (genre.isNullOrBlank()) return null
return genre?.split(", ")?.map { it.trim() }?.filterNot { it.isBlank() }?.distinct()
}
private fun setChapterFlags(flag: Int, mask: Int) {

View File

@ -26,8 +26,6 @@ open class MangaImpl : Manga {
override var last_update: Long = 0
override var next_update: Long = 0
override var date_added: Long = 0
override var initialized: Boolean = false

View File

@ -0,0 +1,3 @@
package eu.kanade.tachiyomi.data.database.models
data class SourceIdMangaCount(val source: Long, val count: Int)

View File

@ -1,5 +1,6 @@
package eu.kanade.tachiyomi.data.database.queries
import com.pushtorefresh.storio.Queries
import com.pushtorefresh.storio.sqlite.operations.get.PreparedGetListOfObjects
import com.pushtorefresh.storio.sqlite.queries.DeleteQuery
import com.pushtorefresh.storio.sqlite.queries.Query
@ -7,13 +8,14 @@ import com.pushtorefresh.storio.sqlite.queries.RawQuery
import eu.kanade.tachiyomi.data.database.DbProvider
import eu.kanade.tachiyomi.data.database.models.LibraryManga
import eu.kanade.tachiyomi.data.database.models.Manga
import eu.kanade.tachiyomi.data.database.models.SourceIdMangaCount
import eu.kanade.tachiyomi.data.database.resolvers.LibraryMangaGetResolver
import eu.kanade.tachiyomi.data.database.resolvers.MangaCoverLastModifiedPutResolver
import eu.kanade.tachiyomi.data.database.resolvers.MangaFavoritePutResolver
import eu.kanade.tachiyomi.data.database.resolvers.MangaFlagsPutResolver
import eu.kanade.tachiyomi.data.database.resolvers.MangaLastUpdatedPutResolver
import eu.kanade.tachiyomi.data.database.resolvers.MangaNextUpdatedPutResolver
import eu.kanade.tachiyomi.data.database.resolvers.MangaTitlePutResolver
import eu.kanade.tachiyomi.data.database.resolvers.SourceIdMangaCountGetResolver
import eu.kanade.tachiyomi.data.database.tables.CategoryTable
import eu.kanade.tachiyomi.data.database.tables.ChapterTable
import eu.kanade.tachiyomi.data.database.tables.MangaCategoryTable
@ -70,6 +72,17 @@ interface MangaQueries : DbProvider {
)
.prepare()
fun getSourceIdsWithNonLibraryManga() = db.get()
.listOfObjects(SourceIdMangaCount::class.java)
.withQuery(
RawQuery.builder()
.query(getSourceIdsWithNonLibraryMangaQuery())
.observesTables(MangaTable.TABLE)
.build()
)
.withGetResolver(SourceIdMangaCountGetResolver.INSTANCE)
.prepare()
fun insertManga(manga: Manga) = db.put().`object`(manga).prepare()
fun insertMangas(mangas: List<Manga>) = db.put().objects(mangas).prepare()
@ -94,11 +107,6 @@ interface MangaQueries : DbProvider {
.withPutResolver(MangaFlagsPutResolver(MangaTable.COL_VIEWER, Manga::viewer_flags))
.prepare()
fun updateNextUpdated(manga: Manga) = db.put()
.`object`(manga)
.withPutResolver(MangaNextUpdatedPutResolver())
.prepare()
fun updateLastUpdated(manga: Manga) = db.put()
.`object`(manga)
.withPutResolver(MangaLastUpdatedPutResolver())
@ -123,12 +131,12 @@ interface MangaQueries : DbProvider {
fun deleteMangas(mangas: List<Manga>) = db.delete().objects(mangas).prepare()
fun deleteMangasNotInLibrary() = db.delete()
fun deleteMangasNotInLibraryBySourceIds(sourceIds: List<Long>) = db.delete()
.byQuery(
DeleteQuery.builder()
.table(MangaTable.TABLE)
.where("${MangaTable.COL_FAVORITE} = ?")
.whereArgs(0)
.where("${MangaTable.COL_FAVORITE} = ? AND ${MangaTable.COL_SOURCE} IN (${Queries.placeholders(sourceIds.size)})")
.whereArgs(0, *sourceIds.toTypedArray())
.build()
)
.prepare()

View File

@ -1,5 +1,6 @@
package eu.kanade.tachiyomi.data.database.queries
import eu.kanade.tachiyomi.data.database.resolvers.SourceIdMangaCountGetResolver
import eu.kanade.tachiyomi.data.database.tables.CategoryTable as Category
import eu.kanade.tachiyomi.data.database.tables.ChapterTable as Chapter
import eu.kanade.tachiyomi.data.database.tables.HistoryTable as History
@ -142,3 +143,14 @@ fun getCategoriesForMangaQuery() =
${MangaCategory.TABLE}.${MangaCategory.COL_CATEGORY_ID}
WHERE ${MangaCategory.COL_MANGA_ID} = ?
"""
/** Query to get the list of sources in the database that have
* non-library manga, and how many
*/
fun getSourceIdsWithNonLibraryMangaQuery() =
"""
SELECT ${Manga.COL_SOURCE}, COUNT(*) as ${SourceIdMangaCountGetResolver.COL_COUNT}
FROM ${Manga.TABLE}
WHERE ${Manga.COL_FAVORITE} = 0
GROUP BY ${Manga.COL_SOURCE}
"""

View File

@ -16,8 +16,8 @@ class LibraryMangaGetResolver : DefaultGetResolver<LibraryManga>(), BaseMangaGet
val manga = LibraryManga()
mapBaseFromCursor(manga, cursor)
manga.unread = cursor.getInt(cursor.getColumnIndex(MangaTable.COL_UNREAD))
manga.category = cursor.getInt(cursor.getColumnIndex(MangaTable.COL_CATEGORY))
manga.unread = cursor.getInt(cursor.getColumnIndexOrThrow(MangaTable.COL_UNREAD))
manga.category = cursor.getInt(cursor.getColumnIndexOrThrow(MangaTable.COL_CATEGORY))
return manga
}

View File

@ -20,7 +20,7 @@ class MangaChapterGetResolver : DefaultGetResolver<MangaChapter>() {
val manga = mangaGetResolver.mapFromCursor(cursor)
val chapter = chapterGetResolver.mapFromCursor(cursor)
manga.id = chapter.manga_id
manga.url = cursor.getString(cursor.getColumnIndex("mangaUrl"))
manga.url = cursor.getString(cursor.getColumnIndexOrThrow("mangaUrl"))
return MangaChapter(manga, chapter)
}

View File

@ -42,7 +42,7 @@ class MangaChapterHistoryGetResolver : DefaultGetResolver<MangaChapterHistory>()
// Make certain column conflicts are dealt with
manga.id = chapter.manga_id
manga.url = cursor.getString(cursor.getColumnIndex("mangaUrl"))
manga.url = cursor.getString(cursor.getColumnIndexOrThrow("mangaUrl"))
chapter.id = history.chapter_id
// Return result

View File

@ -1,31 +0,0 @@
package eu.kanade.tachiyomi.data.database.resolvers
import androidx.core.content.contentValuesOf
import com.pushtorefresh.storio.sqlite.StorIOSQLite
import com.pushtorefresh.storio.sqlite.operations.put.PutResolver
import com.pushtorefresh.storio.sqlite.operations.put.PutResult
import com.pushtorefresh.storio.sqlite.queries.UpdateQuery
import eu.kanade.tachiyomi.data.database.inTransactionReturn
import eu.kanade.tachiyomi.data.database.models.Manga
import eu.kanade.tachiyomi.data.database.tables.MangaTable
class MangaNextUpdatedPutResolver : PutResolver<Manga>() {
override fun performPut(db: StorIOSQLite, manga: Manga) = db.inTransactionReturn {
val updateQuery = mapToUpdateQuery(manga)
val contentValues = mapToContentValues(manga)
val numberOfRowsUpdated = db.lowLevel().update(updateQuery, contentValues)
PutResult.newUpdateResult(numberOfRowsUpdated, updateQuery.table())
}
fun mapToUpdateQuery(manga: Manga) = UpdateQuery.builder()
.table(MangaTable.TABLE)
.where("${MangaTable.COL_ID} = ?")
.whereArgs(manga.id)
.build()
fun mapToContentValues(manga: Manga) = contentValuesOf(
MangaTable.COL_NEXT_UPDATE to manga.next_update
)
}

View File

@ -0,0 +1,23 @@
package eu.kanade.tachiyomi.data.database.resolvers
import android.annotation.SuppressLint
import android.database.Cursor
import com.pushtorefresh.storio.sqlite.operations.get.DefaultGetResolver
import eu.kanade.tachiyomi.data.database.models.SourceIdMangaCount
import eu.kanade.tachiyomi.data.database.tables.MangaTable
class SourceIdMangaCountGetResolver : DefaultGetResolver<SourceIdMangaCount>() {
companion object {
val INSTANCE = SourceIdMangaCountGetResolver()
const val COL_COUNT = "manga_count"
}
@SuppressLint("Range")
override fun mapFromCursor(cursor: Cursor): SourceIdMangaCount {
val sourceID = cursor.getLong(cursor.getColumnIndexOrThrow(MangaTable.COL_SOURCE))
val count = cursor.getInt(cursor.getColumnIndexOrThrow(COL_COUNT))
return SourceIdMangaCount(sourceID, count)
}
}

View File

@ -62,4 +62,7 @@ object ChapterTable {
val addScanlator: String
get() = "ALTER TABLE $TABLE ADD COLUMN $COL_SCANLATOR TEXT DEFAULT NULL"
val fixDateUploadIfNeeded: String
get() = "UPDATE $TABLE SET $COL_DATE_UPLOAD = $COL_DATE_FETCH WHERE $COL_DATE_UPLOAD = 0"
}

View File

@ -28,6 +28,7 @@ object MangaTable {
const val COL_LAST_UPDATE = "last_update"
// Not actually used anymore
const val COL_NEXT_UPDATE = "next_update"
const val COL_DATE_ADDED = "date_added"

View File

@ -143,7 +143,7 @@ class DownloadCache(
mangaDirs.values.forEach { mangaDir ->
val chapterDirs = mangaDir.dir.listFiles()
.orEmpty()
.mapNotNull { it.name }
.mapNotNull { it.name?.replace(".cbz", "") }
.toHashSet()
mangaDir.files = chapterDirs

View File

@ -14,8 +14,9 @@ import eu.kanade.tachiyomi.source.Source
import eu.kanade.tachiyomi.source.SourceManager
import eu.kanade.tachiyomi.source.model.Page
import eu.kanade.tachiyomi.util.lang.launchIO
import eu.kanade.tachiyomi.util.system.logcat
import logcat.LogPriority
import rx.Observable
import timber.log.Timber
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
import uy.kohesive.injekt.injectLazy
@ -38,7 +39,7 @@ class DownloadManager(
/**
* Downloads provider, used to retrieve the folders where the chapters are or should be stored.
*/
private val provider = DownloadProvider(context)
val provider = DownloadProvider(context)
/**
* Cache of downloaded chapters.
@ -326,19 +327,23 @@ class DownloadManager(
*/
fun renameChapter(source: Source, manga: Manga, oldChapter: Chapter, newChapter: Chapter) {
val oldNames = provider.getValidChapterDirNames(oldChapter)
val newName = provider.getChapterDirName(newChapter)
val mangaDir = provider.getMangaDir(manga, source)
// Assume there's only 1 version of the chapter name formats present
val oldFolder = oldNames.asSequence()
val oldDownload = oldNames.asSequence()
.mapNotNull { mangaDir.findFile(it) }
.firstOrNull()
.firstOrNull() ?: return
if (oldFolder?.renameTo(newName) == true) {
var newName = provider.getChapterDirName(newChapter)
if (oldDownload.isFile && oldDownload.name?.endsWith(".cbz") == true) {
newName += ".cbz"
}
if (oldDownload.renameTo(newName)) {
cache.removeChapter(oldChapter, manga)
cache.addChapter(newName, mangaDir, manga)
} else {
Timber.e("Could not rename downloaded chapter: %s.", oldNames.joinToString())
logcat(LogPriority.ERROR) { "Could not rename downloaded chapter: ${oldNames.joinToString()}." }
}
}

View File

@ -105,6 +105,7 @@ internal class DownloadNotifier(private val context: Context) {
if (preferences.hideNotificationContent()) {
setContentTitle(downloadingProgressText)
setContentText(null)
} else {
val title = download.manga.title.chop(15)
val quotedTitle = Pattern.quote(title)
@ -187,8 +188,8 @@ internal class DownloadNotifier(private val context: Context) {
fun onWarning(reason: String) {
with(errorNotificationBuilder) {
setContentTitle(context.getString(R.string.download_notifier_downloader_title))
setContentText(reason)
setSmallIcon(android.R.drawable.stat_sys_warning)
setStyle(NotificationCompat.BigTextStyle().bigText(reason))
setSmallIcon(R.drawable.ic_warning_white_24dp)
setAutoCancel(true)
clearActions()
setContentIntent(NotificationHandler.openDownloadManagerPendingActivity(context))
@ -208,15 +209,14 @@ internal class DownloadNotifier(private val context: Context) {
* @param error string containing error information.
* @param chapter string containing chapter title.
*/
fun onError(error: String? = null, chapter: String? = null) {
fun onError(error: String? = null, chapter: String? = null, mangaTitle: String? = null) {
// Create notification
with(errorNotificationBuilder) {
setContentTitle(
chapter
?: context.getString(R.string.download_notifier_downloader_title)
mangaTitle?.plus(": $chapter") ?: context.getString(R.string.download_notifier_downloader_title)
)
setContentText(error ?: context.getString(R.string.download_notifier_unknown_error))
setSmallIcon(android.R.drawable.stat_sys_warning)
setSmallIcon(R.drawable.ic_warning_white_24dp)
clearActions()
setContentIntent(NotificationHandler.openDownloadManagerPendingActivity(context))
setProgress(0, 0, false)

View File

@ -9,10 +9,11 @@ import eu.kanade.tachiyomi.data.database.models.Manga
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
import eu.kanade.tachiyomi.source.Source
import eu.kanade.tachiyomi.util.storage.DiskUtil
import eu.kanade.tachiyomi.util.system.logcat
import kotlinx.coroutines.MainScope
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
import timber.log.Timber
import logcat.LogPriority
import uy.kohesive.injekt.injectLazy
/**
@ -54,7 +55,7 @@ class DownloadProvider(private val context: Context) {
.createDirectory(getSourceDirName(source))
.createDirectory(getMangaDirName(manga))
} catch (e: Throwable) {
Timber.e(e, "Invalid download directory")
logcat(LogPriority.ERROR, e) { "Invalid download directory" }
throw Exception(context.getString(R.string.invalid_download_dir))
}
}
@ -147,10 +148,14 @@ class DownloadProvider(private val context: Context) {
* @param chapter the chapter to query.
*/
fun getValidChapterDirNames(chapter: Chapter): List<String> {
val chapterName = getChapterDirName(chapter)
return listOf(
getChapterDirName(chapter),
// Folder of images
chapterName,
// Archived chapters
"$chapterName.cbz",
// TODO: remove this
// Legacy chapter directory name used in v0.9.2 and before
DiskUtil.buildValidFilename(chapter.name)
)

View File

@ -15,11 +15,12 @@ import eu.kanade.tachiyomi.data.preference.PreferencesHelper
import eu.kanade.tachiyomi.util.lang.plusAssign
import eu.kanade.tachiyomi.util.lang.withUIContext
import eu.kanade.tachiyomi.util.system.acquireWakeLock
import eu.kanade.tachiyomi.util.system.isConnectedToWifi
import eu.kanade.tachiyomi.util.system.isOnline
import eu.kanade.tachiyomi.util.system.isServiceRunning
import eu.kanade.tachiyomi.util.system.logcat
import eu.kanade.tachiyomi.util.system.notification
import eu.kanade.tachiyomi.util.system.toast
import eu.kanade.tachiyomi.util.system.wifiManager
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.SupervisorJob
@ -27,6 +28,7 @@ import kotlinx.coroutines.cancel
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
import logcat.LogPriority
import ru.beryukhov.reactivenetwork.ReactiveNetwork
import rx.subscriptions.CompositeSubscription
import uy.kohesive.injekt.injectLazy
@ -140,8 +142,9 @@ class DownloadService : Service() {
onNetworkStateChanged()
}
}
.catch {
.catch { error ->
withUIContext {
logcat(LogPriority.ERROR, error)
toast(R.string.download_queue_error)
stopSelf()
}
@ -154,7 +157,7 @@ class DownloadService : Service() {
*/
private fun onNetworkStateChanged() {
if (isOnline()) {
if (preferences.downloadOnlyOverWifi() && !wifiManager.isWifiEnabled) {
if (preferences.downloadOnlyOverWifi() && !isConnectedToWifi()) {
stopDownloads(R.string.download_notifier_text_only_wifi)
} else {
val started = downloadManager.startDownloads()
@ -173,13 +176,15 @@ class DownloadService : Service() {
* Listens to downloader status. Enables or disables the wake lock depending on the status.
*/
private fun listenDownloaderState() {
subscriptions += downloadManager.runningRelay.subscribe { running ->
if (running) {
wakeLock.acquireIfNeeded()
} else {
wakeLock.releaseIfNeeded()
subscriptions += downloadManager.runningRelay
.doOnError { /* Swallow wakelock error */ }
.subscribe { running ->
if (running) {
wakeLock.acquireIfNeeded()
} else {
wakeLock.releaseIfNeeded()
}
}
}
}
/**

View File

@ -11,7 +11,9 @@ import eu.kanade.tachiyomi.data.database.models.Chapter
import eu.kanade.tachiyomi.data.database.models.Manga
import eu.kanade.tachiyomi.data.download.model.Download
import eu.kanade.tachiyomi.data.download.model.DownloadQueue
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
import eu.kanade.tachiyomi.source.SourceManager
import eu.kanade.tachiyomi.source.UnmeteredSource
import eu.kanade.tachiyomi.source.model.Page
import eu.kanade.tachiyomi.source.online.HttpSource
import eu.kanade.tachiyomi.source.online.fetchAllImageUrlsFromPageList
@ -22,15 +24,20 @@ import eu.kanade.tachiyomi.util.lang.plusAssign
import eu.kanade.tachiyomi.util.storage.DiskUtil
import eu.kanade.tachiyomi.util.storage.saveTo
import eu.kanade.tachiyomi.util.system.ImageUtil
import eu.kanade.tachiyomi.util.system.logcat
import kotlinx.coroutines.async
import logcat.LogPriority
import okhttp3.Response
import rx.Observable
import rx.android.schedulers.AndroidSchedulers
import rx.schedulers.Schedulers
import rx.subscriptions.CompositeSubscription
import timber.log.Timber
import uy.kohesive.injekt.injectLazy
import java.io.BufferedOutputStream
import java.io.File
import java.util.zip.CRC32
import java.util.zip.ZipEntry
import java.util.zip.ZipOutputStream
/**
* This class is the one in charge of downloading chapters.
@ -55,6 +62,8 @@ class Downloader(
private val chapterCache: ChapterCache by injectLazy()
private val preferences: PreferencesHelper by injectLazy()
/**
* Store for persisting downloads across restarts.
*/
@ -209,7 +218,7 @@ class Downloader(
},
{ error ->
DownloadService.stop(context)
Timber.e(error)
logcat(LogPriority.ERROR, error)
notifier.onError(error.message)
}
)
@ -262,7 +271,17 @@ class Downloader(
// Start downloader if needed
if (autoStart && wasEmpty) {
DownloadService.start(this@Downloader.context)
val maxDownloadsFromSource = queue
.groupBy { it.source }
.filterKeys { it !is UnmeteredSource }
.maxOf { it.value.size }
// TODO: re-enable warning
if (maxDownloadsFromSource > CHAPTERS_PER_SOURCE_QUEUE_WARNING_THRESHOLD) {
// withUIContext {
// context.toast(R.string.download_queue_size_warning, Toast.LENGTH_LONG)
// }
}
DownloadService.start(context)
}
}
}
@ -278,7 +297,7 @@ class Downloader(
val availSpace = DiskUtil.getAvailableStorageSpace(mangaDir)
if (availSpace != -1L && availSpace < MIN_DISK_SPACE) {
download.status = Download.State.ERROR
notifier.onError(context.getString(R.string.download_insufficient_space), download.chapter.name)
notifier.onError(context.getString(R.string.download_insufficient_space), download.chapter.name, download.manga.title)
return@defer Observable.just(download)
}
@ -324,7 +343,7 @@ class Downloader(
// If the page list threw, it will resume here
.onErrorReturn { error ->
download.status = Download.State.ERROR
notifier.onError(error.message, download.chapter.name)
notifier.onError(error.message, download.chapter.name, download.manga.title)
download
}
}
@ -470,13 +489,51 @@ class Downloader(
// Only rename the directory if it's downloaded.
if (download.status == Download.State.DOWNLOADED) {
tmpDir.renameTo(dirname)
if (preferences.saveChaptersAsCBZ().get()) {
archiveChapter(mangaDir, dirname, tmpDir)
} else {
tmpDir.renameTo(dirname)
}
cache.addChapter(dirname, mangaDir, download.manga)
DiskUtil.createNoMediaFile(tmpDir, context)
}
}
/**
* Archive the chapter pages as a CBZ.
*/
private fun archiveChapter(
mangaDir: UniFile,
dirname: String,
tmpDir: UniFile,
) {
val zip = mangaDir.createFile("$dirname.cbz.tmp")
ZipOutputStream(BufferedOutputStream(zip.openOutputStream())).use { zipOut ->
zipOut.setMethod(ZipEntry.STORED)
tmpDir.listFiles()?.forEach { img ->
img.openInputStream().use { input ->
val data = input.readBytes()
val size = img.length()
val entry = ZipEntry(img.name).apply {
val crc = CRC32().apply {
update(data)
}
setCrc(crc.value)
compressedSize = size
setSize(size)
}
zipOut.putNextEntry(entry)
zipOut.write(data)
}
}
}
zip.renameTo("$dirname.cbz")
tmpDir.delete()
}
/**
* Completes a download. This method is called in the main thread.
*/
@ -500,8 +557,9 @@ class Downloader(
companion object {
const val TMP_DIR_SUFFIX = "_tmp"
// Arbitrary minimum required space to start a download: 50 MB
const val MIN_DISK_SPACE = 50 * 1024 * 1024
const val CHAPTERS_PER_SOURCE_QUEUE_WARNING_THRESHOLD = 15
}
}
// Arbitrary minimum required space to start a download: 50 MB
private const val MIN_DISK_SPACE = 50 * 1024 * 1024

View File

@ -8,9 +8,10 @@ import androidx.work.PeriodicWorkRequestBuilder
import androidx.work.WorkManager
import androidx.work.Worker
import androidx.work.WorkerParameters
import eu.kanade.tachiyomi.data.preference.CHARGING
import eu.kanade.tachiyomi.data.preference.DEVICE_CHARGING
import eu.kanade.tachiyomi.data.preference.DEVICE_ONLY_ON_WIFI
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
import eu.kanade.tachiyomi.data.preference.UNMETERED_NETWORK
import eu.kanade.tachiyomi.util.system.isConnectedToWifi
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
import java.util.concurrent.TimeUnit
@ -19,6 +20,11 @@ class LibraryUpdateJob(private val context: Context, workerParams: WorkerParamet
Worker(context, workerParams) {
override fun doWork(): Result {
val preferences = Injekt.get<PreferencesHelper>()
if (requiresWifiConnection(preferences) && !context.isConnectedToWifi()) {
Result.failure()
}
return if (LibraryUpdateService.start(context)) {
Result.success()
} else {
@ -33,17 +39,10 @@ class LibraryUpdateJob(private val context: Context, workerParams: WorkerParamet
val preferences = Injekt.get<PreferencesHelper>()
val interval = prefInterval ?: preferences.libraryUpdateInterval().get()
if (interval > 0) {
val restrictions = preferences.libraryUpdateRestriction().get()
val acRestriction = CHARGING in restrictions
val wifiRestriction = if (UNMETERED_NETWORK in restrictions) {
NetworkType.UNMETERED
} else {
NetworkType.CONNECTED
}
val restrictions = preferences.libraryUpdateDeviceRestriction().get()
val constraints = Constraints.Builder()
.setRequiredNetworkType(wifiRestriction)
.setRequiresCharging(acRestriction)
.setRequiredNetworkType(NetworkType.CONNECTED)
.setRequiresCharging(DEVICE_CHARGING in restrictions)
.build()
val request = PeriodicWorkRequestBuilder<LibraryUpdateJob>(
@ -61,5 +60,10 @@ class LibraryUpdateJob(private val context: Context, workerParams: WorkerParamet
WorkManager.getInstance(context).cancelAllWorkByTag(TAG)
}
}
fun requiresWifiConnection(preferences: PreferencesHelper): Boolean {
val restrictions = preferences.libraryUpdateDeviceRestriction().get()
return DEVICE_ONLY_ON_WIFI in restrictions
}
}
}

View File

@ -16,6 +16,7 @@ import coil.transform.CircleCropTransformation
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.database.models.Chapter
import eu.kanade.tachiyomi.data.database.models.Manga
import eu.kanade.tachiyomi.data.download.Downloader
import eu.kanade.tachiyomi.data.notification.NotificationReceiver
import eu.kanade.tachiyomi.data.notification.Notifications
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
@ -51,7 +52,7 @@ class LibraryUpdateNotifier(private val context: Context) {
* Cached progress notification to avoid creating a lot.
*/
val progressNotificationBuilder by lazy {
context.notificationBuilder(Notifications.CHANNEL_LIBRARY) {
context.notificationBuilder(Notifications.CHANNEL_LIBRARY_PROGRESS) {
setContentTitle(context.getString(R.string.app_name))
setSmallIcon(R.drawable.ic_refresh_24dp)
setLargeIcon(notificationBitmap)
@ -101,25 +102,12 @@ class LibraryUpdateNotifier(private val context: Context) {
context.notificationManager.notify(
Notifications.ID_LIBRARY_ERROR,
context.notificationBuilder(Notifications.CHANNEL_LIBRARY) {
context.notificationBuilder(Notifications.CHANNEL_LIBRARY_ERROR) {
setContentTitle(context.resources.getQuantityString(R.plurals.notification_update_error, errors.size, errors.size))
setStyle(
NotificationCompat.BigTextStyle().bigText(
errors.joinToString("\n") {
it.chop(NOTIF_TITLE_MAX_LEN)
}
)
)
setContentText(context.getString(R.string.action_show_errors))
setSmallIcon(R.drawable.ic_tachi)
val errorLogIntent = NotificationReceiver.openErrorLogPendingActivity(context, uri)
setContentIntent(errorLogIntent)
addAction(
R.drawable.ic_folder_24dp,
context.getString(R.string.action_show_errors),
errorLogIntent
)
setContentIntent(NotificationReceiver.openErrorLogPendingActivity(context, uri))
}
.build()
)
@ -225,6 +213,20 @@ class LibraryUpdateNotifier(private val context: Context) {
Notifications.ID_NEW_CHAPTERS
)
)
// Download chapters action
// Only add the action when chapters is within threshold
if (chapters.size <= Downloader.CHAPTERS_PER_SOURCE_QUEUE_WARNING_THRESHOLD) {
addAction(
android.R.drawable.stat_sys_download_done,
context.getString(R.string.action_download),
NotificationReceiver.downloadChaptersPendingBroadcast(
context,
manga,
chapters,
Notifications.ID_NEW_CHAPTERS
)
)
}
}
}

View File

@ -1,58 +0,0 @@
package eu.kanade.tachiyomi.data.library
import eu.kanade.tachiyomi.data.database.models.Manga
import java.util.Collections
import kotlin.math.abs
/**
* This class will provide various functions to rank manga to efficiently schedule manga to update.
*/
object LibraryUpdateRanker {
val rankingScheme = listOf(
(this::lexicographicRanking)(),
(this::latestFirstRanking)(),
(this::nextFirstRanking)()
)
/**
* Provides a total ordering over all the Mangas.
*
* Orders the manga based on the distance between the next expected update and now.
* The comparator is reversed, placing the smallest (and thus closest to updating now) first.
*/
fun nextFirstRanking(): Comparator<Manga> {
val time = System.currentTimeMillis()
return Collections.reverseOrder(
Comparator { mangaFirst: Manga,
mangaSecond: Manga ->
compareValues(abs(mangaSecond.next_update - time), abs(mangaFirst.next_update - time))
}
)
}
/**
* Provides a total ordering over all the [Manga]s.
*
* Assumption: An active [Manga] mActive is expected to have been last updated after an
* inactive [Manga] mInactive.
*
* Using this insight, function returns a Comparator for which mActive appears before mInactive.
* @return a Comparator that ranks manga based on relevance.
*/
private fun latestFirstRanking(): Comparator<Manga> =
Comparator { first: Manga, second: Manga ->
compareValues(second.last_update, first.last_update)
}
/**
* Provides a total ordering over all the [Manga]s.
*
* Order the manga lexicographically.
* @return a Comparator that ranks manga lexicographically based on the title.
*/
private fun lexicographicRanking(): Comparator<Manga> =
Comparator { first: Manga, second: Manga ->
compareValues(first.title, second.title)
}
}

View File

@ -16,14 +16,16 @@ import eu.kanade.tachiyomi.data.database.models.Manga
import eu.kanade.tachiyomi.data.database.models.toMangaInfo
import eu.kanade.tachiyomi.data.download.DownloadManager
import eu.kanade.tachiyomi.data.download.DownloadService
import eu.kanade.tachiyomi.data.library.LibraryUpdateRanker.rankingScheme
import eu.kanade.tachiyomi.data.library.LibraryUpdateService.Companion.start
import eu.kanade.tachiyomi.data.notification.Notifications
import eu.kanade.tachiyomi.data.preference.MANGA_FULLY_READ
import eu.kanade.tachiyomi.data.preference.MANGA_ONGOING
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
import eu.kanade.tachiyomi.data.track.EnhancedTrackService
import eu.kanade.tachiyomi.data.track.TrackManager
import eu.kanade.tachiyomi.data.track.TrackService
import eu.kanade.tachiyomi.source.SourceManager
import eu.kanade.tachiyomi.source.UnmeteredSource
import eu.kanade.tachiyomi.source.model.SManga
import eu.kanade.tachiyomi.source.model.toSChapter
import eu.kanade.tachiyomi.source.model.toSManga
@ -37,10 +39,10 @@ import eu.kanade.tachiyomi.util.storage.getUriCompat
import eu.kanade.tachiyomi.util.system.acquireWakeLock
import eu.kanade.tachiyomi.util.system.createFileInCacheDir
import eu.kanade.tachiyomi.util.system.isServiceRunning
import eu.kanade.tachiyomi.util.system.logcat
import kotlinx.coroutines.CoroutineExceptionHandler
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.Job
import kotlinx.coroutines.SupervisorJob
import kotlinx.coroutines.async
@ -50,7 +52,7 @@ import kotlinx.coroutines.launch
import kotlinx.coroutines.supervisorScope
import kotlinx.coroutines.sync.Semaphore
import kotlinx.coroutines.sync.withPermit
import timber.log.Timber
import logcat.LogPriority
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
import java.io.File
@ -212,7 +214,7 @@ class LibraryUpdateService(
// Destroy service when completed or in case of an error.
val handler = CoroutineExceptionHandler { _, exception ->
Timber.e(exception)
logcat(LogPriority.ERROR, exception)
stopSelf(startId)
}
updateJob = ioScope.launch(handler) {
@ -255,14 +257,30 @@ class LibraryUpdateService(
listToInclude.minus(listToExclude)
}
if (target == Target.CHAPTERS && preferences.updateOnlyNonCompleted()) {
listToUpdate = listToUpdate.filterNot { it.status == SManga.COMPLETED }
if (target == Target.CHAPTERS) {
val restrictions = preferences.libraryUpdateMangaRestriction().get()
if (MANGA_ONGOING in restrictions) {
listToUpdate = listToUpdate.filterNot { it.status == SManga.COMPLETED }
}
if (MANGA_FULLY_READ in restrictions) {
listToUpdate = listToUpdate.filter { it.unread == 0 }
}
}
val selectedScheme = preferences.libraryUpdatePrioritization().get()
mangaToUpdate = listToUpdate
.distinctBy { it.id }
.sortedWith(rankingScheme[selectedScheme])
.sortedBy { it.title }
// Warn when excessively checking a single source
val maxUpdatesFromSource = mangaToUpdate
.groupBy { it.source }
.filterKeys { sourceManager.get(it) !is UnmeteredSource }
.maxOfOrNull { it.value.size } ?: 0
// TODO: re-enable warning
if (maxUpdatesFromSource > MANGA_PER_SOURCE_QUEUE_WARNING_THRESHOLD) {
// toast(R.string.notification_size_warning, Toast.LENGTH_LONG)
}
}
/**
@ -282,6 +300,7 @@ class LibraryUpdateService(
val failedUpdates = CopyOnWriteArrayList<Pair<Manga, String?>>()
val hasDownloads = AtomicBoolean(false)
val loggedServices by lazy { trackManager.services.filter { it.isLogged } }
val currentUnreadUpdatesCount = preferences.unreadUpdatesCount().get()
withIOContext {
mangaToUpdate.groupBy { it.source }
@ -345,12 +364,14 @@ class LibraryUpdateService(
if (newUpdates.isNotEmpty()) {
notifier.showUpdateNotifications(newUpdates)
val newChapterCount = newUpdates.sumOf { it.second.size }
preferences.unreadUpdatesCount().set(currentUnreadUpdatesCount + newChapterCount)
if (hasDownloads.get()) {
DownloadService.start(this)
}
}
if (preferences.showLibraryUpdateErrors() && failedUpdates.isNotEmpty()) {
if (failedUpdates.isNotEmpty()) {
val errorFile = writeErrorFile(failedUpdates)
notifier.showUpdateErrorNotification(
failedUpdates.map { it.first.title },
@ -374,24 +395,19 @@ class LibraryUpdateService(
suspend fun updateManga(manga: Manga): Pair<List<Chapter>, List<Chapter>> {
val source = sourceManager.getOrStub(manga.source)
// Update manga details metadata in the background
// Update manga details metadata
if (preferences.autoUpdateMetadata()) {
val handler = CoroutineExceptionHandler { _, exception ->
Timber.e(exception)
val updatedManga = source.getMangaDetails(manga.toMangaInfo())
val sManga = updatedManga.toSManga()
// Avoid "losing" existing cover
if (!sManga.thumbnail_url.isNullOrEmpty()) {
manga.prepUpdateCover(coverCache, sManga, false)
} else {
sManga.thumbnail_url = manga.thumbnail_url
}
GlobalScope.launch(Dispatchers.IO + handler) {
val updatedManga = source.getMangaDetails(manga.toMangaInfo())
val sManga = updatedManga.toSManga()
// Avoid "losing" existing cover
if (!sManga.thumbnail_url.isNullOrEmpty()) {
manga.prepUpdateCover(coverCache, sManga, false)
} else {
sManga.thumbnail_url = manga.thumbnail_url
}
manga.copyFrom(sManga)
db.insertManga(manga).executeAsBlocking()
}
manga.copyFrom(sManga)
db.insertManga(manga).executeAsBlocking()
}
val chapters = source.getChapterList(manga.toMangaInfo())
@ -433,17 +449,9 @@ class LibraryUpdateService(
}
} catch (e: Throwable) {
// Ignore errors and continue
Timber.e(e)
logcat(LogPriority.ERROR, e)
}
}
currentlyUpdatingManga.remove(manga)
progressCount.andIncrement
notifier.showProgressNotification(
currentlyUpdatingManga,
progressCount.get(),
mangaToUpdate.size
)
}
}
}
@ -494,7 +502,7 @@ class LibraryUpdateService(
}
} catch (e: Throwable) {
// Ignore errors and continue
Timber.e(e)
logcat(LogPriority.ERROR, e)
}
}
}
@ -543,12 +551,13 @@ class LibraryUpdateService(
if (errors.isNotEmpty()) {
val file = createFileInCacheDir("tachiyomi_update_errors.txt")
file.bufferedWriter().use { out ->
out.write(getString(R.string.library_errors_help, ERROR_LOG_HELP_URL) + "\n\n")
// Error file format:
// ! Error
// # Source
// - Manga
errors.groupBy({ it.second }, { it.first }).forEach { (error, mangas) ->
out.write("! ${error}\n")
out.write("\n! ${error}\n")
mangas.groupBy { it.source }.forEach { (srcId, mangas) ->
val source = sourceManager.getOrStub(srcId)
out.write(" # $source\n")
@ -566,3 +575,6 @@ class LibraryUpdateService(
return File("")
}
}
private const val MANGA_PER_SOURCE_QUEUE_WARNING_THRESHOLD = 60
private const val ERROR_LOG_HELP_URL = "https://tachiyomi.org/help/guides/troubleshooting"

View File

@ -20,10 +20,10 @@ object NotificationHandler {
*/
internal fun openDownloadManagerPendingActivity(context: Context): PendingIntent {
val intent = Intent(context, MainActivity::class.java).apply {
flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_REORDER_TO_FRONT
flags = Intent.FLAG_ACTIVITY_CLEAR_TOP or Intent.FLAG_ACTIVITY_SINGLE_TOP
action = MainActivity.SHORTCUT_DOWNLOADS
}
return PendingIntent.getActivity(context, 0, intent, 0)
return PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT)
}
/**

View File

@ -102,6 +102,18 @@ class NotificationReceiver : BroadcastReceiver() {
markAsRead(urls, mangaId)
}
}
// Download manga chapters
ACTION_DOWNLOAD_CHAPTER -> {
val notificationId = intent.getIntExtra(EXTRA_NOTIFICATION_ID, -1)
if (notificationId > -1) {
dismissNotification(context, notificationId, intent.getIntExtra(EXTRA_GROUP_ID, 0))
}
val urls = intent.getStringArrayExtra(EXTRA_CHAPTER_URL) ?: return
val mangaId = intent.getLongExtra(EXTRA_MANGA_ID, -1)
if (mangaId > -1) {
downloadChapters(urls, mangaId)
}
}
// Share crash dump file
ACTION_SHARE_CRASH_LOG ->
shareFile(
@ -235,6 +247,24 @@ class NotificationReceiver : BroadcastReceiver() {
}
}
/**
* Method called when user wants to download chapters
*
* @param chapterUrls URLs of chapter to download
* @param mangaId id of manga
*/
private fun downloadChapters(chapterUrls: Array<String>, mangaId: Long) {
val db: DatabaseHelper = Injekt.get()
launchIO {
val chapters = chapterUrls.mapNotNull { db.getChapter(it, mangaId).executeAsBlocking() }
val manga = db.getManga(mangaId).executeAsBlocking()
if (chapters.isNotEmpty() && manga != null) {
downloadManager.downloadChapters(manga, chapters)
}
}
}
companion object {
private const val NAME = "NotificationReceiver"
@ -251,6 +281,7 @@ class NotificationReceiver : BroadcastReceiver() {
private const val ACTION_MARK_AS_READ = "$ID.$NAME.MARK_AS_READ"
private const val ACTION_OPEN_CHAPTER = "$ID.$NAME.ACTION_OPEN_CHAPTER"
private const val ACTION_DOWNLOAD_CHAPTER = "$ID.$NAME.ACTION_DOWNLOAD_CHAPTER"
private const val ACTION_RESUME_DOWNLOADS = "$ID.$NAME.ACTION_RESUME_DOWNLOADS"
private const val ACTION_PAUSE_DOWNLOADS = "$ID.$NAME.ACTION_PAUSE_DOWNLOADS"
@ -442,6 +473,28 @@ class NotificationReceiver : BroadcastReceiver() {
return PendingIntent.getBroadcast(context, manga.id.hashCode(), newIntent, PendingIntent.FLAG_UPDATE_CURRENT)
}
/**
* Returns [PendingIntent] that downloads chapters
*
* @param context context of application
* @param manga manga of chapter
*/
internal fun downloadChaptersPendingBroadcast(
context: Context,
manga: Manga,
chapters: Array<Chapter>,
groupId: Int
): PendingIntent {
val newIntent = Intent(context, NotificationReceiver::class.java).apply {
action = ACTION_DOWNLOAD_CHAPTER
putExtra(EXTRA_CHAPTER_URL, chapters.map { it.url }.toTypedArray())
putExtra(EXTRA_MANGA_ID, manga.id)
putExtra(EXTRA_NOTIFICATION_ID, manga.id.hashCode())
putExtra(EXTRA_GROUP_ID, groupId)
}
return PendingIntent.getBroadcast(context, manga.id.hashCode(), newIntent, PendingIntent.FLAG_UPDATE_CURRENT)
}
/**
* Returns [PendingIntent] that starts a service which stops the library update
*

View File

@ -18,14 +18,15 @@ object Notifications {
* Common notification channel and ids used anywhere.
*/
const val CHANNEL_COMMON = "common_channel"
const val ID_UPDATER = 1
const val ID_DOWNLOAD_IMAGE = 2
/**
* Notification channel and ids used by the library updater.
*/
const val CHANNEL_LIBRARY = "library_channel"
private const val GROUP_LIBRARY = "group_library"
const val CHANNEL_LIBRARY_PROGRESS = "library_progress_channel"
const val ID_LIBRARY_PROGRESS = -101
const val CHANNEL_LIBRARY_ERROR = "library_errors_channel"
const val ID_LIBRARY_ERROR = -102
/**
@ -46,12 +47,6 @@ object Notifications {
const val ID_NEW_CHAPTERS = -301
const val GROUP_NEW_CHAPTERS = "eu.kanade.tachiyomi.NEW_CHAPTERS"
/**
* Notification channel and ids used by the library updater.
*/
const val CHANNEL_UPDATES_TO_EXTS = "updates_ext_channel"
const val ID_UPDATES_TO_EXTS = -401
/**
* Notification channel and ids used by the backup/restore system.
*/
@ -75,9 +70,22 @@ object Notifications {
const val CHANNEL_INCOGNITO_MODE = "incognito_mode_channel"
const val ID_INCOGNITO_MODE = -701
/**
* Notification channel and ids used for app and extension updates.
*/
private const val GROUP_APK_UPDATES = "group_apk_updates"
const val CHANNEL_APP_UPDATE = "app_apk_update_channel"
const val ID_APP_UPDATER = 1
const val CHANNEL_EXTENSIONS_UPDATE = "ext_apk_update_channel"
const val ID_UPDATES_TO_EXTS = -401
const val ID_EXTENSION_INSTALLER = -402
private val deprecatedChannels = listOf(
"downloader_channel",
"backup_restore_complete_channel"
"backup_restore_complete_channel",
"library_channel",
"library_progress_channel",
"updates_ext_channel",
)
/**
@ -89,66 +97,85 @@ object Notifications {
fun createChannels(context: Context) {
val notificationService = NotificationManagerCompat.from(context)
val channelGroupList = listOf(
buildNotificationChannelGroup(GROUP_BACKUP_RESTORE) {
setName(context.getString(R.string.group_backup_restore))
},
buildNotificationChannelGroup(GROUP_DOWNLOADER) {
setName(context.getString(R.string.group_downloader))
}
)
notificationService.createNotificationChannelGroupsCompat(channelGroupList)
val channelList = listOf(
buildNotificationChannel(CHANNEL_COMMON, IMPORTANCE_LOW) {
setName(context.getString(R.string.channel_common))
},
buildNotificationChannel(CHANNEL_LIBRARY, IMPORTANCE_LOW) {
setName(context.getString(R.string.channel_library))
setShowBadge(false)
},
buildNotificationChannel(CHANNEL_DOWNLOADER_PROGRESS, IMPORTANCE_LOW) {
setName(context.getString(R.string.channel_progress))
setGroup(GROUP_DOWNLOADER)
setShowBadge(false)
},
buildNotificationChannel(CHANNEL_DOWNLOADER_COMPLETE, IMPORTANCE_LOW) {
setName(context.getString(R.string.channel_complete))
setGroup(GROUP_DOWNLOADER)
setShowBadge(false)
},
buildNotificationChannel(CHANNEL_DOWNLOADER_ERROR, IMPORTANCE_LOW) {
setName(context.getString(R.string.channel_errors))
setGroup(GROUP_DOWNLOADER)
setShowBadge(false)
},
buildNotificationChannel(CHANNEL_NEW_CHAPTERS, IMPORTANCE_DEFAULT) {
setName(context.getString(R.string.channel_new_chapters))
},
buildNotificationChannel(CHANNEL_UPDATES_TO_EXTS, IMPORTANCE_DEFAULT) {
setName(context.getString(R.string.channel_ext_updates))
},
buildNotificationChannel(CHANNEL_BACKUP_RESTORE_PROGRESS, IMPORTANCE_LOW) {
setName(context.getString(R.string.channel_progress))
setGroup(GROUP_BACKUP_RESTORE)
setShowBadge(false)
},
buildNotificationChannel(CHANNEL_BACKUP_RESTORE_COMPLETE, IMPORTANCE_HIGH) {
setName(context.getString(R.string.channel_complete))
setGroup(GROUP_BACKUP_RESTORE)
setShowBadge(false)
setSound(null, null)
},
buildNotificationChannel(CHANNEL_CRASH_LOGS, IMPORTANCE_HIGH) {
setName(context.getString(R.string.channel_crash_logs))
},
buildNotificationChannel(CHANNEL_INCOGNITO_MODE, IMPORTANCE_LOW) {
setName(context.getString(R.string.pref_incognito_mode))
},
)
notificationService.createNotificationChannelsCompat(channelList)
// Delete old notification channels
deprecatedChannels.forEach(notificationService::deleteNotificationChannel)
notificationService.createNotificationChannelGroupsCompat(
listOf(
buildNotificationChannelGroup(GROUP_BACKUP_RESTORE) {
setName(context.getString(R.string.label_backup))
},
buildNotificationChannelGroup(GROUP_DOWNLOADER) {
setName(context.getString(R.string.download_notifier_downloader_title))
},
buildNotificationChannelGroup(GROUP_LIBRARY) {
setName(context.getString(R.string.label_library))
},
buildNotificationChannelGroup(GROUP_APK_UPDATES) {
setName(context.getString(R.string.label_recent_updates))
},
)
)
notificationService.createNotificationChannelsCompat(
listOf(
buildNotificationChannel(CHANNEL_COMMON, IMPORTANCE_LOW) {
setName(context.getString(R.string.channel_common))
},
buildNotificationChannel(CHANNEL_LIBRARY_PROGRESS, IMPORTANCE_LOW) {
setName(context.getString(R.string.channel_progress))
setGroup(GROUP_LIBRARY)
setShowBadge(false)
},
buildNotificationChannel(CHANNEL_LIBRARY_ERROR, IMPORTANCE_LOW) {
setName(context.getString(R.string.channel_errors))
setGroup(GROUP_LIBRARY)
setShowBadge(false)
},
buildNotificationChannel(CHANNEL_NEW_CHAPTERS, IMPORTANCE_DEFAULT) {
setName(context.getString(R.string.channel_new_chapters))
},
buildNotificationChannel(CHANNEL_DOWNLOADER_PROGRESS, IMPORTANCE_LOW) {
setName(context.getString(R.string.channel_progress))
setGroup(GROUP_DOWNLOADER)
setShowBadge(false)
},
buildNotificationChannel(CHANNEL_DOWNLOADER_COMPLETE, IMPORTANCE_LOW) {
setName(context.getString(R.string.channel_complete))
setGroup(GROUP_DOWNLOADER)
setShowBadge(false)
},
buildNotificationChannel(CHANNEL_DOWNLOADER_ERROR, IMPORTANCE_LOW) {
setName(context.getString(R.string.channel_errors))
setGroup(GROUP_DOWNLOADER)
setShowBadge(false)
},
buildNotificationChannel(CHANNEL_BACKUP_RESTORE_PROGRESS, IMPORTANCE_LOW) {
setName(context.getString(R.string.channel_progress))
setGroup(GROUP_BACKUP_RESTORE)
setShowBadge(false)
},
buildNotificationChannel(CHANNEL_BACKUP_RESTORE_COMPLETE, IMPORTANCE_HIGH) {
setName(context.getString(R.string.channel_complete))
setGroup(GROUP_BACKUP_RESTORE)
setShowBadge(false)
setSound(null, null)
},
buildNotificationChannel(CHANNEL_CRASH_LOGS, IMPORTANCE_HIGH) {
setName(context.getString(R.string.channel_crash_logs))
},
buildNotificationChannel(CHANNEL_INCOGNITO_MODE, IMPORTANCE_LOW) {
setName(context.getString(R.string.pref_incognito_mode))
},
buildNotificationChannel(CHANNEL_APP_UPDATE, IMPORTANCE_DEFAULT) {
setGroup(GROUP_APK_UPDATES)
setName(context.getString(R.string.channel_app_updates))
},
buildNotificationChannel(CHANNEL_EXTENSIONS_UPDATE, IMPORTANCE_DEFAULT) {
setGroup(GROUP_APK_UPDATES)
setName(context.getString(R.string.channel_ext_updates))
},
)
)
}
}

View File

@ -5,141 +5,28 @@ package eu.kanade.tachiyomi.data.preference
*/
object PreferenceKeys {
const val themeMode = "pref_theme_mode_key"
const val appTheme = "pref_app_theme"
const val themeDarkAmoled = "pref_theme_dark_amoled_key"
const val confirmExit = "pref_confirm_exit"
const val hideBottomBarOnScroll = "pref_hide_bottom_bar_on_scroll"
const val sideNavIconAlignment = "pref_side_nav_icon_alignment"
const val enableTransitions = "pref_enable_transitions_key"
const val doubleTapAnimationSpeed = "pref_double_tap_anim_speed"
const val showPageNumber = "pref_show_page_number_key"
const val dualPageSplitPaged = "pref_dual_page_split"
const val dualPageSplitWebtoon = "pref_dual_page_split_webtoon"
const val dualPageInvertPaged = "pref_dual_page_invert"
const val dualPageInvertWebtoon = "pref_dual_page_invert_webtoon"
const val showReadingMode = "pref_show_reading_mode"
const val trueColor = "pref_true_color_key"
const val fullscreen = "fullscreen"
const val cutoutShort = "cutout_short"
const val keepScreenOn = "pref_keep_screen_on_key"
const val customBrightness = "pref_custom_brightness_key"
const val customBrightnessValue = "custom_brightness_value"
const val colorFilter = "pref_color_filter_key"
const val colorFilterValue = "color_filter_value"
const val colorFilterMode = "color_filter_mode"
const val grayscale = "pref_grayscale"
const val invertedColors = "pref_inverted_colors"
const val defaultReadingMode = "pref_default_reading_mode_key"
const val defaultOrientationType = "pref_default_orientation_type_key"
const val imageScaleType = "pref_image_scale_type_key"
const val zoomStart = "pref_zoom_start_key"
const val readerTheme = "pref_reader_theme_key"
const val cropBorders = "crop_borders"
const val cropBordersWebtoon = "crop_borders_webtoon"
const val readWithTapping = "reader_tap"
const val pagerNavInverted = "reader_tapping_inverted"
const val webtoonNavInverted = "reader_tapping_inverted_webtoon"
const val readWithLongTap = "reader_long_tap"
const val readWithVolumeKeys = "reader_volume_keys"
const val readWithVolumeKeysInverted = "reader_volume_keys_inverted"
const val navigationModePager = "reader_navigation_mode_pager"
const val navigationModeWebtoon = "reader_navigation_mode_webtoon"
const val showNavigationOverlayNewUser = "reader_navigation_overlay_new_user"
const val showNavigationOverlayOnStart = "reader_navigation_overlay_on_start"
const val readerHideThreshold = "reader_hide_threshold"
const val webtoonSidePadding = "webtoon_side_padding"
const val portraitColumns = "pref_library_columns_portrait_key"
const val landscapeColumns = "pref_library_columns_landscape_key"
const val jumpToChapters = "jump_to_chapters"
const val updateOnlyNonCompleted = "pref_update_only_non_completed_key"
const val autoUpdateTrack = "pref_auto_update_manga_sync_key"
const val lastUsedSource = "last_catalogue_source"
const val lastUsedCategory = "last_used_category"
const val sourceDisplayMode = "pref_display_mode_catalogue"
const val enabledLanguages = "source_languages"
const val backupDirectory = "backup_directory"
const val downloadsDirectory = "download_directory"
const val downloadOnlyOverWifi = "pref_download_only_over_wifi_key"
const val folderPerManga = "create_folder_per_manga"
const val numberOfBackups = "backup_slots"
const val backupInterval = "backup_interval"
const val removeAfterReadSlots = "remove_after_read_slots"
const val removeAfterMarkedAsRead = "pref_remove_after_marked_as_read_key"
const val removeBookmarkedChapters = "pref_remove_bookmarked"
const val libraryUpdateInterval = "pref_library_update_interval_key"
const val libraryUpdateRestriction = "library_update_restriction"
const val libraryUpdateCategories = "library_update_categories"
const val libraryUpdateCategoriesExclude = "library_update_categories_exclude"
const val libraryUpdatePrioritization = "library_update_prioritization"
const val downloadedOnly = "pref_downloaded_only"
const val filterDownloaded = "pref_filter_library_downloaded"
const val filterUnread = "pref_filter_library_unread"
@ -151,61 +38,25 @@ object PreferenceKeys {
const val librarySortingMode = "library_sorting_mode"
const val librarySortingDirection = "library_sorting_ascending"
const val automaticExtUpdates = "automatic_ext_updates"
const val showNsfwSource = "show_nsfw_source"
const val showNsfwExtension = "show_nsfw_extension"
const val labelNsfwExtension = "label_nsfw_extension"
const val migrationSortingMode = "pref_migration_sorting"
const val migrationSortingDirection = "pref_migration_direction"
const val startScreen = "start_screen"
const val useAuthenticator = "use_biometric_lock"
const val lockAppAfter = "lock_app_after"
const val lastAppUnlock = "last_app_unlock"
const val secureScreen = "secure_screen"
const val hideNotificationContent = "hide_notification_content"
const val autoUpdateMetadata = "auto_update_metadata"
const val autoUpdateTrackers = "auto_update_trackers"
const val showLibraryUpdateErrors = "show_library_update_errors"
const val downloadNew = "download_new"
const val downloadNewCategories = "download_new_categories"
const val downloadNewCategoriesExclude = "download_new_categories_exclude"
const val removeExcludeCategories = "remove_exclude_categories"
const val libraryDisplayMode = "pref_display_mode_library"
const val relativeTime: String = "relative_time"
const val dateFormat = "app_date_format"
const val defaultCategory = "default_category"
const val categorizedDisplay = "categorized_display"
const val skipRead = "skip_read"
const val skipFiltered = "skip_filtered"
const val downloadBadge = "display_download_badge"
const val unreadBadge = "display_unread_badge"
const val localBadge = "display_local_badge"
const val categoryTabs = "display_category_tabs"
const val categoryNumberOfItems = "display_number_of_items"
const val alwaysShowChapterTransition = "always_show_chapter_transition"
const val searchPinnedSourcesOnly = "search_pinned_sources_only"
const val dohProvider = "doh_provider"
@ -222,9 +73,9 @@ object PreferenceKeys {
const val defaultChapterDisplayByNameOrNumber = "default_chapter_display_by_name_or_number"
const val incognitoMode = "incognito_mode"
const val verboseLogging = "verbose_logging"
const val tabletUiMode = "tablet_ui_mode"
const val autoClearChapterCache = "auto_clear_chapter_cache"
fun trackUsername(syncId: Int) = "pref_mangasync_username_$syncId"

View File

@ -2,8 +2,11 @@ package eu.kanade.tachiyomi.data.preference
import eu.kanade.tachiyomi.R
const val UNMETERED_NETWORK = "wifi"
const val CHARGING = "ac"
const val DEVICE_ONLY_ON_WIFI = "wifi"
const val DEVICE_CHARGING = "ac"
const val MANGA_ONGOING = "manga_ongoing"
const val MANGA_FULLY_READ = "manga_fully_read"
/**
* This class stores the values for the preferences in the application.
@ -31,11 +34,11 @@ object PreferenceValues {
GREEN_APPLE(R.string.theme_greenapple),
TEALTURQUOISE(R.string.theme_tealturquoise),
YINYANG(R.string.theme_yinyang),
BLUE(R.string.theme_blue),
// Deprecated
DARK_BLUE(null),
HOT_PINK(null),
BLUE(null),
}
enum class TappingInvertMode(val shouldInvertHorizontal: Boolean = false, val shouldInvertVertical: Boolean = false) {
@ -53,8 +56,15 @@ object PreferenceValues {
}
enum class TabletUiMode {
AUTOMATIC,
ALWAYS,
LANDSCAPE,
NEVER,
}
enum class ExtensionInstaller {
LEGACY,
PACKAGEINSTALLER,
SHIZUKU,
}
}

View File

@ -1,26 +1,24 @@
package eu.kanade.tachiyomi.data.preference
import android.content.Context
import android.os.Build
import android.os.Environment
import androidx.core.content.edit
import androidx.core.net.toUri
import androidx.preference.PreferenceManager
import com.tfcporciuncula.flow.FlowSharedPreferences
import com.tfcporciuncula.flow.Preference
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.database.models.Manga
import eu.kanade.tachiyomi.data.preference.PreferenceValues.ThemeMode.system
import eu.kanade.tachiyomi.data.track.TrackService
import eu.kanade.tachiyomi.data.track.anilist.Anilist
import eu.kanade.tachiyomi.ui.browse.migration.sources.MigrationSourcesController
import eu.kanade.tachiyomi.ui.library.setting.DisplayModeSetting
import eu.kanade.tachiyomi.ui.library.setting.SortDirectionSetting
import eu.kanade.tachiyomi.ui.library.setting.SortModeSetting
import eu.kanade.tachiyomi.ui.reader.setting.OrientationType
import eu.kanade.tachiyomi.ui.reader.setting.ReadingModeType
import eu.kanade.tachiyomi.util.system.isTablet
import eu.kanade.tachiyomi.util.system.DeviceUtil
import eu.kanade.tachiyomi.widget.ExtendedNavigationView
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.onEach
import java.io.File
import java.text.DateFormat
import java.text.SimpleDateFormat
@ -28,25 +26,6 @@ import java.util.Locale
import eu.kanade.tachiyomi.data.preference.PreferenceKeys as Keys
import eu.kanade.tachiyomi.data.preference.PreferenceValues as Values
fun <T> Preference<T>.asImmediateFlow(block: (T) -> Unit): Flow<T> {
block(get())
return asFlow()
.onEach { block(it) }
}
operator fun <T> Preference<Set<T>>.plusAssign(item: T) {
set(get() + item)
}
operator fun <T> Preference<Set<T>>.minusAssign(item: T) {
set(get() - item)
}
fun Preference<Boolean>.toggle(): Boolean {
set(!get())
return get()
}
class PreferencesHelper(val context: Context) {
private val prefs = PreferenceManager.getDefaultSharedPreferences(context)
@ -68,17 +47,17 @@ class PreferencesHelper(val context: Context) {
fun confirmExit() = prefs.getBoolean(Keys.confirmExit, false)
fun hideBottomBarOnScroll() = flowPrefs.getBoolean(Keys.hideBottomBarOnScroll, true)
fun hideBottomBarOnScroll() = flowPrefs.getBoolean("pref_hide_bottom_bar_on_scroll", true)
fun sideNavIconAlignment() = flowPrefs.getInt(Keys.sideNavIconAlignment, 0)
fun sideNavIconAlignment() = flowPrefs.getInt("pref_side_nav_icon_alignment", 0)
fun useAuthenticator() = flowPrefs.getBoolean(Keys.useAuthenticator, false)
fun useAuthenticator() = flowPrefs.getBoolean("use_biometric_lock", false)
fun lockAppAfter() = flowPrefs.getInt(Keys.lockAppAfter, 0)
fun lockAppAfter() = flowPrefs.getInt("lock_app_after", 0)
fun lastAppUnlock() = flowPrefs.getLong(Keys.lastAppUnlock, 0)
fun lastAppUnlock() = flowPrefs.getLong("last_app_unlock", 0)
fun secureScreen() = flowPrefs.getBoolean(Keys.secureScreen, false)
fun secureScreen() = flowPrefs.getBoolean("secure_screen", false)
fun hideNotificationContent() = prefs.getBoolean(Keys.hideNotificationContent, false)
@ -86,111 +65,113 @@ class PreferencesHelper(val context: Context) {
fun autoUpdateTrackers() = prefs.getBoolean(Keys.autoUpdateTrackers, false)
fun showLibraryUpdateErrors() = prefs.getBoolean(Keys.showLibraryUpdateErrors, true)
fun themeMode() = flowPrefs.getEnum(
"pref_theme_mode_key",
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { Values.ThemeMode.system } else { Values.ThemeMode.light }
)
fun themeMode() = flowPrefs.getEnum(Keys.themeMode, system)
fun appTheme() = flowPrefs.getEnum(
"pref_app_theme",
if (DeviceUtil.isDynamicColorAvailable) { Values.AppTheme.MONET } else { Values.AppTheme.DEFAULT }
)
fun appTheme() = flowPrefs.getEnum(Keys.appTheme, Values.AppTheme.DEFAULT)
fun themeDarkAmoled() = flowPrefs.getBoolean("pref_theme_dark_amoled_key", false)
fun themeDarkAmoled() = flowPrefs.getBoolean(Keys.themeDarkAmoled, false)
fun pageTransitions() = flowPrefs.getBoolean("pref_enable_transitions_key", true)
fun pageTransitions() = flowPrefs.getBoolean(Keys.enableTransitions, true)
fun doubleTapAnimSpeed() = flowPrefs.getInt("pref_double_tap_anim_speed", 500)
fun doubleTapAnimSpeed() = flowPrefs.getInt(Keys.doubleTapAnimationSpeed, 500)
fun showPageNumber() = flowPrefs.getBoolean("pref_show_page_number_key", true)
fun showPageNumber() = flowPrefs.getBoolean(Keys.showPageNumber, true)
fun dualPageSplitPaged() = flowPrefs.getBoolean("pref_dual_page_split", false)
fun dualPageSplitPaged() = flowPrefs.getBoolean(Keys.dualPageSplitPaged, false)
fun dualPageSplitWebtoon() = flowPrefs.getBoolean("pref_dual_page_split_webtoon", false)
fun dualPageSplitWebtoon() = flowPrefs.getBoolean(Keys.dualPageSplitWebtoon, false)
fun dualPageInvertPaged() = flowPrefs.getBoolean("pref_dual_page_invert", false)
fun dualPageInvertPaged() = flowPrefs.getBoolean(Keys.dualPageInvertPaged, false)
fun dualPageInvertWebtoon() = flowPrefs.getBoolean(Keys.dualPageInvertWebtoon, false)
fun dualPageInvertWebtoon() = flowPrefs.getBoolean("pref_dual_page_invert_webtoon", false)
fun showReadingMode() = prefs.getBoolean(Keys.showReadingMode, true)
fun trueColor() = flowPrefs.getBoolean(Keys.trueColor, false)
fun trueColor() = flowPrefs.getBoolean("pref_true_color_key", false)
fun fullscreen() = flowPrefs.getBoolean(Keys.fullscreen, true)
fun fullscreen() = flowPrefs.getBoolean("fullscreen", true)
fun cutoutShort() = flowPrefs.getBoolean(Keys.cutoutShort, true)
fun cutoutShort() = flowPrefs.getBoolean("cutout_short", true)
fun keepScreenOn() = flowPrefs.getBoolean(Keys.keepScreenOn, true)
fun keepScreenOn() = flowPrefs.getBoolean("pref_keep_screen_on_key", true)
fun customBrightness() = flowPrefs.getBoolean(Keys.customBrightness, false)
fun customBrightness() = flowPrefs.getBoolean("pref_custom_brightness_key", false)
fun customBrightnessValue() = flowPrefs.getInt(Keys.customBrightnessValue, 0)
fun customBrightnessValue() = flowPrefs.getInt("custom_brightness_value", 0)
fun colorFilter() = flowPrefs.getBoolean(Keys.colorFilter, false)
fun colorFilter() = flowPrefs.getBoolean("pref_color_filter_key", false)
fun colorFilterValue() = flowPrefs.getInt(Keys.colorFilterValue, 0)
fun colorFilterValue() = flowPrefs.getInt("color_filter_value", 0)
fun colorFilterMode() = flowPrefs.getInt(Keys.colorFilterMode, 0)
fun colorFilterMode() = flowPrefs.getInt("color_filter_mode", 0)
fun grayscale() = flowPrefs.getBoolean(Keys.grayscale, false)
fun grayscale() = flowPrefs.getBoolean("pref_grayscale", false)
fun invertedColors() = flowPrefs.getBoolean(Keys.invertedColors, false)
fun invertedColors() = flowPrefs.getBoolean("pref_inverted_colors", false)
fun defaultReadingMode() = prefs.getInt(Keys.defaultReadingMode, ReadingModeType.RIGHT_TO_LEFT.flagValue)
fun defaultOrientationType() = prefs.getInt(Keys.defaultOrientationType, OrientationType.FREE.flagValue)
fun imageScaleType() = flowPrefs.getInt(Keys.imageScaleType, 1)
fun imageScaleType() = flowPrefs.getInt("pref_image_scale_type_key", 1)
fun zoomStart() = flowPrefs.getInt(Keys.zoomStart, 1)
fun zoomStart() = flowPrefs.getInt("pref_zoom_start_key", 1)
fun readerTheme() = flowPrefs.getInt(Keys.readerTheme, 1)
fun readerTheme() = flowPrefs.getInt("pref_reader_theme_key", 1)
fun alwaysShowChapterTransition() = flowPrefs.getBoolean(Keys.alwaysShowChapterTransition, true)
fun alwaysShowChapterTransition() = flowPrefs.getBoolean("always_show_chapter_transition", true)
fun cropBorders() = flowPrefs.getBoolean(Keys.cropBorders, false)
fun cropBorders() = flowPrefs.getBoolean("crop_borders", false)
fun cropBordersWebtoon() = flowPrefs.getBoolean(Keys.cropBordersWebtoon, false)
fun cropBordersWebtoon() = flowPrefs.getBoolean("crop_borders_webtoon", false)
fun webtoonSidePadding() = flowPrefs.getInt(Keys.webtoonSidePadding, 0)
fun webtoonSidePadding() = flowPrefs.getInt("webtoon_side_padding", 0)
fun readWithTapping() = flowPrefs.getBoolean(Keys.readWithTapping, true)
fun readWithTapping() = flowPrefs.getBoolean("reader_tap", true)
fun pagerNavInverted() = flowPrefs.getEnum(Keys.pagerNavInverted, Values.TappingInvertMode.NONE)
fun pagerNavInverted() = flowPrefs.getEnum("reader_tapping_inverted", Values.TappingInvertMode.NONE)
fun webtoonNavInverted() = flowPrefs.getEnum(Keys.webtoonNavInverted, Values.TappingInvertMode.NONE)
fun webtoonNavInverted() = flowPrefs.getEnum("reader_tapping_inverted_webtoon", Values.TappingInvertMode.NONE)
fun readWithLongTap() = flowPrefs.getBoolean(Keys.readWithLongTap, true)
fun readWithLongTap() = flowPrefs.getBoolean("reader_long_tap", true)
fun readWithVolumeKeys() = flowPrefs.getBoolean(Keys.readWithVolumeKeys, false)
fun readWithVolumeKeys() = flowPrefs.getBoolean("reader_volume_keys", false)
fun readWithVolumeKeysInverted() = flowPrefs.getBoolean(Keys.readWithVolumeKeysInverted, false)
fun readWithVolumeKeysInverted() = flowPrefs.getBoolean("reader_volume_keys_inverted", false)
fun navigationModePager() = flowPrefs.getInt(Keys.navigationModePager, 0)
fun navigationModePager() = flowPrefs.getInt("reader_navigation_mode_pager", 0)
fun navigationModeWebtoon() = flowPrefs.getInt(Keys.navigationModeWebtoon, 0)
fun navigationModeWebtoon() = flowPrefs.getInt("reader_navigation_mode_webtoon", 0)
fun showNavigationOverlayNewUser() = flowPrefs.getBoolean(Keys.showNavigationOverlayNewUser, true)
fun showNavigationOverlayNewUser() = flowPrefs.getBoolean("reader_navigation_overlay_new_user", true)
fun showNavigationOverlayOnStart() = flowPrefs.getBoolean(Keys.showNavigationOverlayOnStart, false)
fun showNavigationOverlayOnStart() = flowPrefs.getBoolean("reader_navigation_overlay_on_start", false)
fun readerHideTreshold() = flowPrefs.getEnum(Keys.readerHideThreshold, Values.ReaderHideThreshold.LOW)
fun readerHideThreshold() = flowPrefs.getEnum("reader_hide_threshold", Values.ReaderHideThreshold.LOW)
fun portraitColumns() = flowPrefs.getInt(Keys.portraitColumns, 0)
fun portraitColumns() = flowPrefs.getInt("pref_library_columns_portrait_key", 0)
fun landscapeColumns() = flowPrefs.getInt(Keys.landscapeColumns, 0)
fun landscapeColumns() = flowPrefs.getInt("pref_library_columns_landscape_key", 0)
fun jumpToChapters() = prefs.getBoolean(Keys.jumpToChapters, false)
fun updateOnlyNonCompleted() = prefs.getBoolean(Keys.updateOnlyNonCompleted, false)
fun autoUpdateTrack() = prefs.getBoolean(Keys.autoUpdateTrack, true)
fun lastUsedSource() = flowPrefs.getLong(Keys.lastUsedSource, -1)
fun lastUsedSource() = flowPrefs.getLong("last_catalogue_source", -1)
fun lastUsedCategory() = flowPrefs.getInt(Keys.lastUsedCategory, 0)
fun lastUsedCategory() = flowPrefs.getInt("last_used_category", 0)
fun lastVersionCode() = flowPrefs.getInt("last_version_code", 0)
fun sourceDisplayMode() = flowPrefs.getEnum(Keys.sourceDisplayMode, DisplayModeSetting.COMPACT_GRID)
fun sourceDisplayMode() = flowPrefs.getEnum("pref_display_mode_catalogue", DisplayModeSetting.COMPACT_GRID)
fun enabledLanguages() = flowPrefs.getStringSet(Keys.enabledLanguages, setOf("en", Locale.getDefault().language))
fun enabledLanguages() = flowPrefs.getStringSet("source_languages", setOf("all", "en", Locale.getDefault().language))
fun trackUsername(sync: TrackService) = prefs.getString(Keys.trackUsername(sync.id), "")
@ -207,24 +188,26 @@ class PreferencesHelper(val context: Context) {
fun anilistScoreType() = flowPrefs.getString("anilist_score_type", Anilist.POINT_10)
fun backupsDirectory() = flowPrefs.getString(Keys.backupDirectory, defaultBackupDir.toString())
fun backupsDirectory() = flowPrefs.getString("backup_directory", defaultBackupDir.toString())
fun relativeTime() = flowPrefs.getInt(Keys.relativeTime, 7)
fun relativeTime() = flowPrefs.getInt("relative_time", 7)
fun dateFormat(format: String = flowPrefs.getString(Keys.dateFormat, "").get()): DateFormat = when (format) {
"" -> DateFormat.getDateInstance(DateFormat.SHORT)
else -> SimpleDateFormat(format, Locale.getDefault())
}
fun downloadsDirectory() = flowPrefs.getString(Keys.downloadsDirectory, defaultDownloadsDir.toString())
fun downloadsDirectory() = flowPrefs.getString("download_directory", defaultDownloadsDir.toString())
fun downloadOnlyOverWifi() = prefs.getBoolean(Keys.downloadOnlyOverWifi, true)
fun saveChaptersAsCBZ() = flowPrefs.getBoolean("save_chapter_as_cbz", false)
fun folderPerManga() = prefs.getBoolean(Keys.folderPerManga, false)
fun numberOfBackups() = flowPrefs.getInt(Keys.numberOfBackups, 1)
fun numberOfBackups() = flowPrefs.getInt("backup_slots", 1)
fun backupInterval() = flowPrefs.getInt(Keys.backupInterval, 0)
fun backupInterval() = flowPrefs.getInt("backup_interval", 0)
fun removeAfterReadSlots() = prefs.getInt(Keys.removeAfterReadSlots, -1)
@ -232,30 +215,34 @@ class PreferencesHelper(val context: Context) {
fun removeBookmarkedChapters() = prefs.getBoolean(Keys.removeBookmarkedChapters, false)
fun removeExcludeCategories() = flowPrefs.getStringSet(Keys.removeExcludeCategories, emptySet())
fun removeExcludeCategories() = flowPrefs.getStringSet("remove_exclude_categories", emptySet())
fun libraryUpdateInterval() = flowPrefs.getInt(Keys.libraryUpdateInterval, 24)
fun libraryUpdateInterval() = flowPrefs.getInt("pref_library_update_interval_key", 24)
fun libraryUpdateRestriction() = flowPrefs.getStringSet(Keys.libraryUpdateRestriction, setOf(UNMETERED_NETWORK))
fun libraryUpdateDeviceRestriction() = flowPrefs.getStringSet("library_update_restriction", setOf(DEVICE_ONLY_ON_WIFI))
fun libraryUpdateMangaRestriction() = flowPrefs.getStringSet("library_update_manga_restriction", setOf(MANGA_FULLY_READ, MANGA_ONGOING))
fun libraryUpdateCategories() = flowPrefs.getStringSet(Keys.libraryUpdateCategories, emptySet())
fun libraryUpdateCategoriesExclude() = flowPrefs.getStringSet(Keys.libraryUpdateCategoriesExclude, emptySet())
fun showUpdatesNavBadge() = flowPrefs.getBoolean("library_update_show_tab_badge", false)
fun unreadUpdatesCount() = flowPrefs.getInt("library_unread_updates_count", 0)
fun libraryUpdatePrioritization() = flowPrefs.getInt(Keys.libraryUpdatePrioritization, 0)
fun libraryUpdateCategories() = flowPrefs.getStringSet("library_update_categories", emptySet())
fun libraryUpdateCategoriesExclude() = flowPrefs.getStringSet("library_update_categories_exclude", emptySet())
fun libraryDisplayMode() = flowPrefs.getEnum(Keys.libraryDisplayMode, DisplayModeSetting.COMPACT_GRID)
fun libraryDisplayMode() = flowPrefs.getEnum("pref_display_mode_library", DisplayModeSetting.COMPACT_GRID)
fun downloadBadge() = flowPrefs.getBoolean(Keys.downloadBadge, false)
fun downloadBadge() = flowPrefs.getBoolean("display_download_badge", false)
fun localBadge() = flowPrefs.getBoolean(Keys.localBadge, true)
fun localBadge() = flowPrefs.getBoolean("display_local_badge", true)
fun downloadedOnly() = flowPrefs.getBoolean(Keys.downloadedOnly, false)
fun downloadedOnly() = flowPrefs.getBoolean("pref_downloaded_only", false)
fun unreadBadge() = flowPrefs.getBoolean(Keys.unreadBadge, true)
fun unreadBadge() = flowPrefs.getBoolean("display_unread_badge", true)
fun categoryTabs() = flowPrefs.getBoolean(Keys.categoryTabs, true)
fun languageBadge() = flowPrefs.getBoolean("display_language_badge", false)
fun categoryNumberOfItems() = flowPrefs.getBoolean(Keys.categoryNumberOfItems, false)
fun categoryTabs() = flowPrefs.getBoolean("display_category_tabs", true)
fun categoryNumberOfItems() = flowPrefs.getBoolean("display_number_of_items", false)
fun filterDownloaded() = flowPrefs.getInt(Keys.filterDownloaded, ExtendedNavigationView.Item.TriStateGroup.State.IGNORE.value)
@ -268,11 +255,12 @@ class PreferencesHelper(val context: Context) {
fun librarySortingMode() = flowPrefs.getEnum(Keys.librarySortingMode, SortModeSetting.ALPHABETICAL)
fun librarySortingAscending() = flowPrefs.getEnum(Keys.librarySortingDirection, SortDirectionSetting.ASCENDING)
fun automaticExtUpdates() = flowPrefs.getBoolean(Keys.automaticExtUpdates, true)
fun migrationSortingMode() = flowPrefs.getEnum(Keys.migrationSortingMode, MigrationSourcesController.SortSetting.ALPHABETICAL)
fun migrationSortingDirection() = flowPrefs.getEnum(Keys.migrationSortingDirection, MigrationSourcesController.DirectionSetting.ASCENDING)
fun showNsfwSource() = flowPrefs.getBoolean(Keys.showNsfwSource, true)
fun showNsfwExtension() = flowPrefs.getBoolean(Keys.showNsfwExtension, true)
fun labelNsfwExtension() = prefs.getBoolean(Keys.labelNsfwExtension, true)
fun automaticExtUpdates() = flowPrefs.getBoolean("automatic_ext_updates", true)
fun showNsfwSource() = flowPrefs.getBoolean("show_nsfw_source", true)
fun extensionUpdatesCount() = flowPrefs.getInt("ext_updates_count", 0)
@ -285,14 +273,14 @@ class PreferencesHelper(val context: Context) {
fun pinnedSources() = flowPrefs.getStringSet("pinned_catalogues", emptySet())
fun downloadNew() = flowPrefs.getBoolean(Keys.downloadNew, false)
fun downloadNew() = flowPrefs.getBoolean("download_new", false)
fun downloadNewCategories() = flowPrefs.getStringSet(Keys.downloadNewCategories, emptySet())
fun downloadNewCategoriesExclude() = flowPrefs.getStringSet(Keys.downloadNewCategoriesExclude, emptySet())
fun downloadNewCategories() = flowPrefs.getStringSet("download_new_categories", emptySet())
fun downloadNewCategoriesExclude() = flowPrefs.getStringSet("download_new_categories_exclude", emptySet())
fun defaultCategory() = prefs.getInt(Keys.defaultCategory, -1)
fun categorisedDisplaySettings() = flowPrefs.getBoolean(Keys.categorizedDisplay, false)
fun categorizedDisplaySettings() = flowPrefs.getBoolean("categorized_display", false)
fun skipRead() = prefs.getBoolean(Keys.skipRead, false)
@ -318,13 +306,19 @@ class PreferencesHelper(val context: Context) {
fun sortChapterByAscendingOrDescending() = prefs.getInt(Keys.defaultChapterSortByAscendingOrDescending, Manga.CHAPTER_SORT_DESC)
fun incognitoMode() = flowPrefs.getBoolean(Keys.incognitoMode, false)
fun incognitoMode() = flowPrefs.getBoolean("incognito_mode", false)
fun tabletUiMode() = flowPrefs.getEnum(
Keys.tabletUiMode,
if (context.applicationContext.isTablet()) Values.TabletUiMode.ALWAYS else Values.TabletUiMode.NEVER
fun tabletUiMode() = flowPrefs.getEnum("tablet_ui_mode", Values.TabletUiMode.AUTOMATIC)
fun extensionInstaller() = flowPrefs.getEnum(
"extension_installer",
if (DeviceUtil.isMiui) Values.ExtensionInstaller.LEGACY else Values.ExtensionInstaller.PACKAGEINSTALLER
)
fun verboseLogging() = prefs.getBoolean(Keys.verboseLogging, false)
fun autoClearChapterCache() = prefs.getBoolean(Keys.autoClearChapterCache, false)
fun setChapterSettingsDefault(manga: Manga) {
prefs.edit {
putInt(Keys.defaultChapterFilterByRead, manga.readFilter)

View File

@ -1,6 +1,7 @@
package eu.kanade.tachiyomi.data.track
import eu.kanade.tachiyomi.data.database.models.Manga
import eu.kanade.tachiyomi.data.database.models.Track
import eu.kanade.tachiyomi.data.track.model.TrackSearch
import eu.kanade.tachiyomi.source.Source
@ -25,4 +26,14 @@ interface EnhancedTrackService {
* match is similar to TrackService.search, but only return zero or one match.
*/
suspend fun match(manga: Manga): TrackSearch?
/**
* Checks whether the provided source/track/manga triplet is from this TrackService
*/
fun isTrackFrom(track: Track, manga: Manga, source: Source?): Boolean
/**
* Migrates the given track for the manga to the newSource, if possible
*/
fun migrateTrack(track: Track, manga: Manga, newSource: Source): Track?
}

View File

@ -17,10 +17,10 @@ class Anilist(private val context: Context, id: Int) : TrackService(id) {
companion object {
const val READING = 1
const val COMPLETED = 2
const val PAUSED = 3
const val ON_HOLD = 3
const val DROPPED = 4
const val PLANNING = 5
const val REPEATING = 6
const val PLAN_TO_READ = 5
const val REREADING = 6
const val POINT_100 = "POINT_100"
const val POINT_10 = "POINT_10"
@ -57,24 +57,24 @@ class Anilist(private val context: Context, id: Int) : TrackService(id) {
override fun getLogoColor() = Color.rgb(18, 25, 35)
override fun getStatusList(): List<Int> {
return listOf(READING, PLANNING, COMPLETED, REPEATING, PAUSED, DROPPED)
return listOf(READING, COMPLETED, ON_HOLD, DROPPED, PLAN_TO_READ, REREADING)
}
override fun getStatus(status: Int): String = with(context) {
when (status) {
READING -> getString(R.string.reading)
PLANNING -> getString(R.string.plan_to_read)
PLAN_TO_READ -> getString(R.string.plan_to_read)
COMPLETED -> getString(R.string.completed)
REPEATING -> getString(R.string.repeating)
PAUSED -> getString(R.string.paused)
ON_HOLD -> getString(R.string.on_hold)
DROPPED -> getString(R.string.dropped)
REREADING -> getString(R.string.repeating)
else -> ""
}
}
override fun getReadingStatus(): Int = READING
override fun getRereadingStatus(): Int = REPEATING
override fun getRereadingStatus(): Int = REREADING
override fun getCompletionStatus(): Int = COMPLETED
@ -147,8 +147,16 @@ class Anilist(private val context: Context, id: Int) : TrackService(id) {
}
if (track.status != COMPLETED) {
if (track.status != REPEATING && didReadChapter) {
track.status = READING
if (didReadChapter) {
if (track.last_chapter_read.toInt() == track.total_chapters && track.total_chapters > 0) {
track.status = COMPLETED
track.finished_reading_date = System.currentTimeMillis()
} else if (track.status != REREADING) {
track.status = READING
if (track.last_chapter_read == 1F) {
track.started_reading_date = System.currentTimeMillis()
}
}
}
}
@ -162,14 +170,14 @@ class Anilist(private val context: Context, id: Int) : TrackService(id) {
track.library_id = remoteTrack.library_id
if (track.status != COMPLETED) {
val isRereading = track.status == REPEATING
val isRereading = track.status == REREADING
track.status = if (isRereading.not() && hasReadChapters) READING else track.status
}
update(track)
} else {
// Set default fields if it's not found in the list
track.status = if (hasReadChapters) READING else PLANNING
track.status = if (hasReadChapters) READING else PLAN_TO_READ
track.score = 0F
add(track)
}

View File

@ -6,7 +6,7 @@ import eu.kanade.tachiyomi.data.database.models.Track
import eu.kanade.tachiyomi.data.track.model.TrackSearch
import eu.kanade.tachiyomi.network.POST
import eu.kanade.tachiyomi.network.await
import eu.kanade.tachiyomi.network.interceptor.RateLimitInterceptor
import eu.kanade.tachiyomi.network.interceptor.rateLimit
import eu.kanade.tachiyomi.network.jsonMime
import eu.kanade.tachiyomi.network.parseAs
import eu.kanade.tachiyomi.util.lang.withIOContext
@ -25,13 +25,13 @@ import kotlinx.serialization.json.putJsonObject
import okhttp3.OkHttpClient
import okhttp3.RequestBody.Companion.toRequestBody
import java.util.Calendar
import java.util.concurrent.TimeUnit.MINUTES
import java.util.concurrent.TimeUnit
class AnilistApi(val client: OkHttpClient, interceptor: AnilistInterceptor) {
private val authClient = client.newBuilder()
.addInterceptor(interceptor)
.addInterceptor(RateLimitInterceptor(85, 1, MINUTES))
.rateLimit(permits = 85, period = 1, unit = TimeUnit.MINUTES)
.build()
suspend fun addLibManga(track: Track): Track {

View File

@ -2,6 +2,7 @@ package eu.kanade.tachiyomi.data.track.anilist
import okhttp3.Interceptor
import okhttp3.Response
import java.io.IOException
class AnilistInterceptor(val anilist: Anilist, private var token: String?) : Interceptor {
@ -28,12 +29,12 @@ class AnilistInterceptor(val anilist: Anilist, private var token: String?) : Int
// Refresh access token if null or expired.
if (oauth!!.isExpired()) {
anilist.logout()
throw Exception("Token expired")
throw IOException("Token expired")
}
// Throw on null auth.
if (oauth == null) {
throw Exception("No authentication token")
throw IOException("No authentication token")
}
// Add the authorization header to the original request.

View File

@ -64,10 +64,10 @@ data class ALUserManga(
fun toTrackStatus() = when (list_status) {
"CURRENT" -> Anilist.READING
"COMPLETED" -> Anilist.COMPLETED
"PAUSED" -> Anilist.PAUSED
"PAUSED" -> Anilist.ON_HOLD
"DROPPED" -> Anilist.DROPPED
"PLANNING" -> Anilist.PLANNING
"REPEATING" -> Anilist.REPEATING
"PLANNING" -> Anilist.PLAN_TO_READ
"REPEATING" -> Anilist.REREADING
else -> throw NotImplementedError("Unknown status: $list_status")
}
}
@ -75,10 +75,10 @@ data class ALUserManga(
fun Track.toAnilistStatus() = when (status) {
Anilist.READING -> "CURRENT"
Anilist.COMPLETED -> "COMPLETED"
Anilist.PAUSED -> "PAUSED"
Anilist.ON_HOLD -> "PAUSED"
Anilist.DROPPED -> "DROPPED"
Anilist.PLANNING -> "PLANNING"
Anilist.REPEATING -> "REPEATING"
Anilist.PLAN_TO_READ -> "PLANNING"
Anilist.REREADING -> "REPEATING"
else -> throw NotImplementedError("Unknown status: $status")
}

View File

@ -38,7 +38,11 @@ class Bangumi(private val context: Context, id: Int) : TrackService(id) {
override suspend fun update(track: Track, didReadChapter: Boolean): Track {
if (track.status != COMPLETED) {
if (didReadChapter) {
track.status = READING
if (track.last_chapter_read.toInt() == track.total_chapters && track.total_chapters > 0) {
track.status = COMPLETED
} else {
track.status = READING
}
}
}
@ -62,7 +66,7 @@ class Bangumi(private val context: Context, id: Int) : TrackService(id) {
refresh(track)
} else {
// Set default fields if it's not found in the list
track.status = if (hasReadChapters) READING else PLANNING
track.status = if (hasReadChapters) READING else PLAN_TO_READ
track.score = 0F
add(track)
update(track)
@ -87,16 +91,16 @@ class Bangumi(private val context: Context, id: Int) : TrackService(id) {
override fun getLogoColor() = Color.rgb(240, 145, 153)
override fun getStatusList(): List<Int> {
return listOf(READING, COMPLETED, ON_HOLD, DROPPED, PLANNING)
return listOf(READING, COMPLETED, ON_HOLD, DROPPED, PLAN_TO_READ)
}
override fun getStatus(status: Int): String = with(context) {
when (status) {
READING -> getString(R.string.reading)
PLAN_TO_READ -> getString(R.string.plan_to_read)
COMPLETED -> getString(R.string.completed)
ON_HOLD -> getString(R.string.on_hold)
DROPPED -> getString(R.string.dropped)
PLANNING -> getString(R.string.plan_to_read)
else -> ""
}
}
@ -142,6 +146,6 @@ class Bangumi(private val context: Context, id: Int) : TrackService(id) {
const val COMPLETED = 2
const val ON_HOLD = 4
const val DROPPED = 5
const val PLANNING = 1
const val PLAN_TO_READ = 1
}
}

View File

@ -24,6 +24,7 @@ import okhttp3.OkHttpClient
import okhttp3.Request
import uy.kohesive.injekt.injectLazy
import java.net.URLEncoder
import java.nio.charset.StandardCharsets
class BangumiApi(private val client: OkHttpClient, interceptor: BangumiInterceptor) {
@ -70,7 +71,7 @@ class BangumiApi(private val client: OkHttpClient, interceptor: BangumiIntercept
suspend fun search(search: String): List<TrackSearch> {
return withIOContext {
val url = "$apiUrl/search/subject/${URLEncoder.encode(search, Charsets.UTF_8.name())}"
val url = "$apiUrl/search/subject/${URLEncoder.encode(search, StandardCharsets.UTF_8.name())}"
.toUri()
.buildUpon()
.appendQueryParameter("max_results", "20")

View File

@ -16,15 +16,6 @@ class BangumiInterceptor(val bangumi: Bangumi) : Interceptor {
*/
private var oauth: OAuth? = bangumi.restoreToken()
fun addToken(token: String, oidFormBody: FormBody): FormBody {
val newFormBody = FormBody.Builder()
for (i in 0 until oidFormBody.size) {
newFormBody.add(oidFormBody.name(i), oidFormBody.value(i))
}
newFormBody.add("access_token", token)
return newFormBody.build()
}
override fun intercept(chain: Interceptor.Chain): Response {
val originalRequest = chain.request()
@ -65,4 +56,13 @@ class BangumiInterceptor(val bangumi: Bangumi) : Interceptor {
bangumi.saveToken(oauth)
}
private fun addToken(token: String, oidFormBody: FormBody): FormBody {
val newFormBody = FormBody.Builder()
for (i in 0 until oidFormBody.size) {
newFormBody.add(oidFormBody.name(i), oidFormBody.value(i))
}
newFormBody.add("access_token", token)
return newFormBody.build()
}
}

View File

@ -7,7 +7,7 @@ fun Track.toBangumiStatus() = when (status) {
Bangumi.COMPLETED -> "collect"
Bangumi.ON_HOLD -> "on_hold"
Bangumi.DROPPED -> "dropped"
Bangumi.PLANNING -> "wish"
Bangumi.PLAN_TO_READ -> "wish"
else -> throw NotImplementedError("Unknown status: $status")
}
@ -16,6 +16,6 @@ fun toTrackStatus(status: String) = when (status) {
"collect" -> Bangumi.COMPLETED
"on_hold" -> Bangumi.ON_HOLD
"dropped" -> Bangumi.DROPPED
"wish" -> Bangumi.PLANNING
"wish" -> Bangumi.PLAN_TO_READ
else -> throw NotImplementedError("Unknown status: $status")
}

View File

@ -3,7 +3,8 @@ package eu.kanade.tachiyomi.data.track.job
import android.content.Context
import androidx.core.content.edit
import eu.kanade.tachiyomi.data.database.models.Track
import timber.log.Timber
import eu.kanade.tachiyomi.util.system.logcat
import logcat.LogPriority
class DelayedTrackingStore(context: Context) {
@ -17,7 +18,7 @@ class DelayedTrackingStore(context: Context) {
val (_, lastChapterRead) = preferences.getString(trackId, "0:0.0")!!.split(":")
if (track.last_chapter_read > lastChapterRead.toFloat()) {
val value = "${track.manga_id}:${track.last_chapter_read}"
Timber.i("Queuing track item: $trackId, $value")
logcat(LogPriority.DEBUG) { "Queuing track item: $trackId, $value" }
preferences.edit {
putString(trackId, value)
}
@ -30,6 +31,7 @@ class DelayedTrackingStore(context: Context) {
}
}
@Suppress("UNCHECKED_CAST")
fun getItems(): List<DelayedTrackingItem> {
return (preferences.all as Map<String, String>).entries
.map {

View File

@ -11,9 +11,10 @@ import androidx.work.WorkManager
import androidx.work.WorkerParameters
import eu.kanade.tachiyomi.data.database.DatabaseHelper
import eu.kanade.tachiyomi.data.track.TrackManager
import eu.kanade.tachiyomi.util.system.logcat
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
import timber.log.Timber
import logcat.LogPriority
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
import java.util.concurrent.TimeUnit
@ -44,7 +45,7 @@ class DelayedTrackingUpdateJob(context: Context, workerParams: WorkerParameters)
db.insertTrack(track).executeAsBlocking()
}
} catch (e: Exception) {
Timber.e(e)
logcat(LogPriority.ERROR, e)
}
}

View File

@ -39,13 +39,13 @@ class Kitsu(private val context: Context, id: Int) : TrackService(id) {
override fun getLogoColor() = Color.rgb(51, 37, 50)
override fun getStatusList(): List<Int> {
return listOf(READING, PLAN_TO_READ, COMPLETED, ON_HOLD, DROPPED)
return listOf(READING, COMPLETED, ON_HOLD, DROPPED, PLAN_TO_READ)
}
override fun getStatus(status: Int): String = with(context) {
when (status) {
READING -> getString(R.string.currently_reading)
PLAN_TO_READ -> getString(R.string.want_to_read)
READING -> getString(R.string.reading)
PLAN_TO_READ -> getString(R.string.plan_to_read)
COMPLETED -> getString(R.string.completed)
ON_HOLD -> getString(R.string.on_hold)
DROPPED -> getString(R.string.dropped)
@ -80,7 +80,15 @@ class Kitsu(private val context: Context, id: Int) : TrackService(id) {
override suspend fun update(track: Track, didReadChapter: Boolean): Track {
if (track.status != COMPLETED) {
if (didReadChapter) {
track.status = READING
if (track.last_chapter_read.toInt() == track.total_chapters && track.total_chapters > 0) {
track.status = COMPLETED
track.finished_reading_date = System.currentTimeMillis()
} else {
track.status = READING
if (track.last_chapter_read == 1F) {
track.started_reading_date = System.currentTimeMillis()
}
}
}
}

View File

@ -24,6 +24,8 @@ import okhttp3.OkHttpClient
import okhttp3.Request
import okhttp3.RequestBody
import okhttp3.RequestBody.Companion.toRequestBody
import java.net.URLEncoder
import java.nio.charset.StandardCharsets
class KitsuApi(private val client: OkHttpClient, interceptor: KitsuInterceptor) {
@ -125,7 +127,7 @@ class KitsuApi(private val client: OkHttpClient, interceptor: KitsuInterceptor)
private suspend fun algoliaSearch(key: String, query: String): List<TrackSearch> {
return withIOContext {
val jsonObject = buildJsonObject {
put("params", "query=$query$algoliaFilter")
put("params", "query=${URLEncoder.encode(query, StandardCharsets.UTF_8.name())}$algoliaFilter")
}
client.newCall(

View File

@ -10,6 +10,7 @@ import eu.kanade.tachiyomi.data.track.EnhancedTrackService
import eu.kanade.tachiyomi.data.track.NoLoginTrackService
import eu.kanade.tachiyomi.data.track.TrackService
import eu.kanade.tachiyomi.data.track.model.TrackSearch
import eu.kanade.tachiyomi.source.Source
import okhttp3.Dns
import okhttp3.OkHttpClient
@ -40,7 +41,7 @@ class Komga(private val context: Context, id: Int) : TrackService(id), EnhancedT
override fun getStatus(status: Int): String = with(context) {
when (status) {
UNREAD -> getString(R.string.unread)
READING -> getString(R.string.currently_reading)
READING -> getString(R.string.reading)
COMPLETED -> getString(R.string.completed)
else -> ""
}
@ -59,7 +60,11 @@ class Komga(private val context: Context, id: Int) : TrackService(id), EnhancedT
override suspend fun update(track: Track, didReadChapter: Boolean): Track {
if (track.status != COMPLETED) {
if (didReadChapter) {
track.status = READING
if (track.last_chapter_read.toInt() == track.total_chapters && track.total_chapters > 0) {
track.status = COMPLETED
} else {
track.status = READING
}
}
}
@ -99,4 +104,14 @@ class Komga(private val context: Context, id: Int) : TrackService(id), EnhancedT
} catch (e: Exception) {
null
}
override fun isTrackFrom(track: Track, manga: Manga, source: Source?): Boolean =
track.tracking_url == manga.url && source?.let { accept(it) } == true
override fun migrateTrack(track: Track, manga: Manga, newSource: Source): Track? =
if (accept(newSource)) {
track.also { track.tracking_url = manga.url }
} else {
null
}
}

View File

@ -7,13 +7,14 @@ import eu.kanade.tachiyomi.network.GET
import eu.kanade.tachiyomi.network.await
import eu.kanade.tachiyomi.network.parseAs
import eu.kanade.tachiyomi.util.lang.withIOContext
import eu.kanade.tachiyomi.util.system.logcat
import kotlinx.serialization.encodeToString
import kotlinx.serialization.json.Json
import logcat.LogPriority
import okhttp3.MediaType.Companion.toMediaType
import okhttp3.OkHttpClient
import okhttp3.Request
import okhttp3.RequestBody.Companion.toRequestBody
import timber.log.Timber
import uy.kohesive.injekt.injectLazy
const val READLIST_API = "/api/v1/readlists"
@ -47,7 +48,7 @@ class KomgaApi(private val client: OkHttpClient) {
track.apply {
cover_url = "$url/thumbnail"
tracking_url = url
total_chapters = progress.booksCount
total_chapters = progress.maxNumberSort.toInt()
status = when (progress.booksCount) {
progress.booksUnreadCount -> Komga.UNREAD
progress.booksReadCount -> Komga.COMPLETED
@ -56,7 +57,7 @@ class KomgaApi(private val client: OkHttpClient) {
last_chapter_read = progress.lastReadContinuousNumberSort
}
} catch (e: Exception) {
Timber.w(e, "Could not get item: $url")
logcat(LogPriority.WARN, e) { "Could not get item: $url" }
throw e
}
}

View File

@ -91,7 +91,8 @@ data class ReadProgressDto(
booksReadCount,
booksUnreadCount,
booksInProgressCount,
lastReadContinuousIndex.toFloat()
lastReadContinuousIndex.toFloat(),
booksCount.toFloat(),
)
}
@ -102,4 +103,5 @@ data class ReadProgressV2Dto(
val booksUnreadCount: Int,
val booksInProgressCount: Int,
val lastReadContinuousNumberSort: Float,
val maxNumberSort: Float,
)

View File

@ -47,10 +47,10 @@ class MyAnimeList(private val context: Context, id: Int) : TrackService(id) {
override fun getStatus(status: Int): String = with(context) {
when (status) {
READING -> getString(R.string.reading)
PLAN_TO_READ -> getString(R.string.plan_to_read)
COMPLETED -> getString(R.string.completed)
ON_HOLD -> getString(R.string.on_hold)
DROPPED -> getString(R.string.dropped)
PLAN_TO_READ -> getString(R.string.plan_to_read)
REREADING -> getString(R.string.repeating)
else -> ""
}
@ -76,8 +76,16 @@ class MyAnimeList(private val context: Context, id: Int) : TrackService(id) {
override suspend fun update(track: Track, didReadChapter: Boolean): Track {
if (track.status != COMPLETED) {
if (track.status != REREADING && didReadChapter) {
track.status = READING
if (didReadChapter) {
if (track.last_chapter_read.toInt() == track.total_chapters && track.total_chapters > 0) {
track.status = COMPLETED
track.finished_reading_date = System.currentTimeMillis()
} else if (track.status != REREADING) {
track.status = READING
if (track.last_chapter_read == 1F) {
track.started_reading_date = System.currentTimeMillis()
}
}
}
}

View File

@ -62,7 +62,8 @@ class MyAnimeListApi(private val client: OkHttpClient, interceptor: MyAnimeListI
suspend fun search(query: String): List<TrackSearch> {
return withIOContext {
val url = "$baseApiUrl/manga".toUri().buildUpon()
.appendQueryParameter("q", query)
// MAL API throws a 400 when the query is over 64 characters...
.appendQueryParameter("q", query.take(64))
.appendQueryParameter("nsfw", "true")
.build()
authClient.newCall(GET(url.toString()))
@ -76,7 +77,7 @@ class MyAnimeListApi(private val client: OkHttpClient, interceptor: MyAnimeListI
async { getMangaDetails(id) }
}
.awaitAll()
.filter { trackSearch -> trackSearch.publishing_type != "novel" }
.filter { trackSearch -> !trackSearch.publishing_type.contains("novel") }
}
}
}

View File

@ -5,6 +5,7 @@ import kotlinx.serialization.json.Json
import okhttp3.Interceptor
import okhttp3.Response
import uy.kohesive.injekt.injectLazy
import java.io.IOException
class MyAnimeListInterceptor(private val myanimelist: MyAnimeList, private var token: String?) : Interceptor {
@ -16,7 +17,7 @@ class MyAnimeListInterceptor(private val myanimelist: MyAnimeList, private var t
val originalRequest = chain.request()
if (token.isNullOrEmpty()) {
throw Exception("Not authenticated with MyAnimeList")
throw IOException("Not authenticated with MyAnimeList")
}
if (oauth == null) {
oauth = myanimelist.loadOAuth()
@ -30,7 +31,7 @@ class MyAnimeListInterceptor(private val myanimelist: MyAnimeList, private var t
}
}
if (oauth == null) {
throw Exception("No authentication token")
throw IOException("No authentication token")
}
// Add the authorization header to the original request

View File

@ -19,8 +19,8 @@ class Shikimori(private val context: Context, id: Int) : TrackService(id) {
const val COMPLETED = 2
const val ON_HOLD = 3
const val DROPPED = 4
const val PLANNING = 5
const val REPEATING = 6
const val PLAN_TO_READ = 5
const val REREADING = 6
}
private val json: Json by injectLazy()
@ -46,8 +46,12 @@ class Shikimori(private val context: Context, id: Int) : TrackService(id) {
override suspend fun update(track: Track, didReadChapter: Boolean): Track {
if (track.status != COMPLETED) {
if (track.status != REPEATING && didReadChapter) {
track.status = READING
if (didReadChapter) {
if (track.last_chapter_read.toInt() == track.total_chapters && track.total_chapters > 0) {
track.status = COMPLETED
} else if (track.status != REREADING) {
track.status = READING
}
}
}
@ -61,14 +65,14 @@ class Shikimori(private val context: Context, id: Int) : TrackService(id) {
track.library_id = remoteTrack.library_id
if (track.status != COMPLETED) {
val isRereading = track.status == REPEATING
val isRereading = track.status == REREADING
track.status = if (isRereading.not() && hasReadChapters) READING else track.status
}
update(track)
} else {
// Set default fields if it's not found in the list
track.status = if (hasReadChapters) READING else PLANNING
track.status = if (hasReadChapters) READING else PLAN_TO_READ
track.score = 0F
add(track)
}
@ -91,24 +95,24 @@ class Shikimori(private val context: Context, id: Int) : TrackService(id) {
override fun getLogoColor() = Color.rgb(40, 40, 40)
override fun getStatusList(): List<Int> {
return listOf(READING, COMPLETED, ON_HOLD, DROPPED, PLANNING, REPEATING)
return listOf(READING, COMPLETED, ON_HOLD, DROPPED, PLAN_TO_READ, REREADING)
}
override fun getStatus(status: Int): String = with(context) {
when (status) {
READING -> getString(R.string.reading)
PLAN_TO_READ -> getString(R.string.plan_to_read)
COMPLETED -> getString(R.string.completed)
ON_HOLD -> getString(R.string.on_hold)
DROPPED -> getString(R.string.dropped)
PLANNING -> getString(R.string.plan_to_read)
REPEATING -> getString(R.string.repeating)
REREADING -> getString(R.string.repeating)
else -> ""
}
}
override fun getReadingStatus(): Int = READING
override fun getRereadingStatus(): Int = REPEATING
override fun getRereadingStatus(): Int = REREADING
override fun getCompletionStatus(): Int = COMPLETED

View File

@ -7,8 +7,8 @@ fun Track.toShikimoriStatus() = when (status) {
Shikimori.COMPLETED -> "completed"
Shikimori.ON_HOLD -> "on_hold"
Shikimori.DROPPED -> "dropped"
Shikimori.PLANNING -> "planned"
Shikimori.REPEATING -> "rewatching"
Shikimori.PLAN_TO_READ -> "planned"
Shikimori.REREADING -> "rewatching"
else -> throw NotImplementedError("Unknown status: $status")
}
@ -17,7 +17,7 @@ fun toTrackStatus(status: String) = when (status) {
"completed" -> Shikimori.COMPLETED
"on_hold" -> Shikimori.ON_HOLD
"dropped" -> Shikimori.DROPPED
"planned" -> Shikimori.PLANNING
"rewatching" -> Shikimori.REPEATING
"planned" -> Shikimori.PLAN_TO_READ
"rewatching" -> Shikimori.REREADING
else -> throw NotImplementedError("Unknown status: $status")
}

View File

@ -1,5 +1,6 @@
package eu.kanade.tachiyomi.data.updater
import android.content.Context
import eu.kanade.tachiyomi.BuildConfig
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
import eu.kanade.tachiyomi.network.GET
@ -9,24 +10,22 @@ import eu.kanade.tachiyomi.network.parseAs
import eu.kanade.tachiyomi.util.lang.withIOContext
import uy.kohesive.injekt.injectLazy
import java.util.Date
import java.util.concurrent.TimeUnit
class AppUpdateChecker {
private val networkService: NetworkHelper by injectLazy()
private val preferences: PreferencesHelper by injectLazy()
private val repo: String by lazy {
if (BuildConfig.DEBUG) {
"tachiyomiorg/tachiyomi-preview"
} else {
"tachiyomiorg/tachiyomi"
suspend fun checkForUpdate(context: Context, isUserPrompt: Boolean = false): AppUpdateResult {
// Limit checks to once a day at most
if (isUserPrompt.not() && Date().time < preferences.lastAppCheck().get() + TimeUnit.DAYS.toMillis(1)) {
return AppUpdateResult.NoNewUpdate
}
}
suspend fun checkForUpdate(): AppUpdateResult {
return withIOContext {
networkService.client
.newCall(GET("https://api.github.com/repos/$repo/releases/latest"))
val result = networkService.client
.newCall(GET("https://api.github.com/repos/$GITHUB_REPO/releases/latest"))
.await()
.parseAs<GithubRelease>()
.let {
@ -39,6 +38,12 @@ class AppUpdateChecker {
AppUpdateResult.NoNewUpdate
}
}
if (result is AppUpdateResult.NewUpdate) {
AppUpdateNotifier(context).promptUpdate(result.release)
}
result
}
}
@ -46,7 +51,7 @@ class AppUpdateChecker {
// Removes prefixes like "r" or "v"
val newVersion = versionTag.replace("[^\\d.]".toRegex(), "")
return if (BuildConfig.DEBUG) {
return if (BuildConfig.PREVIEW) {
// Preview builds: based on releases in "tachiyomiorg/tachiyomi-preview" repo
// tagged as something like "r1234"
newVersion.toInt() > BuildConfig.COMMIT_COUNT.toInt()
@ -57,3 +62,21 @@ class AppUpdateChecker {
}
}
}
val GITHUB_REPO: String by lazy {
if (BuildConfig.PREVIEW) {
"tachiyomiorg/tachiyomi-preview"
} else {
"tachiyomiorg/tachiyomi"
}
}
val RELEASE_TAG: String by lazy {
if (BuildConfig.PREVIEW) {
"r${BuildConfig.COMMIT_COUNT}"
} else {
"v${BuildConfig.VERSION_NAME}"
}
}
val RELEASE_URL = "https://github.com/$GITHUB_REPO/releases/tag/$RELEASE_TAG"

View File

@ -2,28 +2,27 @@ package eu.kanade.tachiyomi.data.updater
import android.content.Context
import androidx.work.Constraints
import androidx.work.CoroutineWorker
import androidx.work.ExistingPeriodicWorkPolicy
import androidx.work.NetworkType
import androidx.work.PeriodicWorkRequestBuilder
import androidx.work.WorkManager
import androidx.work.Worker
import androidx.work.WorkerParameters
import eu.kanade.tachiyomi.BuildConfig
import kotlinx.coroutines.runBlocking
import eu.kanade.tachiyomi.util.system.logcat
import kotlinx.coroutines.coroutineScope
import logcat.LogPriority
import java.util.concurrent.TimeUnit
class UpdaterJob(private val context: Context, workerParams: WorkerParameters) :
Worker(context, workerParams) {
class AppUpdateJob(private val context: Context, workerParams: WorkerParameters) :
CoroutineWorker(context, workerParams) {
override fun doWork() = runBlocking {
override suspend fun doWork() = coroutineScope {
try {
val result = AppUpdateChecker().checkForUpdate()
if (result is AppUpdateResult.NewUpdate) {
UpdaterNotifier(context).promptUpdate(result.release.getDownloadLink())
}
AppUpdateChecker().checkForUpdate(context)
Result.success()
} catch (e: Exception) {
logcat(LogPriority.ERROR, e)
Result.failure()
}
}
@ -32,8 +31,8 @@ class UpdaterJob(private val context: Context, workerParams: WorkerParameters) :
private const val TAG = "UpdateChecker"
fun setupTask(context: Context) {
// Never check for updates in debug builds that don't include the updater
if (BuildConfig.DEBUG && !BuildConfig.INCLUDE_UPDATER) {
// Never check for updates in builds that don't include the updater
if (!BuildConfig.INCLUDE_UPDATER) {
cancelTask(context)
return
}
@ -42,7 +41,7 @@ class UpdaterJob(private val context: Context, workerParams: WorkerParameters) :
.setRequiredNetworkType(NetworkType.CONNECTED)
.build()
val request = PeriodicWorkRequestBuilder<UpdaterJob>(
val request = PeriodicWorkRequestBuilder<AppUpdateJob>(
7,
TimeUnit.DAYS,
3,

View File

@ -5,6 +5,7 @@ import android.content.Context
import android.content.Intent
import android.net.Uri
import androidx.core.app.NotificationCompat
import androidx.core.net.toUri
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.notification.NotificationHandler
import eu.kanade.tachiyomi.data.notification.NotificationReceiver
@ -12,40 +13,46 @@ import eu.kanade.tachiyomi.data.notification.Notifications
import eu.kanade.tachiyomi.util.system.notificationBuilder
import eu.kanade.tachiyomi.util.system.notificationManager
/**
* DownloadNotifier is used to show notifications when downloading and update.
*
* @param context context of application.
*/
internal class UpdaterNotifier(private val context: Context) {
internal class AppUpdateNotifier(private val context: Context) {
private val notificationBuilder = context.notificationBuilder(Notifications.CHANNEL_COMMON)
private val notificationBuilder = context.notificationBuilder(Notifications.CHANNEL_APP_UPDATE)
/**
* Call to show notification.
*
* @param id id of the notification channel.
*/
private fun NotificationCompat.Builder.show(id: Int = Notifications.ID_UPDATER) {
private fun NotificationCompat.Builder.show(id: Int = Notifications.ID_APP_UPDATER) {
context.notificationManager.notify(id, build())
}
fun promptUpdate(url: String) {
val intent = Intent(context, UpdaterService::class.java).apply {
putExtra(UpdaterService.EXTRA_DOWNLOAD_URL, url)
fun promptUpdate(release: GithubRelease) {
val intent = Intent(context, AppUpdateService::class.java).apply {
putExtra(AppUpdateService.EXTRA_DOWNLOAD_URL, release.getDownloadLink())
}
val pendingIntent = PendingIntent.getService(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT)
val updateIntent = PendingIntent.getService(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT)
val releaseIntent = Intent(Intent.ACTION_VIEW, release.releaseLink.toUri()).apply {
flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP
}
val releaseInfoIntent = PendingIntent.getActivity(context, release.hashCode(), releaseIntent, PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE)
with(notificationBuilder) {
setContentTitle(context.getString(R.string.app_name))
setContentText(context.getString(R.string.update_check_notification_update_available))
setContentTitle(context.getString(R.string.update_check_notification_update_available))
setContentText(release.version)
setSmallIcon(android.R.drawable.stat_sys_download_done)
setContentIntent(pendingIntent)
setContentIntent(updateIntent)
clearActions()
addAction(
android.R.drawable.stat_sys_download_done,
context.getString(R.string.action_download),
pendingIntent
updateIntent,
)
addAction(
R.drawable.ic_info_24dp,
context.getString(R.string.whats_new),
releaseInfoIntent,
)
}
notificationBuilder.show()
@ -103,7 +110,7 @@ internal class UpdaterNotifier(private val context: Context) {
addAction(
R.drawable.ic_close_24dp,
context.getString(R.string.action_cancel),
NotificationReceiver.dismissNotificationPendingBroadcast(context, Notifications.ID_UPDATER)
NotificationReceiver.dismissNotificationPendingBroadcast(context, Notifications.ID_APP_UPDATER)
)
}
notificationBuilder.show()
@ -117,7 +124,7 @@ internal class UpdaterNotifier(private val context: Context) {
fun onDownloadError(url: String) {
with(notificationBuilder) {
setContentText(context.getString(R.string.update_check_notification_download_error))
setSmallIcon(android.R.drawable.stat_sys_warning)
setSmallIcon(R.drawable.ic_warning_white_24dp)
setOnlyAlertOnce(false)
setProgress(0, 0, false)
@ -125,14 +132,14 @@ internal class UpdaterNotifier(private val context: Context) {
addAction(
R.drawable.ic_refresh_24dp,
context.getString(R.string.action_retry),
UpdaterService.downloadApkPendingService(context, url)
AppUpdateService.downloadApkPendingService(context, url)
)
addAction(
R.drawable.ic_close_24dp,
context.getString(R.string.action_cancel),
NotificationReceiver.dismissNotificationPendingBroadcast(context, Notifications.ID_UPDATER)
NotificationReceiver.dismissNotificationPendingBroadcast(context, Notifications.ID_APP_UPDATER)
)
}
notificationBuilder.show(Notifications.ID_UPDATER)
notificationBuilder.show(Notifications.ID_APP_UPDATER)
}
}

View File

@ -20,11 +20,12 @@ import eu.kanade.tachiyomi.util.storage.getUriCompat
import eu.kanade.tachiyomi.util.storage.saveTo
import eu.kanade.tachiyomi.util.system.acquireWakeLock
import eu.kanade.tachiyomi.util.system.isServiceRunning
import timber.log.Timber
import eu.kanade.tachiyomi.util.system.logcat
import logcat.LogPriority
import uy.kohesive.injekt.injectLazy
import java.io.File
class UpdaterService : Service() {
class AppUpdateService : Service() {
private val network: NetworkHelper by injectLazy()
@ -33,15 +34,15 @@ class UpdaterService : Service() {
*/
private lateinit var wakeLock: PowerManager.WakeLock
private lateinit var notifier: UpdaterNotifier
private lateinit var notifier: AppUpdateNotifier
override fun onCreate() {
super.onCreate()
notifier = UpdaterNotifier(this)
notifier = AppUpdateNotifier(this)
wakeLock = acquireWakeLock(javaClass.name)
startForeground(Notifications.ID_UPDATER, notifier.onDownloadStarted().build())
startForeground(Notifications.ID_APP_UPDATER, notifier.onDownloadStarted().build())
}
/**
@ -121,7 +122,7 @@ class UpdaterService : Service() {
}
notifier.onDownloadFinished(apkFile.getUriCompat(this))
} catch (error: Exception) {
Timber.e(error)
logcat(LogPriority.ERROR, error)
notifier.onDownloadError(url)
}
}
@ -138,7 +139,7 @@ class UpdaterService : Service() {
* @return true if the service is running, false otherwise.
*/
private fun isRunning(context: Context): Boolean =
context.isServiceRunning(UpdaterService::class.java)
context.isServiceRunning(AppUpdateService::class.java)
/**
* Downloads a new update and let the user install the new version from a notification.
@ -148,7 +149,7 @@ class UpdaterService : Service() {
*/
fun start(context: Context, url: String, title: String = context.getString(R.string.app_name)) {
if (!isRunning(context)) {
val intent = Intent(context, UpdaterService::class.java).apply {
val intent = Intent(context, AppUpdateService::class.java).apply {
putExtra(EXTRA_DOWNLOAD_TITLE, title)
putExtra(EXTRA_DOWNLOAD_URL, url)
}
@ -163,7 +164,7 @@ class UpdaterService : Service() {
* @return [PendingIntent]
*/
internal fun downloadApkPendingService(context: Context, url: String): PendingIntent {
val intent = Intent(context, UpdaterService::class.java).apply {
val intent = Intent(context, AppUpdateService::class.java).apply {
putExtra(EXTRA_DOWNLOAD_URL, url)
}
return PendingIntent.getService(context, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT)

View File

@ -5,17 +5,13 @@ import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
/**
* Release object.
* Contains information about the latest release from GitHub.
*
* @param version version of latest release.
* @param info log of latest release.
* @param assets assets of latest release.
*/
@Serializable
class GithubRelease(
data class GithubRelease(
@SerialName("tag_name") val version: String,
@SerialName("body") val info: String,
@SerialName("html_url") val releaseLink: String,
@SerialName("assets") private val assets: List<Assets>
) {
@ -37,8 +33,7 @@ class GithubRelease(
/**
* Assets class containing download url.
* @param downloadLink download url.
*/
@Serializable
class Assets(@SerialName("browser_download_url") val downloadLink: String)
data class Assets(@SerialName("browser_download_url") val downloadLink: String)
}

View File

@ -3,8 +3,8 @@ package eu.kanade.tachiyomi.extension
import android.content.Context
import android.graphics.drawable.Drawable
import com.jakewharton.rxrelay.BehaviorRelay
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
import eu.kanade.tachiyomi.data.preference.plusAssign
import eu.kanade.tachiyomi.extension.api.ExtensionGithubApi
import eu.kanade.tachiyomi.extension.model.Extension
import eu.kanade.tachiyomi.extension.model.InstallStep
@ -15,8 +15,11 @@ import eu.kanade.tachiyomi.extension.util.ExtensionLoader
import eu.kanade.tachiyomi.source.Source
import eu.kanade.tachiyomi.source.SourceManager
import eu.kanade.tachiyomi.util.lang.launchNow
import eu.kanade.tachiyomi.util.preference.plusAssign
import eu.kanade.tachiyomi.util.system.logcat
import eu.kanade.tachiyomi.util.system.toast
import kotlinx.coroutines.async
import logcat.LogPriority
import rx.Observable
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
@ -160,7 +163,8 @@ class ExtensionManager(
val extensions: List<Extension.Available> = try {
api.findExtensions()
} catch (e: Exception) {
context.toast(e.message)
logcat(LogPriority.ERROR, e)
context.toast(R.string.extension_api_error)
emptyList()
}
@ -227,14 +231,26 @@ class ExtensionManager(
return installExtension(availableExt)
}
fun cancelInstallUpdateExtension(extension: Extension) {
installer.cancelInstall(extension.pkgName)
}
/**
* Sets the result of the installation of an extension.
* Sets to "installing" status of an extension installation.
*
* @param downloadId The id of the download.
* @param result Whether the extension was installed or not.
*/
fun setInstalling(downloadId: Long) {
installer.updateInstallStep(downloadId, InstallStep.Installing)
}
fun setInstallationResult(downloadId: Long, result: Boolean) {
installer.setInstallationResult(downloadId, result)
val step = if (result) InstallStep.Installed else InstallStep.Error
installer.updateInstallStep(downloadId, step)
}
fun updateInstallStep(downloadId: Long, step: InstallStep) {
installer.updateInstallStep(downloadId, step)
}
/**

View File

@ -15,8 +15,10 @@ import eu.kanade.tachiyomi.data.notification.NotificationReceiver
import eu.kanade.tachiyomi.data.notification.Notifications
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
import eu.kanade.tachiyomi.extension.api.ExtensionGithubApi
import eu.kanade.tachiyomi.util.system.logcat
import eu.kanade.tachiyomi.util.system.notification
import kotlinx.coroutines.coroutineScope
import logcat.LogPriority
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
import java.util.concurrent.TimeUnit
@ -28,6 +30,7 @@ class ExtensionUpdateJob(private val context: Context, workerParams: WorkerParam
val pendingUpdates = try {
ExtensionGithubApi().checkForUpdates(context)
} catch (e: Exception) {
logcat(LogPriority.ERROR, e)
return@coroutineScope Result.failure()
}
@ -42,7 +45,7 @@ class ExtensionUpdateJob(private val context: Context, workerParams: WorkerParam
NotificationManagerCompat.from(context).apply {
notify(
Notifications.ID_UPDATES_TO_EXTS,
context.notification(Notifications.CHANNEL_UPDATES_TO_EXTS) {
context.notification(Notifications.CHANNEL_EXTENSIONS_UPDATE) {
setContentTitle(
context.resources.getQuantityString(
R.plurals.update_check_notification_ext_updates,

View File

@ -2,6 +2,7 @@ package eu.kanade.tachiyomi.extension.api
import android.content.Context
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
import eu.kanade.tachiyomi.extension.model.AvailableExtensionSources
import eu.kanade.tachiyomi.extension.model.Extension
import eu.kanade.tachiyomi.extension.model.LoadResult
import eu.kanade.tachiyomi.extension.util.ExtensionLoader
@ -10,13 +11,10 @@ import eu.kanade.tachiyomi.network.NetworkHelper
import eu.kanade.tachiyomi.network.await
import eu.kanade.tachiyomi.network.parseAs
import eu.kanade.tachiyomi.util.lang.withIOContext
import kotlinx.serialization.json.JsonArray
import kotlinx.serialization.json.int
import kotlinx.serialization.json.jsonObject
import kotlinx.serialization.json.jsonPrimitive
import kotlinx.serialization.json.long
import kotlinx.serialization.Serializable
import uy.kohesive.injekt.injectLazy
import java.util.Date
import java.util.concurrent.TimeUnit
internal class ExtensionGithubApi {
@ -25,15 +23,28 @@ internal class ExtensionGithubApi {
suspend fun findExtensions(): List<Extension.Available> {
return withIOContext {
networkService.client
val extensions = networkService.client
.newCall(GET("${REPO_URL_PREFIX}index.min.json"))
.await()
.parseAs<JsonArray>()
.let { parseResponse(it) }
.parseAs<List<ExtensionJsonObject>>()
.toExtensions()
// Sanity check - a small number of extensions probably means something broke
// with the repo generator
if (extensions.size < 100) {
throw Exception()
}
extensions
}
}
suspend fun checkForUpdates(context: Context): List<Extension.Installed> {
// Limit checks to once a day at most
if (Date().time < preferences.lastExtCheck().get() + TimeUnit.DAYS.toMillis(1)) {
return emptyList()
}
val extensions = findExtensions()
preferences.lastExtCheck().set(Date().time)
@ -56,30 +67,64 @@ internal class ExtensionGithubApi {
return extensionsWithUpdate
}
private fun parseResponse(json: JsonArray): List<Extension.Available> {
return json
.filter { element ->
val versionName = element.jsonObject["version"]!!.jsonPrimitive.content
val libVersion = versionName.substringBeforeLast('.').toDouble()
private fun List<ExtensionJsonObject>.toExtensions(): List<Extension.Available> {
return this
.filter {
val libVersion = it.version.substringBeforeLast('.').toDouble()
libVersion >= ExtensionLoader.LIB_VERSION_MIN && libVersion <= ExtensionLoader.LIB_VERSION_MAX
}
.map { element ->
val name = element.jsonObject["name"]!!.jsonPrimitive.content.substringAfter("Tachiyomi: ")
val pkgName = element.jsonObject["pkg"]!!.jsonPrimitive.content
val apkName = element.jsonObject["apk"]!!.jsonPrimitive.content
val versionName = element.jsonObject["version"]!!.jsonPrimitive.content
val versionCode = element.jsonObject["code"]!!.jsonPrimitive.long
val lang = element.jsonObject["lang"]!!.jsonPrimitive.content
val nsfw = element.jsonObject["nsfw"]!!.jsonPrimitive.int == 1
val icon = "${REPO_URL_PREFIX}icon/${apkName.replace(".apk", ".png")}"
Extension.Available(name, pkgName, versionName, versionCode, lang, nsfw, apkName, icon)
.map {
Extension.Available(
name = it.name.substringAfter("Tachiyomi: "),
pkgName = it.pkg,
versionName = it.version,
versionCode = it.code,
lang = it.lang,
isNsfw = it.nsfw == 1,
hasReadme = it.hasReadme == 1,
hasChangelog = it.hasChangelog == 1,
sources = it.sources?.toExtensionSources() ?: emptyList(),
apkName = it.apk,
iconUrl = "${REPO_URL_PREFIX}icon/${it.apk.replace(".apk", ".png")}"
)
}
}
private fun List<ExtensionSourceJsonObject>.toExtensionSources(): List<AvailableExtensionSources> {
return this.map {
AvailableExtensionSources(
name = it.name,
id = it.id,
baseUrl = it.baseUrl
)
}
}
fun getApkUrl(extension: Extension.Available): String {
return "${REPO_URL_PREFIX}apk/${extension.apkName}"
}
}
private const val REPO_URL_PREFIX = "https://raw.githubusercontent.com/tachiyomiorg/tachiyomi-extensions/repo/"
@Serializable
private data class ExtensionJsonObject(
val name: String,
val pkg: String,
val apk: String,
val lang: String,
val code: Long,
val version: String,
val nsfw: Int,
val hasReadme: Int = 0,
val hasChangelog: Int = 0,
val sources: List<ExtensionSourceJsonObject>?,
)
@Serializable
private data class ExtensionSourceJsonObject(
val name: String,
val id: Long,
val baseUrl: String
)

View File

@ -0,0 +1,170 @@
package eu.kanade.tachiyomi.extension.installer
import android.app.Service
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.content.IntentFilter
import android.net.Uri
import androidx.annotation.CallSuper
import androidx.localbroadcastmanager.content.LocalBroadcastManager
import eu.kanade.tachiyomi.extension.ExtensionManager
import eu.kanade.tachiyomi.extension.model.InstallStep
import uy.kohesive.injekt.injectLazy
import java.util.Collections
import java.util.concurrent.atomic.AtomicReference
/**
* Base implementation class for extension installer. To be used inside a foreground [Service].
*/
abstract class Installer(private val service: Service) {
private val extensionManager: ExtensionManager by injectLazy()
private var waitingInstall = AtomicReference<Entry>(null)
private val queue = Collections.synchronizedList(mutableListOf<Entry>())
private val cancelReceiver = object : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent) {
val downloadId = intent.getLongExtra(EXTRA_DOWNLOAD_ID, -1).takeIf { it >= 0 } ?: return
cancelQueue(downloadId)
}
}
/**
* Installer readiness. If false, queue check will not run.
*
* @see checkQueue
*/
abstract var ready: Boolean
/**
* Add an item to install queue.
*
* @param downloadId Download ID as known by [ExtensionManager]
* @param uri Uri of APK to install
*/
fun addToQueue(downloadId: Long, uri: Uri) {
queue.add(Entry(downloadId, uri))
checkQueue()
}
/**
* Proceeds to install the APK of this entry inside this method. Call [continueQueue]
* when the install process for this entry is finished to continue the queue.
*
* @param entry The [Entry] of item to process
* @see continueQueue
*/
@CallSuper
open fun processEntry(entry: Entry) {
extensionManager.setInstalling(entry.downloadId)
}
/**
* Called before queue continues. Override this to handle when the removed entry is
* currently being processed.
*
* @return true if this entry can be removed from queue.
*/
open fun cancelEntry(entry: Entry): Boolean {
return true
}
/**
* Tells the queue to continue processing the next entry and updates the install step
* of the completed entry ([waitingInstall]) to [ExtensionManager].
*
* @param resultStep new install step for the processed entry.
* @see waitingInstall
*/
fun continueQueue(resultStep: InstallStep) {
val completedEntry = waitingInstall.getAndSet(null)
if (completedEntry != null) {
extensionManager.updateInstallStep(completedEntry.downloadId, resultStep)
checkQueue()
}
}
/**
* Checks the queue. The provided service will be stopped if the queue is empty.
* Will not be run when not ready.
*
* @see ready
*/
fun checkQueue() {
if (!ready) {
return
}
if (queue.isEmpty()) {
service.stopSelf()
return
}
val nextEntry = queue.first()
if (waitingInstall.compareAndSet(null, nextEntry)) {
queue.removeFirst()
processEntry(nextEntry)
}
}
/**
* Call this method when the provided service is destroyed.
*/
@CallSuper
open fun onDestroy() {
LocalBroadcastManager.getInstance(service).unregisterReceiver(cancelReceiver)
queue.forEach { extensionManager.updateInstallStep(it.downloadId, InstallStep.Error) }
queue.clear()
waitingInstall.set(null)
}
protected fun getActiveEntry(): Entry? = waitingInstall.get()
/**
* Cancels queue for the provided download ID if exists.
*
* @param downloadId Download ID as known by [ExtensionManager]
*/
private fun cancelQueue(downloadId: Long) {
val waitingInstall = this.waitingInstall.get()
val toCancel = queue.find { it.downloadId == downloadId } ?: waitingInstall ?: return
if (cancelEntry(toCancel)) {
queue.remove(toCancel)
if (waitingInstall == toCancel) {
// Currently processing removed entry, continue queue
this.waitingInstall.set(null)
checkQueue()
}
extensionManager.updateInstallStep(downloadId, InstallStep.Idle)
}
}
/**
* Install item to queue.
*
* @param downloadId Download ID as known by [ExtensionManager]
* @param uri Uri of APK to install
*/
data class Entry(val downloadId: Long, val uri: Uri)
init {
val filter = IntentFilter(ACTION_CANCEL_QUEUE)
LocalBroadcastManager.getInstance(service).registerReceiver(cancelReceiver, filter)
}
companion object {
private const val ACTION_CANCEL_QUEUE = "Installer.action.CANCEL_QUEUE"
private const val EXTRA_DOWNLOAD_ID = "Installer.extra.DOWNLOAD_ID"
/**
* Attempts to cancel the installation entry for the provided download ID.
*
* @param downloadId Download ID as known by [ExtensionManager]
*/
fun cancelInstallQueue(context: Context, downloadId: Long) {
val intent = Intent(ACTION_CANCEL_QUEUE)
intent.putExtra(EXTRA_DOWNLOAD_ID, downloadId)
LocalBroadcastManager.getInstance(context).sendBroadcast(intent)
}
}
}

View File

@ -0,0 +1,106 @@
package eu.kanade.tachiyomi.extension.installer
import android.app.PendingIntent
import android.app.Service
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.content.IntentFilter
import android.content.pm.PackageInstaller
import android.os.Build
import eu.kanade.tachiyomi.extension.model.InstallStep
import eu.kanade.tachiyomi.util.lang.use
import eu.kanade.tachiyomi.util.system.getUriSize
import eu.kanade.tachiyomi.util.system.logcat
import logcat.LogPriority
class PackageInstallerInstaller(private val service: Service) : Installer(service) {
private val packageInstaller = service.packageManager.packageInstaller
private val packageActionReceiver = object : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent) {
when (intent.getIntExtra(PackageInstaller.EXTRA_STATUS, PackageInstaller.STATUS_FAILURE)) {
PackageInstaller.STATUS_PENDING_USER_ACTION -> {
val userAction = intent.getParcelableExtra<Intent>(Intent.EXTRA_INTENT)
if (userAction == null) {
logcat(LogPriority.ERROR) { "Fatal error for $intent" }
continueQueue(InstallStep.Error)
return
}
userAction.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
service.startActivity(userAction)
}
PackageInstaller.STATUS_FAILURE_ABORTED -> {
continueQueue(InstallStep.Idle)
}
PackageInstaller.STATUS_SUCCESS -> continueQueue(InstallStep.Installed)
else -> continueQueue(InstallStep.Error)
}
}
}
private var activeSession: Pair<Entry, Int>? = null
// Always ready
override var ready = true
override fun processEntry(entry: Entry) {
super.processEntry(entry)
activeSession = null
try {
val installParams = PackageInstaller.SessionParams(PackageInstaller.SessionParams.MODE_FULL_INSTALL)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
installParams.setRequireUserAction(PackageInstaller.SessionParams.USER_ACTION_NOT_REQUIRED)
}
activeSession = entry to packageInstaller.createSession(installParams)
val fileSize = service.getUriSize(entry.uri) ?: throw IllegalStateException()
installParams.setSize(fileSize)
val inputStream = service.contentResolver.openInputStream(entry.uri) ?: throw IllegalStateException()
val session = packageInstaller.openSession(activeSession!!.second)
val outputStream = session.openWrite(entry.downloadId.toString(), 0, fileSize)
session.use {
arrayOf(inputStream, outputStream).use {
inputStream.copyTo(outputStream)
session.fsync(outputStream)
}
val intentSender = PendingIntent.getBroadcast(
service,
activeSession!!.second,
Intent(INSTALL_ACTION),
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) PendingIntent.FLAG_MUTABLE else 0
).intentSender
session.commit(intentSender)
}
} catch (e: Exception) {
logcat(LogPriority.ERROR) { "Failed to install extension ${entry.downloadId} ${entry.uri}" }
activeSession?.let { (_, sessionId) ->
packageInstaller.abandonSession(sessionId)
}
continueQueue(InstallStep.Error)
}
}
override fun cancelEntry(entry: Entry): Boolean {
activeSession?.let { (activeEntry, sessionId) ->
if (activeEntry == entry) {
packageInstaller.abandonSession(sessionId)
return false
}
}
return true
}
override fun onDestroy() {
service.unregisterReceiver(packageActionReceiver)
super.onDestroy()
}
init {
service.registerReceiver(packageActionReceiver, IntentFilter(INSTALL_ACTION))
}
}
private const val INSTALL_ACTION = "PackageInstallerInstaller.INSTALL_ACTION"

View File

@ -0,0 +1,128 @@
package eu.kanade.tachiyomi.extension.installer
import android.app.Service
import android.content.pm.PackageManager
import android.os.Build
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.extension.model.InstallStep
import eu.kanade.tachiyomi.util.system.getUriSize
import eu.kanade.tachiyomi.util.system.logcat
import eu.kanade.tachiyomi.util.system.toast
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.SupervisorJob
import kotlinx.coroutines.cancel
import kotlinx.coroutines.launch
import logcat.LogPriority
import rikka.shizuku.Shizuku
import java.io.BufferedReader
import java.io.InputStream
class ShizukuInstaller(private val service: Service) : Installer(service) {
private val ioScope = CoroutineScope(SupervisorJob() + Dispatchers.IO)
private val shizukuDeadListener = Shizuku.OnBinderDeadListener {
logcat { "Shizuku was killed prematurely" }
service.stopSelf()
}
private val shizukuPermissionListener = object : Shizuku.OnRequestPermissionResultListener {
override fun onRequestPermissionResult(requestCode: Int, grantResult: Int) {
if (requestCode == SHIZUKU_PERMISSION_REQUEST_CODE) {
if (grantResult == PackageManager.PERMISSION_GRANTED) {
ready = true
checkQueue()
} else {
service.stopSelf()
}
Shizuku.removeRequestPermissionResultListener(this)
}
}
}
override var ready = false
@Suppress("BlockingMethodInNonBlockingContext")
override fun processEntry(entry: Entry) {
super.processEntry(entry)
ioScope.launch {
var sessionId: String? = null
try {
val size = service.getUriSize(entry.uri) ?: throw IllegalStateException()
service.contentResolver.openInputStream(entry.uri)!!.use {
val createCommand = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
"pm install-create --user current -i ${service.packageName} -S $size"
} else {
"pm install-create -i ${service.packageName} -S $size"
}
val createResult = exec(createCommand)
sessionId = SESSION_ID_REGEX.find(createResult.out)?.value
?: throw RuntimeException("Failed to create install session")
val writeResult = exec("pm install-write -S $size $sessionId base -", it)
if (writeResult.resultCode != 0) {
throw RuntimeException("Failed to write APK to session $sessionId")
}
val commitResult = exec("pm install-commit $sessionId")
if (commitResult.resultCode != 0) {
throw RuntimeException("Failed to commit install session $sessionId")
}
continueQueue(InstallStep.Installed)
}
} catch (e: Exception) {
logcat(LogPriority.ERROR, e) { "Failed to install extension ${entry.downloadId} ${entry.uri}" }
if (sessionId != null) {
exec("pm install-abandon $sessionId")
}
continueQueue(InstallStep.Error)
}
}
}
// Don't cancel if entry is already started installing
override fun cancelEntry(entry: Entry): Boolean = getActiveEntry() != entry
override fun onDestroy() {
Shizuku.removeBinderDeadListener(shizukuDeadListener)
Shizuku.removeRequestPermissionResultListener(shizukuPermissionListener)
ioScope.cancel()
super.onDestroy()
}
private fun exec(command: String, stdin: InputStream? = null): ShellResult {
@Suppress("DEPRECATION")
val process = Shizuku.newProcess(arrayOf("sh", "-c", command), null, null)
if (stdin != null) {
process.outputStream.use { stdin.copyTo(it) }
}
val output = process.inputStream.bufferedReader().use(BufferedReader::readText)
val resultCode = process.waitFor()
return ShellResult(resultCode, output)
}
private data class ShellResult(val resultCode: Int, val out: String)
init {
Shizuku.addBinderDeadListener(shizukuDeadListener)
ready = if (Shizuku.pingBinder()) {
if (Shizuku.checkSelfPermission() == PackageManager.PERMISSION_GRANTED) {
true
} else {
Shizuku.addRequestPermissionResultListener(shizukuPermissionListener)
Shizuku.requestPermission(SHIZUKU_PERMISSION_REQUEST_CODE)
false
}
} else {
logcat(LogPriority.ERROR) { "Shizuku is not ready to use." }
service.toast(R.string.ext_installer_shizuku_stopped)
service.stopSelf()
false
}
}
}
private const val SHIZUKU_PERMISSION_REQUEST_CODE = 14045
private val SESSION_ID_REGEX = Regex("(?<=\\[).+?(?=])")

View File

@ -1,5 +1,6 @@
package eu.kanade.tachiyomi.extension.model
import android.graphics.drawable.Drawable
import eu.kanade.tachiyomi.source.Source
sealed class Extension {
@ -10,6 +11,8 @@ sealed class Extension {
abstract val versionCode: Long
abstract val lang: String?
abstract val isNsfw: Boolean
abstract val hasReadme: Boolean
abstract val hasChangelog: Boolean
data class Installed(
override val name: String,
@ -18,8 +21,11 @@ sealed class Extension {
override val versionCode: Long,
override val lang: String,
override val isNsfw: Boolean,
override val hasReadme: Boolean,
override val hasChangelog: Boolean,
val pkgFactory: String?,
val sources: List<Source>,
val icon: Drawable?,
val hasUpdate: Boolean = false,
val isObsolete: Boolean = false,
val isUnofficial: Boolean = false
@ -32,6 +38,9 @@ sealed class Extension {
override val versionCode: Long,
override val lang: String,
override val isNsfw: Boolean,
override val hasReadme: Boolean,
override val hasChangelog: Boolean,
val sources: List<AvailableExtensionSources>,
val apkName: String,
val iconUrl: String
) : Extension()
@ -43,6 +52,14 @@ sealed class Extension {
override val versionCode: Long,
val signatureHash: String,
override val lang: String? = null,
override val isNsfw: Boolean = false
override val isNsfw: Boolean = false,
override val hasReadme: Boolean = false,
override val hasChangelog: Boolean = false,
) : Extension()
}
data class AvailableExtensionSources(
val name: String,
val id: Long,
val baseUrl: String
)

View File

@ -1,9 +1,9 @@
package eu.kanade.tachiyomi.extension.model
enum class InstallStep {
Pending, Downloading, Installing, Installed, Error;
Idle, Pending, Downloading, Installing, Installed, Error;
fun isCompleted(): Boolean {
return this == Installed || this == Error
return this == Installed || this == Error || this == Idle
}
}

View File

@ -4,6 +4,7 @@ import android.app.Activity
import android.content.Intent
import android.os.Bundle
import eu.kanade.tachiyomi.extension.ExtensionManager
import eu.kanade.tachiyomi.extension.model.InstallStep
import eu.kanade.tachiyomi.util.system.toast
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
@ -40,10 +41,13 @@ class ExtensionInstallActivity : Activity() {
private fun checkInstallationResult(resultCode: Int) {
val downloadId = intent.extras!!.getLong(ExtensionInstaller.EXTRA_DOWNLOAD_ID)
val success = resultCode == RESULT_OK
val extensionManager = Injekt.get<ExtensionManager>()
extensionManager.setInstallationResult(downloadId, success)
val newStep = when (resultCode) {
RESULT_OK -> InstallStep.Installed
RESULT_CANCELED -> InstallStep.Idle
else -> InstallStep.Error
}
extensionManager.updateInstallStep(downloadId, newStep)
}
}

View File

@ -0,0 +1,83 @@
package eu.kanade.tachiyomi.extension.util
import android.app.Service
import android.content.Context
import android.content.Intent
import android.net.Uri
import android.os.IBinder
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.notification.Notifications
import eu.kanade.tachiyomi.data.preference.PreferenceValues
import eu.kanade.tachiyomi.extension.installer.Installer
import eu.kanade.tachiyomi.extension.installer.PackageInstallerInstaller
import eu.kanade.tachiyomi.extension.installer.ShizukuInstaller
import eu.kanade.tachiyomi.extension.util.ExtensionInstaller.Companion.EXTRA_DOWNLOAD_ID
import eu.kanade.tachiyomi.util.system.logcat
import eu.kanade.tachiyomi.util.system.notificationBuilder
import logcat.LogPriority
class ExtensionInstallService : Service() {
private var installer: Installer? = null
override fun onCreate() {
super.onCreate()
val notification = notificationBuilder(Notifications.CHANNEL_EXTENSIONS_UPDATE) {
setSmallIcon(R.drawable.ic_tachi)
setAutoCancel(false)
setOngoing(true)
setShowWhen(false)
setContentTitle(getString(R.string.ext_install_service_notif))
setProgress(100, 100, true)
}.build()
startForeground(Notifications.ID_EXTENSION_INSTALLER, notification)
}
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
val uri = intent?.data
val id = intent?.getLongExtra(EXTRA_DOWNLOAD_ID, -1)?.takeIf { it != -1L }
val installerUsed = intent?.getSerializableExtra(EXTRA_INSTALLER) as? PreferenceValues.ExtensionInstaller
if (uri == null || id == null || installerUsed == null) {
stopSelf()
return START_NOT_STICKY
}
if (installer == null) {
installer = when (installerUsed) {
PreferenceValues.ExtensionInstaller.PACKAGEINSTALLER -> PackageInstallerInstaller(this)
PreferenceValues.ExtensionInstaller.SHIZUKU -> ShizukuInstaller(this)
else -> {
logcat(LogPriority.ERROR) { "Not implemented for installer $installerUsed" }
stopSelf()
return START_NOT_STICKY
}
}
}
installer!!.addToQueue(id, uri)
return START_NOT_STICKY
}
override fun onDestroy() {
super.onDestroy()
installer?.onDestroy()
installer = null
}
override fun onBind(i: Intent?): IBinder? = null
companion object {
private const val EXTRA_INSTALLER = "EXTRA_INSTALLER"
fun getIntent(
context: Context,
downloadId: Long,
uri: Uri,
installer: PreferenceValues.ExtensionInstaller
): Intent {
return Intent(context, ExtensionInstallService::class.java)
.setDataAndType(uri, ExtensionInstaller.APK_MIME)
.putExtra(EXTRA_DOWNLOAD_ID, downloadId)
.putExtra(EXTRA_INSTALLER, installer)
}
}
}

View File

@ -7,15 +7,22 @@ import android.content.Intent
import android.content.IntentFilter
import android.net.Uri
import android.os.Environment
import androidx.core.content.ContextCompat
import androidx.core.content.getSystemService
import androidx.core.net.toUri
import com.jakewharton.rxrelay.PublishRelay
import eu.kanade.tachiyomi.data.preference.PreferenceValues
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
import eu.kanade.tachiyomi.extension.installer.Installer
import eu.kanade.tachiyomi.extension.model.Extension
import eu.kanade.tachiyomi.extension.model.InstallStep
import eu.kanade.tachiyomi.util.storage.getUriCompat
import eu.kanade.tachiyomi.util.system.logcat
import logcat.LogPriority
import rx.Observable
import rx.android.schedulers.AndroidSchedulers
import timber.log.Timber
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
import java.io.File
import java.util.concurrent.TimeUnit
@ -47,6 +54,8 @@ internal class ExtensionInstaller(private val context: Context) {
*/
private val downloadsRelay = PublishRelay.create<Pair<Long, InstallStep>>()
private val installerPref = Injekt.get<PreferencesHelper>().extensionInstaller()
/**
* Adds the given extension to the downloads queue and returns an observable containing its
* step in the installation process.
@ -79,8 +88,6 @@ internal class ExtensionInstaller(private val context: Context) {
.map { it.second }
// Poll download status
.mergeWith(pollStatus(id))
// Force an error if the download takes more than 3 minutes
.mergeWith(Observable.timer(3, TimeUnit.MINUTES).map { InstallStep.Error })
// Stop when the application is installed or errors
.takeUntil { it.isCompleted() }
// Always notify on main thread
@ -103,7 +110,7 @@ internal class ExtensionInstaller(private val context: Context) {
.map {
downloadManager.query(query).use { cursor ->
cursor.moveToFirst()
cursor.getInt(cursor.getColumnIndex(DownloadManager.COLUMN_STATUS))
cursor.getInt(cursor.getColumnIndexOrThrow(DownloadManager.COLUMN_STATUS))
}
}
// Ignore duplicate results
@ -126,12 +133,29 @@ internal class ExtensionInstaller(private val context: Context) {
* @param uri The uri of the extension to install.
*/
fun installApk(downloadId: Long, uri: Uri) {
val intent = Intent(context, ExtensionInstallActivity::class.java)
.setDataAndType(uri, APK_MIME)
.putExtra(EXTRA_DOWNLOAD_ID, downloadId)
.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_GRANT_READ_URI_PERMISSION)
when (val installer = installerPref.get()) {
PreferenceValues.ExtensionInstaller.LEGACY -> {
val intent = Intent(context, ExtensionInstallActivity::class.java)
.setDataAndType(uri, APK_MIME)
.putExtra(EXTRA_DOWNLOAD_ID, downloadId)
.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_GRANT_READ_URI_PERMISSION)
context.startActivity(intent)
context.startActivity(intent)
}
else -> {
val intent = ExtensionInstallService.getIntent(context, downloadId, uri, installer)
ContextCompat.startForegroundService(context, intent)
}
}
}
/**
* Cancels extension install and remove from download manager and installer.
*/
fun cancelInstall(pkgName: String) {
val downloadId = activeDownloads.remove(pkgName) ?: return
downloadManager.remove(downloadId)
Installer.cancelInstallQueue(context, downloadId)
}
/**
@ -147,13 +171,12 @@ internal class ExtensionInstaller(private val context: Context) {
}
/**
* Sets the result of the installation of an extension.
* Sets the step of the installation of an extension.
*
* @param downloadId The id of the download.
* @param result Whether the extension was installed or not.
* @param step New install step.
*/
fun setInstallationResult(downloadId: Long, result: Boolean) {
val step = if (result) InstallStep.Installed else InstallStep.Error
fun updateInstallStep(downloadId: Long, step: InstallStep) {
downloadsRelay.call(downloadId to step)
}
@ -216,10 +239,8 @@ internal class ExtensionInstaller(private val context: Context) {
val uri = downloadManager.getUriForDownloadedFile(id)
// Set next installation step
if (uri != null) {
downloadsRelay.call(id to InstallStep.Installing)
} else {
Timber.e("Couldn't locate downloaded APK")
if (uri == null) {
logcat(LogPriority.ERROR) { "Couldn't locate downloaded APK" }
downloadsRelay.call(id to InstallStep.Error)
return
}
@ -228,7 +249,7 @@ internal class ExtensionInstaller(private val context: Context) {
downloadManager.query(query).use { cursor ->
if (cursor.moveToFirst()) {
val localUri = cursor.getString(
cursor.getColumnIndex(DownloadManager.COLUMN_LOCAL_URI)
cursor.getColumnIndexOrThrow(DownloadManager.COLUMN_LOCAL_URI)
).removePrefix(FILE_SCHEME)
installApk(id, File(localUri).getUriCompat(context))

View File

@ -6,7 +6,6 @@ import android.content.pm.PackageInfo
import android.content.pm.PackageManager
import androidx.core.content.pm.PackageInfoCompat
import dalvik.system.PathClassLoader
import eu.kanade.tachiyomi.annotations.Nsfw
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
import eu.kanade.tachiyomi.extension.model.Extension
import eu.kanade.tachiyomi.extension.model.LoadResult
@ -14,9 +13,11 @@ import eu.kanade.tachiyomi.source.CatalogueSource
import eu.kanade.tachiyomi.source.Source
import eu.kanade.tachiyomi.source.SourceFactory
import eu.kanade.tachiyomi.util.lang.Hash
import eu.kanade.tachiyomi.util.system.getApplicationIcon
import eu.kanade.tachiyomi.util.system.logcat
import kotlinx.coroutines.async
import kotlinx.coroutines.runBlocking
import timber.log.Timber
import logcat.LogPriority
import uy.kohesive.injekt.injectLazy
/**
@ -34,8 +35,10 @@ internal object ExtensionLoader {
private const val METADATA_SOURCE_CLASS = "tachiyomi.extension.class"
private const val METADATA_SOURCE_FACTORY = "tachiyomi.extension.factory"
private const val METADATA_NSFW = "tachiyomi.extension.nsfw"
private const val METADATA_HAS_README = "tachiyomi.extension.hasReadme"
private const val METADATA_HAS_CHANGELOG = "tachiyomi.extension.hasChangelog"
const val LIB_VERSION_MIN = 1.2
const val LIB_VERSION_MAX = 1.2
const val LIB_VERSION_MAX = 1.3
private const val PACKAGE_FLAGS = PackageManager.GET_CONFIGURATIONS or PackageManager.GET_SIGNATURES
@ -108,7 +111,7 @@ internal object ExtensionLoader {
if (versionName.isNullOrEmpty()) {
val exception = Exception("Missing versionName for extension $extName")
Timber.w(exception)
logcat(LogPriority.WARN, exception)
return LoadResult.Error(exception)
}
@ -119,7 +122,7 @@ internal object ExtensionLoader {
"Lib version is $libVersion, while only versions " +
"$LIB_VERSION_MIN to $LIB_VERSION_MAX are allowed"
)
Timber.w(exception)
logcat(LogPriority.WARN, exception)
return LoadResult.Error(exception)
}
@ -129,7 +132,7 @@ internal object ExtensionLoader {
return LoadResult.Error("Package $pkgName isn't signed")
} else if (signatureHash !in trustedSignatures) {
val extension = Extension.Untrusted(extName, pkgName, versionName, versionCode, signatureHash)
Timber.w("Extension $pkgName isn't trusted")
logcat(LogPriority.WARN) { "Extension $pkgName isn't trusted" }
return LoadResult.Untrusted(extension)
}
@ -138,6 +141,9 @@ internal object ExtensionLoader {
return LoadResult.Error("NSFW extension $pkgName not allowed")
}
val hasReadme = appInfo.metaData.getInt(METADATA_HAS_README, 0) == 1
val hasChangelog = appInfo.metaData.getInt(METADATA_HAS_CHANGELOG, 0) == 1
val classLoader = PathClassLoader(appInfo.sourceDir, null, context.classLoader)
val sources = appInfo.metaData.getString(METADATA_SOURCE_CLASS)!!
@ -154,21 +160,14 @@ internal object ExtensionLoader {
try {
when (val obj = Class.forName(it, false, classLoader).newInstance()) {
is Source -> listOf(obj)
is SourceFactory -> {
if (isSourceNsfw(obj)) {
emptyList()
} else {
obj.createSources()
}
}
is SourceFactory -> obj.createSources()
else -> throw Exception("Unknown source class type! ${obj.javaClass}")
}
} catch (e: Throwable) {
Timber.e(e, "Extension load error: $extName ($it)")
logcat(LogPriority.ERROR, e) { "Extension load error: $extName ($it)" }
return LoadResult.Error(e)
}
}
.filter { !isSourceNsfw(it) }
val langs = sources.filterIsInstance<CatalogueSource>()
.map { it.lang }
@ -186,9 +185,12 @@ internal object ExtensionLoader {
versionCode,
lang,
isNsfw,
hasReadme,
hasChangelog,
sources = sources,
pkgFactory = appInfo.metaData.getString(METADATA_SOURCE_FACTORY),
isUnofficial = signatureHash != officialSignature
isUnofficial = signatureHash != officialSignature,
icon = context.getApplicationIcon(pkgName)
)
return LoadResult.Success(extension)
}
@ -215,22 +217,4 @@ internal object ExtensionLoader {
null
}
}
/**
* Checks whether a Source or SourceFactory is annotated with @Nsfw.
*/
private fun isSourceNsfw(clazz: Any): Boolean {
if (loadNsfwSource) {
return false
}
if (clazz !is Source && clazz !is SourceFactory) {
return false
}
// Annotations are proxied, hence this janky way of checking for them
return clazz.javaClass.annotations
.flatMap { it.javaClass.interfaces.map { it.simpleName } }
.firstOrNull { it == Nsfw::class.java.simpleName } != null
}
}

View File

@ -2,7 +2,6 @@ package eu.kanade.tachiyomi.network
import android.content.Context
import coil.util.CoilUtils
import eu.kanade.tachiyomi.BuildConfig
import eu.kanade.tachiyomi.data.preference.PreferencesHelper
import eu.kanade.tachiyomi.network.interceptor.CloudflareInterceptor
import eu.kanade.tachiyomi.network.interceptor.UserAgentInterceptor
@ -31,7 +30,7 @@ class NetworkHelper(context: Context) {
.readTimeout(30, TimeUnit.SECONDS)
.addInterceptor(UserAgentInterceptor())
if (BuildConfig.DEBUG) {
if (preferences.verboseLogging()) {
val httpLoggingInterceptor = HttpLoggingInterceptor().apply {
level = HttpLoggingInterceptor.Level.HEADERS
}

View File

@ -2,6 +2,7 @@ package eu.kanade.tachiyomi.network.interceptor
import android.annotation.SuppressLint
import android.content.Context
import android.os.Build
import android.webkit.WebSettings
import android.webkit.WebView
import android.widget.Toast
@ -10,6 +11,7 @@ import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.network.NetworkHelper
import eu.kanade.tachiyomi.source.online.HttpSource
import eu.kanade.tachiyomi.util.lang.launchUI
import eu.kanade.tachiyomi.util.system.DeviceUtil
import eu.kanade.tachiyomi.util.system.WebViewClientCompat
import eu.kanade.tachiyomi.util.system.WebViewUtil
import eu.kanade.tachiyomi.util.system.isOutdated
@ -37,6 +39,13 @@ class CloudflareInterceptor(private val context: Context) : Interceptor {
* Application class.
*/
private val initWebView by lazy {
// Crashes on some devices. We skip this in some cases since the only impact is slower
// WebView init in those rare cases.
// See https://bugs.chromium.org/p/chromium/issues/detail?id=1279562
if (DeviceUtil.isMiui || Build.VERSION.SDK_INT == Build.VERSION_CODES.S && DeviceUtil.isSamsung) {
return@lazy
}
WebSettings.getDefaultUserAgent(context)
}
@ -56,7 +65,7 @@ class CloudflareInterceptor(private val context: Context) : Interceptor {
val response = chain.proceed(originalRequest)
// Check if Cloudflare anti-bot is on
if (response.code != 503 || response.header("Server") !in SERVER_CHECK) {
if (response.code !in ERROR_CODES || response.header("Server") !in SERVER_CHECK) {
return response
}
@ -68,9 +77,12 @@ class CloudflareInterceptor(private val context: Context) : Interceptor {
resolveWithWebView(originalRequest, oldCookie)
return chain.proceed(originalRequest)
}
// Because OkHttp's enqueue only handles IOExceptions, wrap the exception so that
// we don't crash the entire app
catch (e: CloudflareBypassException) {
throw IOException(context.getString(R.string.information_cloudflare_bypass_failure))
} catch (e: Exception) {
// Because OkHttp's enqueue only handles IOExceptions, wrap the exception so that
// we don't crash the entire app
throw IOException(e)
}
}
@ -127,7 +139,7 @@ class CloudflareInterceptor(private val context: Context) : Interceptor {
isMainFrame: Boolean
) {
if (isMainFrame) {
if (errorCode == 503) {
if (errorCode in ERROR_CODES) {
// Found the Cloudflare challenge page.
challengeFound = true
} else {
@ -162,12 +174,15 @@ class CloudflareInterceptor(private val context: Context) : Interceptor {
context.toast(R.string.information_webview_outdated, Toast.LENGTH_LONG)
}
throw Exception(context.getString(R.string.information_cloudflare_bypass_failure))
throw CloudflareBypassException()
}
}
companion object {
private val ERROR_CODES = listOf(403, 503)
private val SERVER_CHECK = arrayOf("cloudflare-nginx", "cloudflare")
private val COOKIE_NAMES = listOf("cf_clearance")
}
}
private class CloudflareBypassException : Exception()

Some files were not shown because too many files have changed in this diff Show More