Compare commits

...

56 commits

Author SHA1 Message Date
GitHub Action
89dd50dc25 source update: v0.7.0 2026-01-09 11:15:37 +00:00
Moustapha Kodjo Amadou
1f3fe65945 v0.7.0 2026-01-09 11:55:13 +01:00
Moustapha Kodjo Amadou
88f8d7b4be - 2026-01-09 11:54:10 +01:00
Moustapha Kodjo Amadou
83b7d31e0a Increase isolate pool size to enhance concurrent download capabilities 2026-01-09 11:48:23 +01:00
Moustapha Kodjo Amadou
40fdfc2592 v0.6.95 2026-01-08 14:36:38 +01:00
Moustapha Kodjo Amadou
74b194602c update dependencies & update riverpod provider declarations 2026-01-08 14:27:08 +01:00
Moustapha Kodjo Amadou
b9f9a8398f Refactor download management with shared isolate pool and optimize concurrent downloads 2026-01-08 13:01:15 +01:00
Moustapha Kodjo Amadou
9458ae120b fix #637 2026-01-07 13:07:55 +01:00
Moustapha Kodjo Amadou
701a696820 Enhance category management with animation 2026-01-05 12:38:30 +01:00
Moustapha Kodjo Amadou
db24951673 Add localization 2026-01-05 12:15:14 +01:00
Moustapha Kodjo Amadou
7c4c8d8a20 + 2026-01-05 12:12:56 +01:00
Moustapha Kodjo Amadou
6b70fff6cc
Merge pull request #638 from 686udjie/main
add a force landscapre mode on mobile
2026-01-05 12:11:33 +01:00
Moustapha Kodjo Amadou
2365e28a1a
Merge pull request #636 from NBA2K1/main
Fix "Show extensions" Button AND Fix category rearrange bug AND hide ItemType from calendar
2026-01-05 11:55:33 +01:00
NBA2K1
922582b270 Fix share params to avoid Text file
- avoids extra text file
- simplify RenderBox lookup
2026-01-04 20:25:13 +01:00
686udjie
79ee4b4fc8 add a force landscapre mode on mobile 2026-01-01 19:48:57 +02:00
NBA2K1
c8328fa347 improve performance of helper method
- compare integers instead of Strings
- cache results per day
2025-12-30 02:44:45 +01:00
NBA2K1
a63f0d67bd Extract helper methods
for better readability
2025-12-30 02:41:47 +01:00
NBA2K1
2c92d74a03 Fix invalid selection
Don't show manga calendar if manga is hidden.
2025-12-30 02:04:06 +01:00
NBA2K1
a2a10a799d Hide items in Calendar
When the user has hidden Manga or Anime or Novel, hide the buttons in the calendar.
2025-12-30 01:37:30 +01:00
NBA2K1
ba77c5baea Reduce Code Duplication
And add comments
2025-12-30 01:15:36 +01:00
NBA2K1
4e2d8b0038 Fix category rearrange bug
When rearranging categories in the Manga library, all categories in Anime and Novel were being deleted.
2025-12-30 00:27:49 +01:00
NBA2K1
821cbfa0dd Make function async
_updateCategoriesOrder() is now async
2025-12-29 23:38:17 +01:00
NBA2K1
4fb9f0a9df remove redundant things 2025-12-29 23:20:08 +01:00
NBA2K1
1ac605e30a Use the localized extension 2025-12-29 23:20:08 +01:00
NBA2K1
9efd76581f Group related functions using an extension
- new file item_type_filters.dart for the hiddenItemTypes function.
- reduces code duplication in statistics_screen, categories_screen and base_library_tab_screen
2025-12-29 23:19:31 +01:00
NBA2K1
7664e38cfd Fix "Show extensions" Button
The "Show extensions" Button was not working properly when categories were hidden.
An Exception would throw:
```
_AssertionError ('package:flutter/src/material/tab_controller.dart': Failed assertion: line 202 pos 12: 'value >= 0 && (value < length || length == 0)': is not true.)
```
And jump to the end of the tab list regardless of where you clicked the button.
2025-12-29 05:02:43 +01:00
NBA2K1
42f1dcff92 Reduce Code Duplication
- Extract localizedItemType() from `base_library_tab_screen.dart`
- Add localizedSources() and localizedExtensions() for browse_screen.dart
- Reduce if-statements in statistics_screen.dart
- Reduce if-statements in categories_screen.dart
- Reduce if-statements in browse_screen.dart
2025-12-29 04:59:06 +01:00
NBA2K1
86fb19ecb2 Refactor tabbed screens into base class
Reduce duplication
2025-12-29 03:28:04 +01:00
NBA2K1
bdcd28488e Same with history_screen.dart
- remove hideItems parameter
- Make TabBar and TabBarView cleaner
2025-12-29 01:58:49 +01:00
NBA2K1
30e6d50210 Make TabBar and TabBarView cleaner
Use the _visibleTabTypes list instead of the repeated if-statements.
2025-12-29 01:34:05 +01:00
NBA2K1
66b508d65d Cleanup
- Change _tabList String-list to be a list of ItemType
- Change its name to _visibleTabTypes
- Use that list in getCurrentItemType(), instead of creating a new list
2025-12-29 01:13:26 +01:00
NBA2K1
004885d557 Return library updater if library empty 2025-12-29 01:00:01 +01:00
NBA2K1
e463cce61a Make getCurrentItemType() readable
The previous version was just unnecessarily complicated, hard to read.
New version is very easy to read.
2025-12-29 00:38:33 +01:00
NBA2K1
67a83c0e6a Cleanup
Use getCurrentItemType() method to determine the ItemType of the current tab instead of the conditional with `_tabBarController.index`, which doesn't take into account that there could be hidden tabs.
2025-12-28 23:42:45 +01:00
NBA2K1
da566d3d0b remove hideItems parameter
No need to pass hideItems down, they all can use the top hideItems variable. It's never changed.
2025-12-28 23:16:29 +01:00
NBA2K1
c911594e73 Add logging and detailed botToast, remove doWhile
- Use the logger to log failed updates

- After the update-botToast another botToast is being spawned to show exactly which manga(s) couldn't be updated.

- Remove the doWhile loop because it is unnecessary. The condition of mangaList.length == numbers is always true, meaning it only runs once.
2025-12-28 23:08:54 +01:00
NBA2K1
9bd8a62d31 Reduce Code Duplication
Extract the `_updateLibrary()` function from `updates_screen.dart` and `library_screen.dart` to a top-level function in `libray_updater.dart`.
2025-12-28 22:59:44 +01:00
GitHub Action
53cd2101f4 source update: v0.6.90 2025-12-28 03:21:33 +00:00
Moustapha Kodjo Amadou
4e18e18489 Update 2025-12-24 20:26:51 +01:00
Moustapha Kodjo Amadou
481deb1344 v0.6.90 2025-12-23 19:20:00 +01:00
Moustapha Kodjo Amadou
344533aeb1 fix: show chanded source preference for mihon source 2025-12-23 19:18:18 +01:00
Moustapha Kodjo Amadou
e40e1b8fe6 fix: improve handling of proxy server URL in dialog 2025-12-23 18:32:04 +01:00
Moustapha Kodjo Amadou
b5d37caaa9 chore: update d4rt dependency version 2025-12-23 18:25:53 +01:00
Moustapha Kodjo Amadou
e342fe16fb
Merge pull request #632 from NBA2K1/path-optimizations
Path optimizations
2025-12-18 17:09:33 +01:00
Moustapha Kodjo Amadou
390e6fed46
Merge pull request #629 from NBA2K1/main
Add log switch to about-menu
2025-12-18 17:05:01 +01:00
Moustapha Kodjo Amadou
19a051b660 feat: add updatePageCropImage method for chapter page cropping 2025-12-18 17:03:06 +01:00
NBA2K1
5f7ea7fcf4 reduce code duplication
Use the `formattedFileSize()` function instead of `_formatBytes()`
2025-12-17 22:25:45 +01:00
NBA2K1
0f83899bac remove unnecessary calls
.trimLeft().trimRight() after trim() is unnecessary.
2025-12-17 21:34:45 +01:00
NBA2K1
a078b59678 Use floor() instead of round()
- Using round() will push values up too early.
Example: log(999) / log(1024) = 0.999
.round() = 1.
Result: 0.98 kB instead of 999 B

- Use correct units, as base1024 = KiB, MiB, etc. and base1000 = kB, MB, GB, ...
2025-12-17 21:24:26 +01:00
NBA2K1
0ed8ee2cd2 Move cacheDir creation to storage_provider
- Move the cacheDir creation to storage_provider from `others.dart`, `custom_extended_image_provider.dart` and `storage_usage.dart`.

- Use the correct directory, `getApplicationCacheDirectory()` instead of the `getTemporaryDirectory()` (which is being deleted by the OS regularly) for cache files.

- remove the `_cacheDownloadPath` from `storage_usage.dart` as the path is never being created in the first place, so using that path in `clearCache()` and `_getTotalDiskSpace()` is unnecessary.
2025-12-17 20:55:41 +01:00
NBA2K1
67dee18776 remove redundant import 2025-12-17 20:43:23 +01:00
Moustapha Kodjo Amadou
76645d97c1 fix: improve error handling for Cloudflare bypass failures 2025-12-14 14:01:40 +01:00
Moustapha Kodjo Amadou
8fe910900b + 2025-12-14 13:17:47 +01:00
Moustapha Kodjo Amadou
1e469614d9 Chapter jump fix in vertical continuous mode 2025-12-14 13:16:19 +01:00
NBA2K1
284fccd1ef Add log-switch to app.
- New switch in More > Settings > About
"Enable logging".

When ON, it inits the AppLogger and shows the "Share app logs" button below.
When OFF, it disposes the AppLogger and hides the "Share app logs" button.
It also prevents the AppLogger from init.

OFF by default.

- added localizations accordingly.
2025-12-13 00:42:50 +01:00
GitHub Action
9ac6237caf source update: v0.6.85 2025-12-10 13:33:52 +00:00
162 changed files with 3558 additions and 2814 deletions

View file

@ -71,13 +71,6 @@ jobs:
mv app-armeabi-v7a-release.apk Mangayomi-${{ github.ref_name }}-android-armeabi-v7a.apk
mv app-x86_64-release.apk Mangayomi-${{ github.ref_name }}-android-x86_64.apk
- name: build android apk (all architectures)
run: |
export GRADLE_OPTS="-Xmx4096m -XX:MaxMetaspaceSize=512m -XX:+UseG1GC"
flutter build apk --release --verbose
cd build/app/outputs/flutter-apk
mv app-release.apk Mangayomi-${{ github.ref_name }}-android-universal.apk
- name: upload artifact android apks
uses: actions/upload-artifact@v4
with:

View file

@ -1,7 +1,5 @@
PODS:
- app_links (6.4.1):
- Flutter
- audio_session (0.0.1):
- app_links (7.0.0):
- Flutter
- connectivity_plus (0.0.1):
- Flutter
@ -57,9 +55,8 @@ PODS:
- Flutter
- isar_community_flutter_libs (1.0.0):
- Flutter
- just_audio (0.0.1):
- m_extension_server (0.0.1):
- Flutter
- FlutterMacOS
- media_kit_libs_ios_video (1.0.4):
- Flutter
- media_kit_video (0.0.1):
@ -81,26 +78,16 @@ PODS:
- SDWebImage/Core (5.17.0)
- share_plus (0.0.1):
- Flutter
- sqflite_darwin (0.0.4):
- Flutter
- FlutterMacOS
- SwiftyGif (5.4.4)
- url_launcher_ios (0.0.1):
- Flutter
- video_player_avfoundation (0.0.1):
- Flutter
- FlutterMacOS
- volume_controller (0.0.1):
- Flutter
- wakelock_plus (0.0.1):
- Flutter
- webview_flutter_wkwebview (0.0.1):
- Flutter
- FlutterMacOS
DEPENDENCIES:
- app_links (from `.symlinks/plugins/app_links/ios`)
- audio_session (from `.symlinks/plugins/audio_session/ios`)
- connectivity_plus (from `.symlinks/plugins/connectivity_plus/ios`)
- device_info_plus (from `.symlinks/plugins/device_info_plus/ios`)
- file_picker (from `.symlinks/plugins/file_picker/ios`)
@ -110,7 +97,7 @@ DEPENDENCIES:
- flutter_qjs (from `.symlinks/plugins/flutter_qjs/ios`)
- flutter_web_auth_2 (from `.symlinks/plugins/flutter_web_auth_2/ios`)
- isar_community_flutter_libs (from `.symlinks/plugins/isar_community_flutter_libs/ios`)
- just_audio (from `.symlinks/plugins/just_audio/darwin`)
- m_extension_server (from `.symlinks/plugins/m_extension_server/ios`)
- media_kit_libs_ios_video (from `.symlinks/plugins/media_kit_libs_ios_video/ios`)
- media_kit_video (from `.symlinks/plugins/media_kit_video/ios`)
- package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)
@ -119,12 +106,9 @@ DEPENDENCIES:
- rust_lib_mangayomi (from `.symlinks/plugins/rust_lib_mangayomi/ios`)
- screen_brightness_ios (from `.symlinks/plugins/screen_brightness_ios/ios`)
- share_plus (from `.symlinks/plugins/share_plus/ios`)
- sqflite_darwin (from `.symlinks/plugins/sqflite_darwin/darwin`)
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
- video_player_avfoundation (from `.symlinks/plugins/video_player_avfoundation/darwin`)
- volume_controller (from `.symlinks/plugins/volume_controller/ios`)
- wakelock_plus (from `.symlinks/plugins/wakelock_plus/ios`)
- webview_flutter_wkwebview (from `.symlinks/plugins/webview_flutter_wkwebview/darwin`)
SPEC REPOS:
trunk:
@ -137,8 +121,6 @@ SPEC REPOS:
EXTERNAL SOURCES:
app_links:
:path: ".symlinks/plugins/app_links/ios"
audio_session:
:path: ".symlinks/plugins/audio_session/ios"
connectivity_plus:
:path: ".symlinks/plugins/connectivity_plus/ios"
device_info_plus:
@ -157,8 +139,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/flutter_web_auth_2/ios"
isar_community_flutter_libs:
:path: ".symlinks/plugins/isar_community_flutter_libs/ios"
just_audio:
:path: ".symlinks/plugins/just_audio/darwin"
m_extension_server:
:path: ".symlinks/plugins/m_extension_server/ios"
media_kit_libs_ios_video:
:path: ".symlinks/plugins/media_kit_libs_ios_video/ios"
media_kit_video:
@ -175,22 +157,15 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/screen_brightness_ios/ios"
share_plus:
:path: ".symlinks/plugins/share_plus/ios"
sqflite_darwin:
:path: ".symlinks/plugins/sqflite_darwin/darwin"
url_launcher_ios:
:path: ".symlinks/plugins/url_launcher_ios/ios"
video_player_avfoundation:
:path: ".symlinks/plugins/video_player_avfoundation/darwin"
volume_controller:
:path: ".symlinks/plugins/volume_controller/ios"
wakelock_plus:
:path: ".symlinks/plugins/wakelock_plus/ios"
webview_flutter_wkwebview:
:path: ".symlinks/plugins/webview_flutter_wkwebview/darwin"
SPEC CHECKSUMS:
app_links: 3dbc685f76b1693c66a6d9dd1e9ab6f73d97dc0a
audio_session: 9bb7f6c970f21241b19f5a3658097ae459681ba0
app_links: a754cbec3c255bd4bbb4d236ecc06f28cd9a7ce8
connectivity_plus: cb623214f4e1f6ef8fe7403d580fdad517d2f7dd
device_info_plus: 21fcca2080fbcd348be798aa36c3e5ed849eefbe
DKImagePickerController: b512c28220a2b8ac7419f21c491fc8534b7601ac
@ -202,24 +177,21 @@ SPEC CHECKSUMS:
flutter_qjs: 1d5918f42171154e88dd545dd45f126c0291976f
flutter_web_auth_2: 3464a7c16dc6480b6194fc89913bae6e82f28405
isar_community_flutter_libs: bede843185a61a05ff364a05c9b23209523f7e0d
just_audio: 4e391f57b79cad2b0674030a00453ca5ce817eed
m_extension_server: 6946ec189542b271dbd15629b9498595f1036761
media_kit_libs_ios_video: 5a18affdb97d1f5d466dc79988b13eff6c5e2854
media_kit_video: 1746e198cb697d1ffb734b1d05ec429d1fcd1474
OrderedSet: e539b66b644ff081c73a262d24ad552a69be3a94
package_info_plus: af8e2ca6888548050f16fa2f1938db7b5a5df499
path_provider_foundation: 080d55be775b7414fd5a5ef3ac137b97b097e564
path_provider_foundation: bb55f6dbba17d0dccd6737fe6f7f34fbd0376880
permission_handler_apple: 4ed2196e43d0651e8ff7ca3483a069d469701f2d
rust_lib_mangayomi: 360a904274b47351a0f7c26d3ce5aa6392bb8db3
screen_brightness_ios: 9953fd7da5bd480f1a93990daeec2eb42d4f3b52
SDWebImage: 750adf017a315a280c60fde706ab1e552a3ae4e9
share_plus: 50da8cb520a8f0f65671c6c6a99b3617ed10a58a
sqflite_darwin: 20b2a3a3b70e43edae938624ce550a3cbf66a3d0
SwiftyGif: 93a1cc87bf3a51916001cf8f3d63835fb64c819f
url_launcher_ios: 694010445543906933d732453a59da0a173ae33d
video_player_avfoundation: 2cef49524dd1f16c5300b9cd6efd9611ce03639b
url_launcher_ios: 7a95fa5b60cc718a708b8f2966718e93db0cef1b
volume_controller: 3657a1f65bedb98fa41ff7dc5793537919f31b12
wakelock_plus: e29112ab3ef0b318e58cfa5c32326458be66b556
webview_flutter_wkwebview: 8ebf4fded22593026f7dbff1fbff31ea98573c8d
PODFILE CHECKSUM: a57f30d18f102dd3ce366b1d62a55ecbef2158e5

View file

@ -23,7 +23,7 @@ class DartExtensionService implements ExtensionService {
interpreter.execute(
source: source.sourceCode!.replaceAll('Client(source)', 'Client()'),
args: source.toMSource(),
positionalArgs: [source.toMSource()],
);
return interpreter;
}

View file

@ -367,6 +367,9 @@ void hasError(Response response) {
final errorMessage = jsonDecode(response.body)['error'];
final code = jsonDecode(response.body)['code'];
if (errorMessage != null && code != null) {
if ((code as int) == 403) {
throw "errorMessage: Failed to bypass Cloudflare.\n\n\nYou can try to bypass it manually in the webview \n\n\nstatusCode: 403";
}
throw "errorMessage: $errorMessage \n\n\nstatusCode: $code";
}
} catch (e) {

View file

@ -75,14 +75,12 @@ class MBridge {
var query = htmlXPath.query(xpath);
if (query.nodes.length > 1) {
for (var element in query.attrs) {
attrs.add(element!.trim().trimLeft().trimRight());
attrs.add(element!.trim());
}
}
//Return one attr
else if (query.nodes.length == 1) {
String attr = query.attr != null
? query.attr!.trim().trimLeft().trimRight()
: "";
String attr = query.attr != null ? query.attr!.trim() : "";
if (attr.isNotEmpty) {
attrs = [attr];
}
@ -102,7 +100,7 @@ class MBridge {
statusMap = element;
for (var element in statusMap.entries) {
if (element.key.toString().toLowerCase().contains(
status.toLowerCase().trim().trimLeft().trimRight(),
status.toLowerCase().trim(),
)) {
return switch (element.value as int) {
0 => Status.ongoing,

View file

@ -451,6 +451,7 @@
"downloaded_only": "المحملة فقط",
"downloaded_only_description": "إظهار الإدخالات المحملة فقط في مكتبتك",
"concurrent_downloads": "التحميلات المتزامنة",
"logs_on": "تفعيل التسجيل",
"share_app_logs": "مشاركة سجلات التطبيق",
"no_app_logs": "لا يوجد ملف log.txt!",
"failed": "فشل!",
@ -560,4 +561,4 @@
"show_scroll_percentage": "إظهار نسبة التمرير",
"remove_extra_paragraph_spacing": "إزالة المسافات الإضافية بين الفقرات",
"select_label_color": "تحديد لون {label}"
}
}

View file

@ -305,6 +305,7 @@
"default_subtitle_language": "ডিফল্ট উপশিৰোনাম ভাষা",
"follow_system_theme": "ছিষ্টেম থিম অনুসৰণ কৰক",
"concurrent_downloads": "সমসাময়িক ডাউনলোড",
"logs_on": "লগিং সক্ষম কৰক",
"share_app_logs": "এপ লগ শ্বেয়াৰ কৰক",
"no_app_logs": "কোনো log.txt ফাইল উপলব্ধ নাই!",
"failed": "বিফল!",

View file

@ -465,6 +465,7 @@
"downloaded_only": "Nur heruntergeladene",
"downloaded_only_description": "Nur heruntergeladene Einträge in deiner Bibliothek anzeigen",
"concurrent_downloads": "Gleichzeitige Downloads",
"logs_on": "Protokollierung aktivieren",
"share_app_logs": "App-Protokolle teilen",
"no_app_logs": "Keine log.txt Datei verfügbar!",
"failed": "Fehlgeschlagen!",

View file

@ -143,6 +143,7 @@
"nsfw_sources_info": "This does not prevent unofficial or potentially incorrectly flagged extensions from surfacing NSFW (18+) content within the app",
"version": "Version",
"check_for_update": "Check for update",
"logs_on": "Enable logging",
"share_app_logs": "Share app logs",
"no_app_logs": "No log.txt available!",
"failed": "Failed!",
@ -560,5 +561,7 @@
"show_scroll_percentage": "Show Scroll Percentage",
"remove_extra_paragraph_spacing": "Remove Extra Paragraph Spacing",
"select_label_color": "Select {label} Color",
"default_user_agent": "Defaul user agent"
"default_user_agent": "Defaul user agent",
"forceLandscapeMode": "Force landscape mode",
"forceLandscapeModeSubtitle": "Force the player to use landscape orientation."
}

View file

@ -449,6 +449,7 @@
"downloaded_only": "Solo descargados",
"downloaded_only_description": "Mostrar solo entradas descargadas en tu biblioteca",
"concurrent_downloads": "Descargas simultáneas",
"logs_on": "Activar registro",
"share_app_logs": "Compartir registros de la aplicación",
"no_app_logs": "¡No hay archivo log.txt disponible!",
"failed": "¡Fallido!",

View file

@ -451,6 +451,7 @@
"downloaded_only": "Solo descargados",
"downloaded_only_description": "Mostrar solo entradas descargadas en tu biblioteca",
"concurrent_downloads": "Descargas simultáneas",
"logs_on": "Habilitar registro",
"share_app_logs": "Compartir registros de la aplicación",
"no_app_logs": "¡No hay archivo log.txt disponible!",
"failed": "¡Fallido!",

View file

@ -455,6 +455,7 @@
"downloaded_only": "Téléchargés uniquement",
"downloaded_only_description": "Afficher uniquement les entrées téléchargées dans votre bibliothèque",
"concurrent_downloads": "Téléchargements simultanés",
"logs_on": "Activer la journalisation",
"share_app_logs": "Partager les journaux de l'application",
"no_app_logs": "Aucun fichier log.txt disponible !",
"failed": "Échoué !",

View file

@ -305,6 +305,7 @@
"default_subtitle_language": "डिफ़ॉल्ट उपशीर्षक भाषा",
"follow_system_theme": "सिस्टम थीम का पालन करें",
"concurrent_downloads": "समवर्ती डाउनलोड",
"logs_on": "लॉगिंग सक्षम करें",
"share_app_logs": "ऐप लॉग साझा करें",
"no_app_logs": "कोई log.txt फ़ाइल उपलब्ध नहीं!",
"failed": "विफल!",

View file

@ -449,6 +449,7 @@
"downloaded_only": "Hanya yang diunduh",
"downloaded_only_description": "Hanya tampilkan entri yang diunduh di perpustakaan Anda",
"concurrent_downloads": "Unduhan bersamaan",
"logs_on": "Aktifkan pencatatan",
"share_app_logs": "Bagikan log aplikasi",
"no_app_logs": "Tidak ada file log.txt tersedia!",
"failed": "Gagal!",

View file

@ -449,6 +449,7 @@
"downloaded_only": "Solo scaricati",
"downloaded_only_description": "Mostra solo le voci scaricate nella tua libreria",
"concurrent_downloads": "Download simultanei",
"logs_on": "Abilita registrazione",
"share_app_logs": "Condividi i log dell'app",
"no_app_logs": "Nessun file log.txt disponibile!",
"failed": "Fallito!",

View file

@ -304,6 +304,7 @@
"default_subtitle_language": "デフォルト字幕言語",
"follow_system_theme": "システムテーマに従う",
"concurrent_downloads": "同時ダウンロード",
"logs_on": "ログを有効にする",
"share_app_logs": "アプリログを共有",
"no_app_logs": "log.txtファイルが利用できません",
"failed": "失敗!",

View file

@ -449,6 +449,7 @@
"downloaded_only": "Apenas baixados",
"downloaded_only_description": "Mostrar apenas entradas baixadas na sua biblioteca",
"concurrent_downloads": "Downloads simultâneos",
"logs_on": "Ativar registro",
"share_app_logs": "Compartilhar logs do aplicativo",
"no_app_logs": "Nenhum arquivo log.txt disponível!",
"failed": "Falhou!",

View file

@ -449,6 +449,7 @@
"downloaded_only": "Apenas baixados",
"downloaded_only_description": "Mostrar apenas entradas baixadas na sua biblioteca",
"concurrent_downloads": "Downloads simultâneos",
"logs_on": "Ativar registro",
"share_app_logs": "Compartilhar logs do aplicativo",
"no_app_logs": "Nenhum arquivo log.txt disponível!",
"failed": "Falhou!",

View file

@ -449,6 +449,7 @@
"downloaded_only": "Только загруженные",
"downloaded_only_description": "Показывать только загруженные записи в вашей библиотеке",
"concurrent_downloads": "Одновременные загрузки",
"logs_on": "Включить ведение журнала",
"share_app_logs": "Поделиться журналами приложения",
"no_app_logs": "Файл log.txt недоступен!",
"failed": "Не удалось!",

View file

@ -452,6 +452,7 @@
"downloaded_only": "ที่ดาวน์โหลดแล้วเท่านั้น",
"downloaded_only_description": "แสดงเฉพาะรายการที่ดาวน์โหลดแล้วในห้องสมุดของคุณ",
"concurrent_downloads": "ดาวน์โหลดพร้อมกัน",
"logs_on": "เปิดการบันทึก",
"share_app_logs": "แชร์บันทึกแอป",
"no_app_logs": "ไม่มีไฟล์ log.txt!",
"failed": "ล้มเหลว!",

View file

@ -449,6 +449,7 @@
"downloaded_only": "Sadece indirilmiş",
"downloaded_only_description": "Kütüphanenizde yalnızca indirilmiş girişleri göster",
"concurrent_downloads": "Eş zamanlı indirmeler",
"logs_on": "Günlük kaydını etkinleştir",
"share_app_logs": "Uygulama günlüklerini paylaş",
"no_app_logs": "log.txt dosyası yok!",
"failed": "Başarısız!",

View file

@ -454,6 +454,7 @@
"downloaded_only": "仅已下载",
"downloaded_only_description": "仅显示库中已下载的条目",
"concurrent_downloads": "并发下载",
"logs_on": "启用日志",
"share_app_logs": "分享应用日志",
"no_app_logs": "没有可用的 log.txt 文件!",
"failed": "失败!",
@ -562,5 +563,8 @@
"line_height": "行高",
"show_scroll_percentage": "显示滚动百分比",
"remove_extra_paragraph_spacing": "删除额外的段落间距",
"select_label_color": "选择 {label} 颜色"
}
"select_label_color": "选择 {label} 颜色",
"default_user_agent": "默认用户代理",
"forceLandscapeMode": "强制横屏模式",
"forceLandscapeModeSubtitle": "强制播放器使用横屏方向。"
}

View file

@ -935,6 +935,12 @@ abstract class AppLocalizations {
/// **'Check for update'**
String get check_for_update;
/// No description provided for @logs_on.
///
/// In en, this message translates to:
/// **'Enable logging'**
String get logs_on;
/// No description provided for @share_app_logs.
///
/// In en, this message translates to:
@ -3436,6 +3442,18 @@ abstract class AppLocalizations {
/// In en, this message translates to:
/// **'Defaul user agent'**
String get default_user_agent;
/// No description provided for @forceLandscapeMode.
///
/// In en, this message translates to:
/// **'Force landscape mode'**
String get forceLandscapeMode;
/// No description provided for @forceLandscapeModeSubtitle.
///
/// In en, this message translates to:
/// **'Force the player to use landscape orientation.'**
String get forceLandscapeModeSubtitle;
}
class _AppLocalizationsDelegate

View file

@ -434,6 +434,9 @@ class AppLocalizationsAr extends AppLocalizations {
@override
String get check_for_update => 'التحقق من التحديثات';
@override
String get logs_on => 'تفعيل التسجيل';
@override
String get share_app_logs => 'مشاركة سجلات التطبيق';
@ -1778,4 +1781,11 @@ class AppLocalizationsAr extends AppLocalizations {
@override
String get default_user_agent => 'Defaul user agent';
@override
String get forceLandscapeMode => 'Force landscape mode';
@override
String get forceLandscapeModeSubtitle =>
'Force the player to use landscape orientation.';
}

View file

@ -436,6 +436,9 @@ class AppLocalizationsAs extends AppLocalizations {
@override
String get check_for_update => 'আপডেটৰ বাবে পৰীক্ষা কৰক';
@override
String get logs_on => 'লগিং সক্ষম কৰক';
@override
String get share_app_logs => 'এপ লগ শ্বেয়াৰ কৰক';
@ -1784,4 +1787,11 @@ class AppLocalizationsAs extends AppLocalizations {
@override
String get default_user_agent => 'Defaul user agent';
@override
String get forceLandscapeMode => 'Force landscape mode';
@override
String get forceLandscapeModeSubtitle =>
'Force the player to use landscape orientation.';
}

View file

@ -438,6 +438,9 @@ class AppLocalizationsDe extends AppLocalizations {
@override
String get check_for_update => 'Auf Aktualisierung prüfen';
@override
String get logs_on => 'Protokollierung aktivieren';
@override
String get share_app_logs => 'App-Protokolle teilen';
@ -1799,4 +1802,11 @@ class AppLocalizationsDe extends AppLocalizations {
@override
String get default_user_agent => 'Defaul user agent';
@override
String get forceLandscapeMode => 'Force landscape mode';
@override
String get forceLandscapeModeSubtitle =>
'Force the player to use landscape orientation.';
}

View file

@ -436,6 +436,9 @@ class AppLocalizationsEn extends AppLocalizations {
@override
String get check_for_update => 'Check for update';
@override
String get logs_on => 'Enable logging';
@override
String get share_app_logs => 'Share app logs';
@ -1778,4 +1781,11 @@ class AppLocalizationsEn extends AppLocalizations {
@override
String get default_user_agent => 'Defaul user agent';
@override
String get forceLandscapeMode => 'Force landscape mode';
@override
String get forceLandscapeModeSubtitle =>
'Force the player to use landscape orientation.';
}

View file

@ -440,6 +440,9 @@ class AppLocalizationsEs extends AppLocalizations {
@override
String get check_for_update => 'Buscar actualizaciones';
@override
String get logs_on => 'Activar registro';
@override
String get share_app_logs => 'Compartir registros de la aplicación';
@ -1807,6 +1810,13 @@ class AppLocalizationsEs extends AppLocalizations {
@override
String get default_user_agent => 'Defaul user agent';
@override
String get forceLandscapeMode => 'Force landscape mode';
@override
String get forceLandscapeModeSubtitle =>
'Force the player to use landscape orientation.';
}
/// The translations for Spanish Castilian, as used in Latin America and the Caribbean (`es_419`).
@ -2245,6 +2255,9 @@ class AppLocalizationsEs419 extends AppLocalizationsEs {
@override
String get check_for_update => 'Buscar actualizaciones';
@override
String get logs_on => 'Habilitar registro';
@override
String get share_app_logs => 'Compartir registros de la aplicación';

View file

@ -442,6 +442,9 @@ class AppLocalizationsFr extends AppLocalizations {
@override
String get check_for_update => 'Rechercher des mises à jour';
@override
String get logs_on => 'Activer la journalisation';
@override
String get share_app_logs => 'Partager les journaux de l\'application';
@ -1807,4 +1810,11 @@ class AppLocalizationsFr extends AppLocalizations {
@override
String get default_user_agent => 'Defaul user agent';
@override
String get forceLandscapeMode => 'Force landscape mode';
@override
String get forceLandscapeModeSubtitle =>
'Force the player to use landscape orientation.';
}

View file

@ -436,6 +436,9 @@ class AppLocalizationsHi extends AppLocalizations {
@override
String get check_for_update => 'अपडेट के लिए जांचें';
@override
String get logs_on => 'लॉगिंग सक्षम करें';
@override
String get share_app_logs => 'ऐप लॉग साझा करें';
@ -1784,4 +1787,11 @@ class AppLocalizationsHi extends AppLocalizations {
@override
String get default_user_agent => 'Defaul user agent';
@override
String get forceLandscapeMode => 'Force landscape mode';
@override
String get forceLandscapeModeSubtitle =>
'Force the player to use landscape orientation.';
}

View file

@ -440,6 +440,9 @@ class AppLocalizationsId extends AppLocalizations {
@override
String get check_for_update => 'Periksa Pembaruan';
@override
String get logs_on => 'Aktifkan pencatatan';
@override
String get share_app_logs => 'Bagikan log aplikasi';
@ -1790,4 +1793,11 @@ class AppLocalizationsId extends AppLocalizations {
@override
String get default_user_agent => 'Defaul user agent';
@override
String get forceLandscapeMode => 'Force landscape mode';
@override
String get forceLandscapeModeSubtitle =>
'Force the player to use landscape orientation.';
}

View file

@ -440,6 +440,9 @@ class AppLocalizationsIt extends AppLocalizations {
@override
String get check_for_update => 'Controlla aggiornamenti';
@override
String get logs_on => 'Abilita registrazione';
@override
String get share_app_logs => 'Condividi i log dell\'app';
@ -1804,4 +1807,11 @@ class AppLocalizationsIt extends AppLocalizations {
@override
String get default_user_agent => 'Defaul user agent';
@override
String get forceLandscapeMode => 'Force landscape mode';
@override
String get forceLandscapeModeSubtitle =>
'Force the player to use landscape orientation.';
}

View file

@ -431,6 +431,9 @@ class AppLocalizationsJa extends AppLocalizations {
@override
String get check_for_update => 'Check for update';
@override
String get logs_on => 'ログを有効にする';
@override
String get share_app_logs => 'アプリログを共有';
@ -1755,4 +1758,11 @@ class AppLocalizationsJa extends AppLocalizations {
@override
String get default_user_agent => 'Defaul user agent';
@override
String get forceLandscapeMode => 'Force landscape mode';
@override
String get forceLandscapeModeSubtitle =>
'Force the player to use landscape orientation.';
}

View file

@ -440,6 +440,9 @@ class AppLocalizationsPt extends AppLocalizations {
@override
String get check_for_update => 'Verificar atualização';
@override
String get logs_on => 'Ativar registro';
@override
String get share_app_logs => 'Compartilhar logs do aplicativo';
@ -1802,6 +1805,13 @@ class AppLocalizationsPt extends AppLocalizations {
@override
String get default_user_agent => 'Defaul user agent';
@override
String get forceLandscapeMode => 'Force landscape mode';
@override
String get forceLandscapeModeSubtitle =>
'Force the player to use landscape orientation.';
}
/// The translations for Portuguese, as used in Brazil (`pt_BR`).
@ -2240,6 +2250,9 @@ class AppLocalizationsPtBr extends AppLocalizationsPt {
@override
String get check_for_update => 'Verificar atualização';
@override
String get logs_on => 'Ativar registro';
@override
String get share_app_logs => 'Compartilhar logs do aplicativo';

View file

@ -441,6 +441,9 @@ class AppLocalizationsRu extends AppLocalizations {
@override
String get check_for_update => 'Проверить обновления';
@override
String get logs_on => 'Включить ведение журнала';
@override
String get share_app_logs => 'Поделиться журналами приложения';
@ -1807,4 +1810,11 @@ class AppLocalizationsRu extends AppLocalizations {
@override
String get default_user_agent => 'Defaul user agent';
@override
String get forceLandscapeMode => 'Force landscape mode';
@override
String get forceLandscapeModeSubtitle =>
'Force the player to use landscape orientation.';
}

View file

@ -436,6 +436,9 @@ class AppLocalizationsTh extends AppLocalizations {
@override
String get check_for_update => 'ตรวจสอบการอัพเดท';
@override
String get logs_on => 'เปิดการบันทึก';
@override
String get share_app_logs => 'แชร์บันทึกแอป';
@ -1778,4 +1781,11 @@ class AppLocalizationsTh extends AppLocalizations {
@override
String get default_user_agent => 'Defaul user agent';
@override
String get forceLandscapeMode => 'Force landscape mode';
@override
String get forceLandscapeModeSubtitle =>
'Force the player to use landscape orientation.';
}

View file

@ -436,6 +436,9 @@ class AppLocalizationsTr extends AppLocalizations {
@override
String get check_for_update => 'Güncelleme Kontrol Et';
@override
String get logs_on => 'Günlük kaydını etkinleştir';
@override
String get share_app_logs => 'Uygulama günlüklerini paylaş';
@ -1790,4 +1793,11 @@ class AppLocalizationsTr extends AppLocalizations {
@override
String get default_user_agent => 'Defaul user agent';
@override
String get forceLandscapeMode => 'Force landscape mode';
@override
String get forceLandscapeModeSubtitle =>
'Force the player to use landscape orientation.';
}

View file

@ -427,6 +427,9 @@ class AppLocalizationsZh extends AppLocalizations {
@override
String get check_for_update => '检查更新';
@override
String get logs_on => '启用日志';
@override
String get share_app_logs => '分享应用日志';
@ -1735,5 +1738,11 @@ class AppLocalizationsZh extends AppLocalizations {
}
@override
String get default_user_agent => 'Defaul user agent';
String get default_user_agent => '默认用户代理';
@override
String get forceLandscapeMode => '强制横屏模式';
@override
String get forceLandscapeModeSubtitle => '强制播放器使用横屏方向。';
}

View file

@ -34,6 +34,7 @@ import 'package:mangayomi/l10n/generated/app_localizations.dart';
import 'package:mangayomi/services/http/m_client.dart';
import 'package:mangayomi/services/isolate_service.dart';
import 'package:mangayomi/services/m_extension_server.dart';
import 'package:mangayomi/services/download_manager/m_downloader.dart';
import 'package:mangayomi/src/rust/frb_generated.dart';
import 'package:mangayomi/utils/discord_rpc.dart';
import 'package:mangayomi/utils/log/logger.dart';
@ -83,6 +84,7 @@ void main(List<String> args) async {
Future<void> _postLaunchInit(StorageProvider storage) async {
await AppLogger.init();
unawaited(MDownloader.initializeIsolatePool(poolSize: 6));
final hivePath = (Platform.isIOS || Platform.isMacOS)
? "databases"
: p.join("Mangayomi", "databases");

View file

@ -127,6 +127,8 @@ class Settings {
int? pagePreloadAmount;
bool? enableLogs;
bool? checkForAppUpdates;
bool? checkForExtensionUpdates;
@ -161,6 +163,8 @@ class Settings {
bool? fullScreenPlayer;
bool? forceLandscapePlayer;
bool? updateProgressAfterReading;
bool? enableAniSkip;
@ -357,6 +361,7 @@ class Settings {
this.sortLibraryAnime,
this.pagePreloadAmount = 6,
this.scaleType = ScaleType.fitScreen,
this.enableLogs = false,
this.checkForAppUpdates = true,
this.checkForExtensionUpdates = true,
this.backgroundColor = BackgroundColor.black,
@ -372,6 +377,7 @@ class Settings {
this.defaultDoubleTapToSkipLength = 10,
this.defaultPlayBackSpeed = 1.0,
this.fullScreenPlayer = false,
this.forceLandscapePlayer = false,
this.updateProgressAfterReading = true,
this.enableAniSkip,
this.enableAutoSkip,
@ -482,6 +488,7 @@ class Settings {
.map((e) => ChapterPageurls.fromJson(e))
.toList();
}
enableLogs = json['enableLogs'];
checkForAppUpdates = json['checkForAppUpdates'];
checkForExtensionUpdates = json['checkForExtensionUpdates'];
if (json['cookiesList'] != null) {
@ -577,6 +584,7 @@ class Settings {
? json['defaultPlayBackSpeed']
: (json['defaultPlayBackSpeed'] as int).toDouble();
fullScreenPlayer = json['fullScreenPlayer'];
forceLandscapePlayer = json['forceLandscapePlayer'];
updateProgressAfterReading = json['updateProgressAfterReading'];
enableAniSkip = json['enableAniSkip'];
enableAutoSkip = json['enableAutoSkip'];
@ -720,6 +728,7 @@ class Settings {
?.map((v) => v.toJson())
.toList(),
'chapterPageUrlsList': chapterPageUrlsList?.map((v) => v.toJson()).toList(),
'enableLogs': enableLogs,
'checkForAppUpdates': checkForAppUpdates,
'checkForExtensionUpdates': checkForExtensionUpdates,
'cookiesList': cookiesList,
@ -782,6 +791,7 @@ class Settings {
'defaultDoubleTapToSkipLength': defaultDoubleTapToSkipLength,
'defaultPlayBackSpeed': defaultPlayBackSpeed,
'fullScreenPlayer': fullScreenPlayer,
'forceLandscapePlayer': forceLandscapePlayer,
'updateProgressAfterReading': updateProgressAfterReading,
'enableAniSkip': enableAniSkip,
'enableAutoSkip': enableAutoSkip,

File diff suppressed because it is too large Load diff

View file

@ -48,7 +48,6 @@ import 'package:media_kit/generated/libmpv/bindings.dart' as generated;
import 'package:media_kit_video/media_kit_video.dart';
import 'package:media_kit_video/media_kit_video_controls/src/controls/extensions/duration.dart';
import 'package:numberpicker/numberpicker.dart';
import 'package:path/path.dart' as p;
import 'package:path/path.dart' as path;
import 'package:path_provider/path_provider.dart';
import 'package:share_plus/share_plus.dart';
@ -883,6 +882,12 @@ mp.register_script_message('call_button_${button.id}_long', button${button.id}lo
});
_firstTime = false;
}
if (!_isDesktop) {
final forceLandscape = ref.read(forceLandscapePlayerStateProvider);
if (forceLandscape) {
_setLandscapeMode(true);
}
}
_currentPositionSub = _player.stream.position.listen(
_unifiedPositionHandler,
);
@ -930,7 +935,7 @@ mp.register_script_message('call_button_${button.id}_long', button${button.id}lo
if (Platform.isAndroid && useLibass) {
try {
final subDir = await getApplicationDocumentsDirectory();
final fontPath = p.join(subDir.path, 'subfont.ttf');
final fontPath = path.join(subDir.path, 'subfont.ttf');
final data = await rootBundle.load('assets/fonts/subfont.ttf');
final bytes = data.buffer.asInt8List(
data.offsetInBytes,
@ -2310,7 +2315,9 @@ mp.register_script_message('call_button_${button.id}_long', button${button.id}lo
);
final dir = await StorageProvider()
.getGalleryDirectory();
final file = File(p.join(dir!.path, "$name.png"));
final file = File(
path.join(dir!.path, "$name.png"),
);
file.writeAsBytesSync(imageBytes!);
if (context.mounted) {
botToast(context.l10n.picture_saved, second: 3);

View file

@ -10,11 +10,11 @@ part of 'anime_player_controller_provider.dart';
// ignore_for_file: type=lint, type=warning
@ProviderFor(AnimeStreamController)
const animeStreamControllerProvider = AnimeStreamControllerFamily._();
final animeStreamControllerProvider = AnimeStreamControllerFamily._();
final class AnimeStreamControllerProvider
extends $NotifierProvider<AnimeStreamController, KeepAliveLink> {
const AnimeStreamControllerProvider._({
AnimeStreamControllerProvider._({
required AnimeStreamControllerFamily super.from,
required Chapter super.argument,
}) : super(
@ -70,7 +70,7 @@ final class AnimeStreamControllerFamily extends $Family
KeepAliveLink,
Chapter
> {
const AnimeStreamControllerFamily._()
AnimeStreamControllerFamily._()
: super(
retry: null,
name: r'animeStreamControllerProvider',
@ -94,7 +94,6 @@ abstract class _$AnimeStreamController extends $Notifier<KeepAliveLink> {
@$mustCallSuper
@override
void runBuild() {
final created = build(episode: _$args);
final ref = this.ref as $Ref<KeepAliveLink, KeepAliveLink>;
final element =
ref.element
@ -104,6 +103,6 @@ abstract class _$AnimeStreamController extends $Notifier<KeepAliveLink> {
Object?,
Object?
>;
element.handleValue(ref, created);
element.handleCreate(ref, () => build(episode: _$args));
}
}

View file

@ -10,11 +10,11 @@ part of 'state_provider.dart';
// ignore_for_file: type=lint, type=warning
@ProviderFor(SubtitleSettingsState)
const subtitleSettingsStateProvider = SubtitleSettingsStateProvider._();
final subtitleSettingsStateProvider = SubtitleSettingsStateProvider._();
final class SubtitleSettingsStateProvider
extends $NotifierProvider<SubtitleSettingsState, PlayerSubtitleSettings> {
const SubtitleSettingsStateProvider._()
SubtitleSettingsStateProvider._()
: super(
from: null,
argument: null,
@ -50,7 +50,6 @@ abstract class _$SubtitleSettingsState
@$mustCallSuper
@override
void runBuild() {
final created = build();
final ref =
this.ref as $Ref<PlayerSubtitleSettings, PlayerSubtitleSettings>;
final element =
@ -61,6 +60,6 @@ abstract class _$SubtitleSettingsState
Object?,
Object?
>;
element.handleValue(ref, created);
element.handleCreate(ref, build);
}
}

View file

@ -12,6 +12,7 @@ import 'package:mangayomi/modules/browse/extension/extension_screen.dart';
import 'package:mangayomi/modules/browse/sources/sources_screen.dart';
import 'package:mangayomi/modules/library/widgets/search_text_form_field.dart';
import 'package:mangayomi/services/fetch_sources_list.dart';
import 'package:mangayomi/utils/item_type_localization.dart';
class BrowseScreen extends ConsumerStatefulWidget {
const BrowseScreen({super.key});
@ -20,19 +21,35 @@ class BrowseScreen extends ConsumerStatefulWidget {
ConsumerState<BrowseScreen> createState() => _BrowseScreenState();
}
enum BrowseTabKind { sources, extensions }
class BrowseTab {
final ItemType type;
final BrowseTabKind kind;
const BrowseTab(this.type, this.kind);
}
class _BrowseScreenState extends ConsumerState<BrowseScreen>
with TickerProviderStateMixin {
late final hideItems = ref.read(hideItemsStateProvider);
final _textEditingController = TextEditingController();
late TabController _tabBarController;
late final _tabList = [
if (!hideItems.contains("/MangaLibrary")) 'manga',
if (!hideItems.contains("/AnimeLibrary")) 'anime',
if (!hideItems.contains("/NovelLibrary")) 'novel',
if (!hideItems.contains("/MangaLibrary")) 'mangaExtension',
if (!hideItems.contains("/AnimeLibrary")) 'animeExtension',
if (!hideItems.contains("/NovelLibrary")) 'novelExtension',
late final List<BrowseTab> _tabList = [
if (!hideItems.contains("/MangaLibrary"))
BrowseTab(ItemType.manga, BrowseTabKind.sources),
if (!hideItems.contains("/AnimeLibrary"))
BrowseTab(ItemType.anime, BrowseTabKind.sources),
if (!hideItems.contains("/NovelLibrary"))
BrowseTab(ItemType.novel, BrowseTabKind.sources),
if (!hideItems.contains("/MangaLibrary"))
BrowseTab(ItemType.manga, BrowseTabKind.extensions),
if (!hideItems.contains("/AnimeLibrary"))
BrowseTab(ItemType.anime, BrowseTabKind.extensions),
if (!hideItems.contains("/NovelLibrary"))
BrowseTab(ItemType.novel, BrowseTabKind.extensions),
];
@override
@ -65,11 +82,8 @@ class _BrowseScreenState extends ConsumerState<BrowseScreen>
if (_tabList.isEmpty) {
return SizedBox.shrink();
}
final containsExtensionTab = [
"mangaExtension",
"animeExtension",
"novelExtension",
].any((element) => _tabList[_tabBarController.index] == element);
final currentTab = _tabList[_tabBarController.index];
final isExtensionTab = currentTab.kind == BrowseTabKind.extensions;
final l10n = l10nLocalizations(context)!;
return DefaultTabController(
@ -102,9 +116,7 @@ class _BrowseScreenState extends ConsumerState<BrowseScreen>
)
: Row(
children: [
if (_tabBarController.index == 3 ||
_tabBarController.index == 4 ||
_tabBarController.index == 5)
if (isExtensionTab)
IconButton(
onPressed: () {
context.push('/createExtension');
@ -117,26 +129,19 @@ class _BrowseScreenState extends ConsumerState<BrowseScreen>
IconButton(
splashRadius: 20,
onPressed: () {
if (containsExtensionTab) {
if (isExtensionTab) {
setState(() {
_isSearch = true;
});
} else {
context.push(
'/globalSearch',
extra: (
null,
switch (_tabList[_tabBarController.index]) {
"manga" => ItemType.manga,
"anime" => ItemType.anime,
_ => ItemType.novel,
},
),
extra: (null, currentTab.type),
);
}
},
icon: Icon(
!containsExtensionTab
!isExtensionTab
? Icons.travel_explore_rounded
: Icons.search_rounded,
color: Theme.of(context).hintColor,
@ -148,16 +153,12 @@ class _BrowseScreenState extends ConsumerState<BrowseScreen>
splashRadius: 20,
onPressed: () {
context.push(
containsExtensionTab ? '/ExtensionLang' : '/sourceFilter',
extra: switch (_tabList[_tabBarController.index]) {
"manga" || "mangaExtension" => ItemType.manga,
"anime" || "animeExtension" => ItemType.anime,
_ => ItemType.novel,
},
isExtensionTab ? '/ExtensionLang' : '/sourceFilter',
extra: currentTab.type,
);
},
icon: Icon(
!containsExtensionTab
!isExtensionTab
? Icons.filter_list_sharp
: Icons.translate_rounded,
color: Theme.of(context).hintColor,
@ -168,86 +169,44 @@ class _BrowseScreenState extends ConsumerState<BrowseScreen>
indicatorSize: TabBarIndicatorSize.label,
isScrollable: true,
controller: _tabBarController,
tabs: [
if (!hideItems.contains("/MangaLibrary"))
Tab(text: l10n.manga_sources),
if (!hideItems.contains("/AnimeLibrary"))
Tab(text: l10n.anime_sources),
if (!hideItems.contains("/NovelLibrary"))
Tab(text: l10n.novel_sources),
if (!hideItems.contains("/MangaLibrary"))
Tab(
child: Row(
children: [
Text(l10n.manga_extensions),
tabs: _tabList.map((tab) {
final type = tab.type;
final isExt = tab.kind == BrowseTabKind.extensions;
return Tab(
child: Row(
children: [
Text(
isExt
? type.localizedExtensions(l10n)
: type.localizedSources(l10n),
),
if (isExt) ...[
const SizedBox(width: 8),
_extensionUpdateNumbers(ref, ItemType.manga),
_extensionUpdateNumbers(ref, type),
],
),
],
),
if (!hideItems.contains("/AnimeLibrary"))
Tab(
child: Row(
children: [
Text(l10n.anime_extensions),
const SizedBox(width: 8),
_extensionUpdateNumbers(ref, ItemType.anime),
],
),
),
if (!hideItems.contains("/NovelLibrary"))
Tab(
child: Row(
children: [
Text(l10n.novel_extensions),
const SizedBox(width: 8),
_extensionUpdateNumbers(ref, ItemType.novel),
],
),
),
],
);
}).toList(),
),
),
body: TabBarView(
controller: _tabBarController,
children: [
if (!hideItems.contains("/MangaLibrary"))
SourcesScreen(
itemType: ItemType.manga,
tabIndex: (index) {
_tabBarController.animateTo(index);
},
),
if (!hideItems.contains("/AnimeLibrary"))
SourcesScreen(
itemType: ItemType.anime,
tabIndex: (index) {
_tabBarController.animateTo(index);
},
),
if (!hideItems.contains("/NovelLibrary"))
SourcesScreen(
itemType: ItemType.novel,
tabIndex: (index) {
_tabBarController.animateTo(index);
},
),
if (!hideItems.contains("/MangaLibrary"))
ExtensionScreen(
children: _tabList.map((tab) {
if (tab.kind == BrowseTabKind.sources) {
return SourcesScreen(
itemType: tab.type,
tabs: _tabList,
tabIndex: (index) => _tabBarController.animateTo(index),
);
} else {
return ExtensionScreen(
query: _textEditingController.text,
itemType: ItemType.manga,
),
if (!hideItems.contains("/AnimeLibrary"))
ExtensionScreen(
query: _textEditingController.text,
itemType: ItemType.anime,
),
if (!hideItems.contains("/NovelLibrary"))
ExtensionScreen(
query: _textEditingController.text,
itemType: ItemType.novel,
),
],
itemType: tab.type,
);
}
}).toList(),
),
),
);

View file

@ -1,3 +1,4 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:go_router/go_router.dart';
@ -30,6 +31,12 @@ class _ExtensionDetailState extends ConsumerState<ExtensionDetail> {
late Source source = isar.sources.getSync(widget.source.id!)!;
late List<SourcePreference>? sourcePreference = () {
try {
if (source.sourceCodeLanguage == SourceCodeLanguage.mihon &&
source.preferenceList != null) {
return (jsonDecode(source.preferenceList!) as List)
.map((e) => SourcePreference.fromJson(e))
.toList();
}
return getSourcePreference(
source: source,
).map((e) => getSourcePreferenceEntry(e.key!, source.id!)).toList();

View file

@ -10,7 +10,7 @@ part of 'extensions_provider.dart';
// ignore_for_file: type=lint, type=warning
@ProviderFor(getExtensionsStream)
const getExtensionsStreamProvider = GetExtensionsStreamFamily._();
final getExtensionsStreamProvider = GetExtensionsStreamFamily._();
final class GetExtensionsStreamProvider
extends
@ -20,7 +20,7 @@ final class GetExtensionsStreamProvider
Stream<List<Source>>
>
with $FutureModifier<List<Source>>, $StreamProvider<List<Source>> {
const GetExtensionsStreamProvider._({
GetExtensionsStreamProvider._({
required GetExtensionsStreamFamily super.from,
required ItemType super.argument,
}) : super(
@ -69,7 +69,7 @@ String _$getExtensionsStreamHash() =>
final class GetExtensionsStreamFamily extends $Family
with $FunctionalFamilyOverride<Stream<List<Source>>, ItemType> {
const GetExtensionsStreamFamily._()
GetExtensionsStreamFamily._()
: super(
retry: null,
name: r'getExtensionsStreamProvider',

View file

@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:mangayomi/modules/browse/browse_screen.dart';
import 'package:mangayomi/modules/widgets/custom_sliver_grouped_list_view.dart';
import 'package:isar_community/isar.dart';
import 'package:mangayomi/main.dart';
@ -11,10 +12,12 @@ import 'package:mangayomi/utils/language.dart';
class SourcesScreen extends ConsumerStatefulWidget {
final Function(int) tabIndex;
final List<BrowseTab> tabs;
final ItemType itemType;
const SourcesScreen({
required this.tabIndex,
required this.itemType,
required this.tabs,
super.key,
});
@ -62,13 +65,17 @@ class _SourcesScreenState extends ConsumerState<SourcesScreen> {
Padding(
padding: const EdgeInsets.all(8.0),
child: ElevatedButton.icon(
onPressed: () => widget.tabIndex(
widget.itemType == ItemType.manga
? 3
: widget.itemType == ItemType.anime
? 4
: 5,
),
onPressed: () {
final extensionIndex = widget.tabs.indexWhere(
(t) =>
t.type == widget.itemType &&
t.kind == BrowseTabKind.extensions,
);
if (extensionIndex != -1) {
widget.tabIndex(extensionIndex);
}
},
icon: const Icon(Icons.extension_rounded),
label: Text(context.l10n.show_extensions),
),

View file

@ -8,6 +8,7 @@ import 'package:mangayomi/models/source.dart';
import 'package:mangayomi/providers/l10n_providers.dart';
import 'package:mangayomi/utils/cached_network.dart';
import 'package:mangayomi/utils/extensions/build_context_extensions.dart';
import 'package:mangayomi/utils/item_type_localization.dart';
import 'package:mangayomi/utils/language.dart';
class SourceListTile extends StatelessWidget {
@ -81,11 +82,7 @@ class SourceListTile extends StatelessWidget {
title: Text(
!isLocal
? source.name!
: "${context.l10n.local_source} ${source.itemType == ItemType.manga
? context.l10n.manga
: source.itemType == ItemType.anime
? context.l10n.anime
: context.l10n.novel}",
: "${context.l10n.local_source} ${source.itemType.localized(context.l10n)}",
),
trailing: SizedBox(
width: 150,

View file

@ -7,6 +7,7 @@ import 'package:isar_community/isar.dart';
import 'package:mangayomi/models/chapter.dart';
import 'package:mangayomi/models/manga.dart';
import 'package:mangayomi/modules/calendar/providers/calendar_provider.dart';
import 'package:mangayomi/modules/more/settings/reader/providers/reader_state_provider.dart';
import 'package:mangayomi/modules/widgets/custom_extended_image_provider.dart';
import 'package:mangayomi/modules/widgets/custom_sliver_grouped_list_view.dart';
import 'package:mangayomi/modules/widgets/progress_center.dart';
@ -15,6 +16,8 @@ import 'package:mangayomi/utils/constant.dart';
import 'package:mangayomi/utils/date.dart';
import 'package:mangayomi/utils/extensions/build_context_extensions.dart';
import 'package:mangayomi/utils/headers.dart';
import 'package:mangayomi/utils/item_type_filters.dart';
import 'package:mangayomi/utils/item_type_localization.dart';
import 'package:table_calendar/table_calendar.dart';
class CalendarScreen extends ConsumerStatefulWidget {
@ -35,11 +38,19 @@ class _CalendarScreenState extends ConsumerState<CalendarScreen> {
DateTime? _selectedDay;
DateTime? _rangeStart;
DateTime? _rangeEnd;
late ItemType? itemType = widget.itemType ?? ItemType.manga;
late ItemType? itemType;
late List<ItemType> _visibleTypes;
@override
void initState() {
super.initState();
_visibleTypes = hiddenItemTypes(ref.read(hideItemsStateProvider));
final initialItemType = widget.itemType ?? ItemType.manga;
if (_visibleTypes.contains(initialItemType)) {
itemType = initialItemType;
} else {
itemType = _visibleTypes.isNotEmpty ? _visibleTypes.first : null;
}
_selectedDay = _focusedDay;
_selectedEntries = ValueNotifier([]);
}
@ -69,31 +80,7 @@ class _CalendarScreenState extends ConsumerState<CalendarScreen> {
SliverToBoxAdapter(
child: Column(
children: [
ListTile(
title: Padding(
padding: const EdgeInsets.symmetric(vertical: 3),
child: Row(
children: [
Icon(
Icons.warning_amber_outlined,
color: context.secondaryColor,
),
const SizedBox(width: 10),
Flexible(
child: Text(
l10n.calendar_info,
softWrap: true,
overflow: TextOverflow.clip,
style: TextStyle(
fontSize: 13,
color: context.secondaryColor,
),
),
),
],
),
),
),
_buildWarningTile(context),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 15),
child: Row(
@ -107,29 +94,15 @@ class _CalendarScreenState extends ConsumerState<CalendarScreen> {
borderRadius: BorderRadius.circular(50),
),
),
segments: [
ButtonSegment(
value: ItemType.manga.index,
segments: _visibleTypes.map((type) {
return ButtonSegment(
value: type.index,
label: Padding(
padding: const EdgeInsets.all(12),
child: Text(l10n.manga),
child: Text(type.localized(l10n)),
),
),
ButtonSegment(
value: ItemType.anime.index,
label: Padding(
padding: const EdgeInsets.all(12),
child: Text(l10n.anime),
),
),
ButtonSegment(
value: ItemType.novel.index,
label: Padding(
padding: const EdgeInsets.all(12),
child: Text(l10n.novel),
),
),
],
);
}).toList(),
selected: {itemType?.index},
onSelectionChanged: (newSelection) {
if (newSelection.isNotEmpty &&
@ -145,40 +118,7 @@ class _CalendarScreenState extends ConsumerState<CalendarScreen> {
],
),
),
TableCalendar(
firstDay: firstDay,
lastDay: lastDay,
focusedDay: _focusedDay,
locale: locale.toLanguageTag(),
selectedDayPredicate: (day) =>
isSameDay(_selectedDay, day),
rangeStartDay: _rangeStart,
rangeEndDay: _rangeEnd,
calendarFormat: _calendarFormat,
rangeSelectionMode: _rangeSelectionMode,
eventLoader: (day) => _getEntriesForDay(day, data),
startingDayOfWeek: StartingDayOfWeek.monday,
calendarStyle: CalendarStyle(
outsideDaysVisible: true,
weekendTextStyle: TextStyle(
color: context.primaryColor,
),
),
onDaySelected: (selectedDay, focusedDay) =>
_onDaySelected(selectedDay, focusedDay, data),
onRangeSelected: (start, end, focusedDay) =>
_onRangeSelected(start, end, focusedDay, data),
onFormatChanged: (format) {
if (_calendarFormat != format) {
setState(() {
_calendarFormat = format;
});
}
},
onPageChanged: (focusedDay) {
_focusedDay = focusedDay;
},
),
_buildCalendar(data, locale),
const SizedBox(height: 15),
],
),
@ -241,8 +181,64 @@ class _CalendarScreenState extends ConsumerState<CalendarScreen> {
);
}
Widget _buildWarningTile(BuildContext context) {
return ListTile(
title: Padding(
padding: const EdgeInsets.symmetric(vertical: 3),
child: Row(
children: [
Icon(Icons.warning_amber_outlined, color: context.secondaryColor),
const SizedBox(width: 10),
Flexible(
child: Text(
context.l10n.calendar_info,
softWrap: true,
overflow: TextOverflow.clip,
style: TextStyle(fontSize: 13, color: context.secondaryColor),
),
),
],
),
),
);
}
Widget _buildCalendar(List<Manga> data, Locale locale) {
return TableCalendar(
firstDay: firstDay,
lastDay: lastDay,
focusedDay: _focusedDay,
locale: locale.toLanguageTag(),
selectedDayPredicate: (day) => isSameDay(_selectedDay, day),
rangeStartDay: _rangeStart,
rangeEndDay: _rangeEnd,
calendarFormat: _calendarFormat,
rangeSelectionMode: _rangeSelectionMode,
eventLoader: (day) => _getEntriesForDay(day, data),
startingDayOfWeek: StartingDayOfWeek.monday,
calendarStyle: CalendarStyle(
outsideDaysVisible: true,
weekendTextStyle: TextStyle(color: context.primaryColor),
),
onDaySelected: (selectedDay, focusedDay) =>
_onDaySelected(selectedDay, focusedDay, data),
onRangeSelected: (start, end, focusedDay) =>
_onRangeSelected(start, end, focusedDay, data),
onFormatChanged: (format) {
if (_calendarFormat != format) {
setState(() => _calendarFormat = format);
}
},
onPageChanged: (focusedDay) => _focusedDay = focusedDay,
);
}
final Map<String, List<Manga>> _dayCache = {};
List<Manga> _getEntriesForDay(DateTime day, List<Manga> data) {
return data.where((e) {
final key = "${day.year}-${day.month}-${day.day}";
if (_dayCache.containsKey(key)) return _dayCache[key]!;
final result = data.where((e) {
final lastChapter = e.chapters
.filter()
.sortByDateUploadDesc()
@ -252,10 +248,12 @@ class _CalendarScreenState extends ConsumerState<CalendarScreen> {
? DateTime.fromMillisecondsSinceEpoch(lastDate)
: DateTime.now();
final temp = start.add(Duration(days: e.smartUpdateDays!));
final predictedDay = "${temp.year}-${temp.month}-${temp.day}";
final selectedDay = "${day.year}-${day.month}-${day.day}";
return predictedDay == selectedDay;
return temp.year == day.year &&
temp.month == day.month &&
temp.day == day.day;
}).toList();
_dayCache[key] = result;
return result;
}
List<Manga> _getEntriesForRange(

View file

@ -10,7 +10,7 @@ part of 'calendar_provider.dart';
// ignore_for_file: type=lint, type=warning
@ProviderFor(getCalendarStream)
const getCalendarStreamProvider = GetCalendarStreamFamily._();
final getCalendarStreamProvider = GetCalendarStreamFamily._();
final class GetCalendarStreamProvider
extends
@ -20,7 +20,7 @@ final class GetCalendarStreamProvider
Stream<List<Manga>>
>
with $FutureModifier<List<Manga>>, $StreamProvider<List<Manga>> {
const GetCalendarStreamProvider._({
GetCalendarStreamProvider._({
required GetCalendarStreamFamily super.from,
required ItemType? super.argument,
}) : super(
@ -68,7 +68,7 @@ String _$getCalendarStreamHash() => r'850d81742f8ac5ce88175732c0edf57a7a9295d4';
final class GetCalendarStreamFamily extends $Family
with $FunctionalFamilyOverride<Stream<List<Manga>>, ItemType?> {
const GetCalendarStreamFamily._()
GetCalendarStreamFamily._()
: super(
retry: null,
name: r'getCalendarStreamProvider',

View file

@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:go_router/go_router.dart';
import 'package:mangayomi/l10n/generated/app_localizations.dart';
import 'package:mangayomi/modules/widgets/base_library_tab_screen.dart';
import 'package:mangayomi/modules/widgets/custom_sliver_grouped_list_view.dart';
import 'package:isar_community/isar.dart';
@ -12,7 +13,6 @@ import 'package:mangayomi/models/chapter.dart';
import 'package:mangayomi/models/history.dart';
import 'package:mangayomi/models/manga.dart';
import 'package:mangayomi/modules/history/providers/isar_providers.dart';
import 'package:mangayomi/modules/more/settings/reader/providers/reader_state_provider.dart';
import 'package:mangayomi/modules/more/settings/sync/providers/sync_providers.dart';
import 'package:mangayomi/providers/l10n_providers.dart';
import 'package:mangayomi/utils/cached_network.dart';
@ -20,7 +20,6 @@ import 'package:mangayomi/utils/constant.dart';
import 'package:mangayomi/utils/date.dart';
import 'package:mangayomi/utils/extensions/chapter.dart';
import 'package:mangayomi/utils/headers.dart';
import 'package:mangayomi/modules/library/widgets/search_text_form_field.dart';
import 'package:mangayomi/modules/widgets/error_text.dart';
import 'package:mangayomi/modules/widgets/progress_center.dart';
@ -31,175 +30,61 @@ class HistoryScreen extends ConsumerStatefulWidget {
ConsumerState<HistoryScreen> createState() => _HistoryScreenState();
}
class _HistoryScreenState extends ConsumerState<HistoryScreen>
with TickerProviderStateMixin {
final _textEditingController = TextEditingController();
late TabController _tabBarController;
class _HistoryScreenState extends BaseLibraryTabScreenState<HistoryScreen> {
@override
String get title => l10nLocalizations(context)!.history;
void tabListener() {
setState(() {
_textEditingController.clear();
_isSearch = false;
});
@override
Widget buildTab(ItemType type) {
return HistoryTab(itemType: type, query: textEditingController.text);
}
@override
void initState() {
super.initState();
final hideItems = ref.read(hideItemsStateProvider);
final tabCount = [
if (!hideItems.contains("/MangaLibrary")) "/MangaLibrary",
if (!hideItems.contains("/AnimeLibrary")) "/AnimeLibrary",
if (!hideItems.contains("/NovelLibrary")) "/NovelLibrary",
].length;
_tabBarController = TabController(length: tabCount, vsync: this);
_tabBarController.addListener(tabListener);
}
@override
void dispose() {
_tabBarController.dispose();
_textEditingController.dispose();
super.dispose();
}
bool _isSearch = false;
@override
Widget build(BuildContext context) {
final hideItems = ref.watch(hideItemsStateProvider);
List<Widget> buildExtraActions(BuildContext context) {
final l10n = l10nLocalizations(context)!;
return Scaffold(
appBar: AppBar(
elevation: 0,
backgroundColor: Colors.transparent,
title: _isSearch
? null
: Text(
l10n.history,
style: TextStyle(color: Theme.of(context).hintColor),
),
actions: [
_isSearch
? SeachFormTextField(
onChanged: (value) {
setState(() {});
},
onSuffixPressed: () {
_textEditingController.clear();
setState(() {});
},
onPressed: () {
setState(() {
_isSearch = false;
});
_textEditingController.clear();
},
controller: _textEditingController,
)
: IconButton(
splashRadius: 20,
onPressed: () {
setState(() {
_isSearch = true;
});
},
icon: Icon(Icons.search, color: Theme.of(context).hintColor),
),
IconButton(
splashRadius: 20,
onPressed: () {
showDialog(
context: context,
builder: (context) {
return AlertDialog(
title: Text(l10n.remove_everything),
content: Text(l10n.remove_everything_msg),
actions: [
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
TextButton(
onPressed: () {
Navigator.pop(context);
},
child: Text(l10n.cancel),
),
const SizedBox(width: 15),
TextButton(
onPressed: () async {
if (mounted) Navigator.pop(context);
await _clearHistory(hideItems);
},
child: Text(l10n.ok),
),
],
),
],
);
},
);
},
icon: Icon(
Icons.delete_sweep_outlined,
color: Theme.of(context).hintColor,
),
),
],
bottom: TabBar(
indicatorSize: TabBarIndicatorSize.tab,
controller: _tabBarController,
tabs: [
if (!hideItems.contains("/MangaLibrary")) Tab(text: l10n.manga),
if (!hideItems.contains("/AnimeLibrary")) Tab(text: l10n.anime),
if (!hideItems.contains("/NovelLibrary")) Tab(text: l10n.novel),
],
return [
IconButton(
splashRadius: 20,
icon: Icon(
Icons.delete_sweep_outlined,
color: Theme.of(context).hintColor,
),
onPressed: () {
showDialog(
context: context,
builder: (dialogContext) => AlertDialog(
title: Text(l10n.remove_everything),
content: Text(l10n.remove_everything_msg),
actions: [
TextButton(
onPressed: () => Navigator.of(dialogContext).pop(),
child: Text(l10n.cancel),
),
TextButton(
onPressed: () async {
Navigator.of(dialogContext).pop();
await _clearHistory();
},
child: Text(l10n.ok),
),
],
),
);
},
),
body: TabBarView(
controller: _tabBarController,
children: [
if (!hideItems.contains("/MangaLibrary"))
HistoryTab(
itemType: ItemType.manga,
query: _textEditingController.text,
),
if (!hideItems.contains("/AnimeLibrary"))
HistoryTab(
itemType: ItemType.anime,
query: _textEditingController.text,
),
if (!hideItems.contains("/NovelLibrary"))
HistoryTab(
itemType: ItemType.novel,
query: _textEditingController.text,
),
],
),
);
];
}
Future<void> _clearHistory(List<String> hideItems) async {
Future<void> _clearHistory() async {
List<History> histories = await isar.historys
.filter()
.idIsNotNull()
.chapter(
(q) =>
q.manga((q) => q.itemTypeEqualTo(getCurrentItemType(hideItems))),
)
.chapter((q) => q.manga((q) => q.itemTypeEqualTo(getCurrentItemType())))
.findAll();
final List<Id> idsToDelete = histories.map((h) => h.id!).toList();
await isar.writeTxn(() => isar.historys.deleteAll(idsToDelete));
}
ItemType getCurrentItemType(List<String> hideItems) {
return _tabBarController.index == 0 && !hideItems.contains("/MangaLibrary")
? ItemType.manga
: _tabBarController.index ==
1 - (hideItems.contains("/MangaLibrary") ? 1 : 0) &&
!hideItems.contains("/AnimeLibrary")
? ItemType.anime
: ItemType.novel;
}
}
class HistoryTab extends ConsumerStatefulWidget {

View file

@ -10,7 +10,7 @@ part of 'isar_providers.dart';
// ignore_for_file: type=lint, type=warning
@ProviderFor(getAllHistoryStream)
const getAllHistoryStreamProvider = GetAllHistoryStreamFamily._();
final getAllHistoryStreamProvider = GetAllHistoryStreamFamily._();
final class GetAllHistoryStreamProvider
extends
@ -20,7 +20,7 @@ final class GetAllHistoryStreamProvider
Stream<List<History>>
>
with $FutureModifier<List<History>>, $StreamProvider<List<History>> {
const GetAllHistoryStreamProvider._({
GetAllHistoryStreamProvider._({
required GetAllHistoryStreamFamily super.from,
required ({ItemType itemType, String search}) super.argument,
}) : super(
@ -77,7 +77,7 @@ final class GetAllHistoryStreamFamily extends $Family
Stream<List<History>>,
({ItemType itemType, String search})
> {
const GetAllHistoryStreamFamily._()
GetAllHistoryStreamFamily._()
: super(
retry: null,
name: r'getAllHistoryStreamProvider',
@ -99,7 +99,7 @@ final class GetAllHistoryStreamFamily extends $Family
}
@ProviderFor(getAllUpdateStream)
const getAllUpdateStreamProvider = GetAllUpdateStreamFamily._();
final getAllUpdateStreamProvider = GetAllUpdateStreamFamily._();
final class GetAllUpdateStreamProvider
extends
@ -109,7 +109,7 @@ final class GetAllUpdateStreamProvider
Stream<List<Update>>
>
with $FutureModifier<List<Update>>, $StreamProvider<List<Update>> {
const GetAllUpdateStreamProvider._({
GetAllUpdateStreamProvider._({
required GetAllUpdateStreamFamily super.from,
required ({ItemType itemType, String search}) super.argument,
}) : super(
@ -166,7 +166,7 @@ final class GetAllUpdateStreamFamily extends $Family
Stream<List<Update>>,
({ItemType itemType, String search})
> {
const GetAllUpdateStreamFamily._()
GetAllUpdateStreamFamily._()
: super(
retry: null,
name: r'getAllUpdateStreamProvider',

View file

@ -2,12 +2,10 @@
import 'dart:io';
import 'dart:math';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:isar_community/isar.dart';
import 'package:mangayomi/eval/model/m_bridge.dart';
import 'package:mangayomi/main.dart';
import 'package:mangayomi/models/changed.dart';
import 'package:mangayomi/models/chapter.dart';
@ -19,10 +17,8 @@ import 'package:mangayomi/models/update.dart';
import 'package:mangayomi/modules/library/providers/add_torrent.dart';
import 'package:mangayomi/modules/library/providers/local_archive.dart';
import 'package:mangayomi/modules/manga/detail/providers/state_providers.dart';
import 'package:mangayomi/modules/manga/detail/providers/update_manga_detail_providers.dart';
import 'package:mangayomi/modules/more/categories/providers/isar_providers.dart';
import 'package:mangayomi/modules/more/providers/downloaded_only_state_provider.dart';
import 'package:mangayomi/modules/more/settings/appearance/providers/theme_mode_state_provider.dart';
import 'package:mangayomi/modules/more/settings/sync/providers/sync_providers.dart';
import 'package:mangayomi/modules/widgets/bottom_select_bar.dart';
import 'package:mangayomi/modules/widgets/category_selection_dialog.dart';
@ -30,6 +26,7 @@ import 'package:mangayomi/modules/widgets/custom_draggable_tabbar.dart';
import 'package:mangayomi/modules/widgets/manga_image_card_widget.dart';
import 'package:mangayomi/providers/l10n_providers.dart';
import 'package:mangayomi/providers/storage_provider.dart';
import 'package:mangayomi/services/library_updater.dart';
import 'package:mangayomi/utils/extensions/build_context_extensions.dart';
import 'package:mangayomi/modules/library/providers/isar_providers.dart';
import 'package:mangayomi/modules/library/providers/library_state_provider.dart';
@ -42,6 +39,7 @@ import 'package:mangayomi/modules/widgets/error_text.dart';
import 'package:mangayomi/modules/widgets/progress_center.dart';
import 'package:mangayomi/utils/extensions/string_extensions.dart';
import 'package:mangayomi/utils/global_style.dart';
import 'package:mangayomi/utils/item_type_localization.dart';
import 'package:path/path.dart' as p;
import 'package:riverpod_annotation/riverpod_annotation.dart';
@ -82,53 +80,6 @@ class _LibraryScreenState extends ConsumerState<LibraryScreen>
super.dispose();
}
Future<void> _updateLibrary(List<Manga> mangaList) async {
bool isDark = ref.read(themeModeStateProvider);
botToast(
context.l10n.updating_library("0", "0", "0"),
fontSize: 13,
second: 30,
alignY: !context.isTablet ? 0.85 : 1,
themeDark: isDark,
);
int numbers = 0;
int failed = 0;
for (var manga in mangaList) {
try {
await ref.read(
updateMangaDetailProvider(
mangaId: manga.id,
isInit: false,
showToast: false,
).future,
);
} catch (_) {
failed++;
}
numbers++;
if (mounted) {
botToast(
context.l10n.updating_library(numbers, failed, mangaList.length),
fontSize: 13,
second: 10,
alignY: !context.isTablet ? 0.85 : 1,
animationDuration: 0,
dismissDirections: [DismissDirection.none],
onlyOne: false,
themeDark: isDark,
);
}
}
await Future.doWhile(() async {
await Future.delayed(const Duration(seconds: 1));
if (mangaList.length == numbers) {
return false;
}
return true;
});
BotToast.cleanAll();
}
@override
Widget build(BuildContext context) {
final settingsStream = ref.watch(getSettingsStreamProvider);
@ -776,7 +727,12 @@ class _LibraryScreenState extends ConsumerState<LibraryScreen>
final entriesManga = reverse ? entries.reversed.toList() : entries;
return RefreshIndicator(
onRefresh: () async {
await _updateLibrary(data);
await updateLibrary(
ref: ref,
context: context,
mangaList: data,
itemType: widget.itemType,
);
},
child: displayType == DisplayType.list
? LibraryListViewWidget(
@ -867,7 +823,12 @@ class _LibraryScreenState extends ConsumerState<LibraryScreen>
final entriesManga = reverse ? entries.reversed.toList() : entries;
return RefreshIndicator(
onRefresh: () async {
await _updateLibrary(data);
await updateLibrary(
ref: ref,
context: context,
mangaList: data,
itemType: widget.itemType,
);
},
child: displayType == DisplayType.list
? LibraryListViewWidget(
@ -1901,11 +1862,7 @@ class _LibraryScreenState extends ConsumerState<LibraryScreen>
: Row(
children: [
Text(
widget.itemType == ItemType.manga
? l10n.manga
: widget.itemType == ItemType.anime
? l10n.anime
: l10n.novel,
widget.itemType.localized(l10n),
style: TextStyle(color: Theme.of(context).hintColor),
),
const SizedBox(width: 10),
@ -2013,7 +1970,12 @@ class _LibraryScreenState extends ConsumerState<LibraryScreen>
onSelected: (value) {
if (value == 0) {
manga.whenData((value) {
_updateLibrary(value);
updateLibrary(
ref: ref,
context: context,
mangaList: value,
itemType: widget.itemType,
);
});
} else if (value == 1) {
manga.whenData((value) {

View file

@ -10,13 +10,13 @@ part of 'add_torrent.dart';
// ignore_for_file: type=lint, type=warning
@ProviderFor(addTorrentFromUrlOrFromFile)
const addTorrentFromUrlOrFromFileProvider =
final addTorrentFromUrlOrFromFileProvider =
AddTorrentFromUrlOrFromFileFamily._();
final class AddTorrentFromUrlOrFromFileProvider
extends $FunctionalProvider<AsyncValue<dynamic>, dynamic, FutureOr<dynamic>>
with $FutureModifier<dynamic>, $FutureProvider<dynamic> {
const AddTorrentFromUrlOrFromFileProvider._({
AddTorrentFromUrlOrFromFileProvider._({
required AddTorrentFromUrlOrFromFileFamily super.from,
required (Manga?, {bool init, String? url}) super.argument,
}) : super(
@ -74,7 +74,7 @@ final class AddTorrentFromUrlOrFromFileFamily extends $Family
FutureOr<dynamic>,
(Manga?, {bool init, String? url})
> {
const AddTorrentFromUrlOrFromFileFamily._()
AddTorrentFromUrlOrFromFileFamily._()
: super(
retry: null,
name: r'addTorrentFromUrlOrFromFileProvider',

View file

@ -306,20 +306,16 @@ Future<void> _scanDirectory(Ref ref, Directory? dir) async {
: Uint8List.fromList(coverImage).getCoverImage;
saveManga++;
}
for (var chapter in book.Chapters ?? []) {
chaptersToSave.add(
Chapter(
mangaId: manga.id,
name: chapter.Title is String && chapter.Title.isEmpty
? "Book"
: chapter.Title,
archivePath: chapterPath,
downloadSize: chapterFile.existsSync()
? chapterFile.lengthSync().formattedFileSize()
: null,
)..manga.value = manga,
);
}
chaptersToSave.add(
Chapter(
mangaId: manga.id,
name: book.Title,
archivePath: chapterPath,
downloadSize: chapterFile.existsSync()
? chapterFile.lengthSync().formattedFileSize()
: null,
)..manga.value = manga,
);
} else {
final chap = Chapter(
mangaId: manga.id,

View file

@ -10,11 +10,11 @@ part of 'file_scanner.dart';
// ignore_for_file: type=lint, type=warning
@ProviderFor(LocalFoldersState)
const localFoldersStateProvider = LocalFoldersStateProvider._();
final localFoldersStateProvider = LocalFoldersStateProvider._();
final class LocalFoldersStateProvider
extends $NotifierProvider<LocalFoldersState, List<String>> {
const LocalFoldersStateProvider._()
LocalFoldersStateProvider._()
: super(
from: null,
argument: null,
@ -48,7 +48,6 @@ abstract class _$LocalFoldersState extends $Notifier<List<String>> {
@$mustCallSuper
@override
void runBuild() {
final created = build();
final ref = this.ref as $Ref<List<String>, List<String>>;
final element =
ref.element
@ -58,7 +57,7 @@ abstract class _$LocalFoldersState extends $Notifier<List<String>> {
Object?,
Object?
>;
element.handleValue(ref, created);
element.handleCreate(ref, build);
}
}
@ -81,7 +80,7 @@ abstract class _$LocalFoldersState extends $Notifier<List<String>> {
/// ```
@ProviderFor(scanLocalLibrary)
const scanLocalLibraryProvider = ScanLocalLibraryProvider._();
final scanLocalLibraryProvider = ScanLocalLibraryProvider._();
/// Scans `Mangayomi/local` folder (if exists) for Mangas/Animes and imports in library.
///
@ -121,7 +120,7 @@ final class ScanLocalLibraryProvider
/// Archivetypes: cbz, zip, cbt, tar
/// Other types: epub
/// ```
const ScanLocalLibraryProvider._()
ScanLocalLibraryProvider._()
: super(
from: null,
argument: null,

View file

@ -10,7 +10,7 @@ part of 'isar_providers.dart';
// ignore_for_file: type=lint, type=warning
@ProviderFor(getAllMangaStream)
const getAllMangaStreamProvider = GetAllMangaStreamFamily._();
final getAllMangaStreamProvider = GetAllMangaStreamFamily._();
final class GetAllMangaStreamProvider
extends
@ -20,7 +20,7 @@ final class GetAllMangaStreamProvider
Stream<List<Manga>>
>
with $FutureModifier<List<Manga>>, $StreamProvider<List<Manga>> {
const GetAllMangaStreamProvider._({
GetAllMangaStreamProvider._({
required GetAllMangaStreamFamily super.from,
required ({int? categoryId, ItemType itemType}) super.argument,
}) : super(
@ -76,7 +76,7 @@ final class GetAllMangaStreamFamily extends $Family
Stream<List<Manga>>,
({int? categoryId, ItemType itemType})
> {
const GetAllMangaStreamFamily._()
GetAllMangaStreamFamily._()
: super(
retry: null,
name: r'getAllMangaStreamProvider',
@ -98,7 +98,7 @@ final class GetAllMangaStreamFamily extends $Family
}
@ProviderFor(getAllMangaWithoutCategoriesStream)
const getAllMangaWithoutCategoriesStreamProvider =
final getAllMangaWithoutCategoriesStreamProvider =
GetAllMangaWithoutCategoriesStreamFamily._();
final class GetAllMangaWithoutCategoriesStreamProvider
@ -109,7 +109,7 @@ final class GetAllMangaWithoutCategoriesStreamProvider
Stream<List<Manga>>
>
with $FutureModifier<List<Manga>>, $StreamProvider<List<Manga>> {
const GetAllMangaWithoutCategoriesStreamProvider._({
GetAllMangaWithoutCategoriesStreamProvider._({
required GetAllMangaWithoutCategoriesStreamFamily super.from,
required ItemType super.argument,
}) : super(
@ -160,7 +160,7 @@ String _$getAllMangaWithoutCategoriesStreamHash() =>
final class GetAllMangaWithoutCategoriesStreamFamily extends $Family
with $FunctionalFamilyOverride<Stream<List<Manga>>, ItemType> {
const GetAllMangaWithoutCategoriesStreamFamily._()
GetAllMangaWithoutCategoriesStreamFamily._()
: super(
retry: null,
name: r'getAllMangaWithoutCategoriesStreamProvider',
@ -181,7 +181,7 @@ final class GetAllMangaWithoutCategoriesStreamFamily extends $Family
}
@ProviderFor(getSettingsStream)
const getSettingsStreamProvider = GetSettingsStreamProvider._();
final getSettingsStreamProvider = GetSettingsStreamProvider._();
final class GetSettingsStreamProvider
extends
@ -191,7 +191,7 @@ final class GetSettingsStreamProvider
Stream<List<Settings>>
>
with $FutureModifier<List<Settings>>, $StreamProvider<List<Settings>> {
const GetSettingsStreamProvider._()
GetSettingsStreamProvider._()
: super(
from: null,
argument: null,

View file

@ -10,11 +10,11 @@ part of 'library_state_provider.dart';
// ignore_for_file: type=lint, type=warning
@ProviderFor(LibraryDisplayTypeState)
const libraryDisplayTypeStateProvider = LibraryDisplayTypeStateFamily._();
final libraryDisplayTypeStateProvider = LibraryDisplayTypeStateFamily._();
final class LibraryDisplayTypeStateProvider
extends $NotifierProvider<LibraryDisplayTypeState, DisplayType> {
const LibraryDisplayTypeStateProvider._({
LibraryDisplayTypeStateProvider._({
required LibraryDisplayTypeStateFamily super.from,
required ({ItemType itemType, Settings settings}) super.argument,
}) : super(
@ -71,7 +71,7 @@ final class LibraryDisplayTypeStateFamily extends $Family
DisplayType,
({ItemType itemType, Settings settings})
> {
const LibraryDisplayTypeStateFamily._()
LibraryDisplayTypeStateFamily._()
: super(
retry: null,
name: r'libraryDisplayTypeStateProvider',
@ -101,7 +101,6 @@ abstract class _$LibraryDisplayTypeState extends $Notifier<DisplayType> {
@$mustCallSuper
@override
void runBuild() {
final created = build(itemType: _$args.itemType, settings: _$args.settings);
final ref = this.ref as $Ref<DisplayType, DisplayType>;
final element =
ref.element
@ -111,16 +110,19 @@ abstract class _$LibraryDisplayTypeState extends $Notifier<DisplayType> {
Object?,
Object?
>;
element.handleValue(ref, created);
element.handleCreate(
ref,
() => build(itemType: _$args.itemType, settings: _$args.settings),
);
}
}
@ProviderFor(LibraryGridSizeState)
const libraryGridSizeStateProvider = LibraryGridSizeStateFamily._();
final libraryGridSizeStateProvider = LibraryGridSizeStateFamily._();
final class LibraryGridSizeStateProvider
extends $NotifierProvider<LibraryGridSizeState, int?> {
const LibraryGridSizeStateProvider._({
LibraryGridSizeStateProvider._({
required LibraryGridSizeStateFamily super.from,
required ItemType super.argument,
}) : super(
@ -170,7 +172,7 @@ String _$libraryGridSizeStateHash() =>
final class LibraryGridSizeStateFamily extends $Family
with
$ClassFamilyOverride<LibraryGridSizeState, int?, int?, int?, ItemType> {
const LibraryGridSizeStateFamily._()
LibraryGridSizeStateFamily._()
: super(
retry: null,
name: r'libraryGridSizeStateProvider',
@ -194,7 +196,6 @@ abstract class _$LibraryGridSizeState extends $Notifier<int?> {
@$mustCallSuper
@override
void runBuild() {
final created = build(itemType: _$args);
final ref = this.ref as $Ref<int?, int?>;
final element =
ref.element
@ -204,16 +205,16 @@ abstract class _$LibraryGridSizeState extends $Notifier<int?> {
Object?,
Object?
>;
element.handleValue(ref, created);
element.handleCreate(ref, () => build(itemType: _$args));
}
}
@ProviderFor(MangaFilterDownloadedState)
const mangaFilterDownloadedStateProvider = MangaFilterDownloadedStateFamily._();
final mangaFilterDownloadedStateProvider = MangaFilterDownloadedStateFamily._();
final class MangaFilterDownloadedStateProvider
extends $NotifierProvider<MangaFilterDownloadedState, int> {
const MangaFilterDownloadedStateProvider._({
MangaFilterDownloadedStateProvider._({
required MangaFilterDownloadedStateFamily super.from,
required ({List<Manga> mangaList, ItemType itemType, Settings settings})
super.argument,
@ -271,7 +272,7 @@ final class MangaFilterDownloadedStateFamily extends $Family
int,
({List<Manga> mangaList, ItemType itemType, Settings settings})
> {
const MangaFilterDownloadedStateFamily._()
MangaFilterDownloadedStateFamily._()
: super(
retry: null,
name: r'mangaFilterDownloadedStateProvider',
@ -309,11 +310,6 @@ abstract class _$MangaFilterDownloadedState extends $Notifier<int> {
@$mustCallSuper
@override
void runBuild() {
final created = build(
mangaList: _$args.mangaList,
itemType: _$args.itemType,
settings: _$args.settings,
);
final ref = this.ref as $Ref<int, int>;
final element =
ref.element
@ -323,16 +319,23 @@ abstract class _$MangaFilterDownloadedState extends $Notifier<int> {
Object?,
Object?
>;
element.handleValue(ref, created);
element.handleCreate(
ref,
() => build(
mangaList: _$args.mangaList,
itemType: _$args.itemType,
settings: _$args.settings,
),
);
}
}
@ProviderFor(MangaFilterUnreadState)
const mangaFilterUnreadStateProvider = MangaFilterUnreadStateFamily._();
final mangaFilterUnreadStateProvider = MangaFilterUnreadStateFamily._();
final class MangaFilterUnreadStateProvider
extends $NotifierProvider<MangaFilterUnreadState, int> {
const MangaFilterUnreadStateProvider._({
MangaFilterUnreadStateProvider._({
required MangaFilterUnreadStateFamily super.from,
required ({List<Manga> mangaList, ItemType itemType, Settings settings})
super.argument,
@ -390,7 +393,7 @@ final class MangaFilterUnreadStateFamily extends $Family
int,
({List<Manga> mangaList, ItemType itemType, Settings settings})
> {
const MangaFilterUnreadStateFamily._()
MangaFilterUnreadStateFamily._()
: super(
retry: null,
name: r'mangaFilterUnreadStateProvider',
@ -428,11 +431,6 @@ abstract class _$MangaFilterUnreadState extends $Notifier<int> {
@$mustCallSuper
@override
void runBuild() {
final created = build(
mangaList: _$args.mangaList,
itemType: _$args.itemType,
settings: _$args.settings,
);
final ref = this.ref as $Ref<int, int>;
final element =
ref.element
@ -442,16 +440,23 @@ abstract class _$MangaFilterUnreadState extends $Notifier<int> {
Object?,
Object?
>;
element.handleValue(ref, created);
element.handleCreate(
ref,
() => build(
mangaList: _$args.mangaList,
itemType: _$args.itemType,
settings: _$args.settings,
),
);
}
}
@ProviderFor(MangaFilterStartedState)
const mangaFilterStartedStateProvider = MangaFilterStartedStateFamily._();
final mangaFilterStartedStateProvider = MangaFilterStartedStateFamily._();
final class MangaFilterStartedStateProvider
extends $NotifierProvider<MangaFilterStartedState, int> {
const MangaFilterStartedStateProvider._({
MangaFilterStartedStateProvider._({
required MangaFilterStartedStateFamily super.from,
required ({List<Manga> mangaList, ItemType itemType, Settings settings})
super.argument,
@ -509,7 +514,7 @@ final class MangaFilterStartedStateFamily extends $Family
int,
({List<Manga> mangaList, ItemType itemType, Settings settings})
> {
const MangaFilterStartedStateFamily._()
MangaFilterStartedStateFamily._()
: super(
retry: null,
name: r'mangaFilterStartedStateProvider',
@ -547,11 +552,6 @@ abstract class _$MangaFilterStartedState extends $Notifier<int> {
@$mustCallSuper
@override
void runBuild() {
final created = build(
mangaList: _$args.mangaList,
itemType: _$args.itemType,
settings: _$args.settings,
);
final ref = this.ref as $Ref<int, int>;
final element =
ref.element
@ -561,16 +561,23 @@ abstract class _$MangaFilterStartedState extends $Notifier<int> {
Object?,
Object?
>;
element.handleValue(ref, created);
element.handleCreate(
ref,
() => build(
mangaList: _$args.mangaList,
itemType: _$args.itemType,
settings: _$args.settings,
),
);
}
}
@ProviderFor(MangaFilterBookmarkedState)
const mangaFilterBookmarkedStateProvider = MangaFilterBookmarkedStateFamily._();
final mangaFilterBookmarkedStateProvider = MangaFilterBookmarkedStateFamily._();
final class MangaFilterBookmarkedStateProvider
extends $NotifierProvider<MangaFilterBookmarkedState, int> {
const MangaFilterBookmarkedStateProvider._({
MangaFilterBookmarkedStateProvider._({
required MangaFilterBookmarkedStateFamily super.from,
required ({List<Manga> mangaList, ItemType itemType, Settings settings})
super.argument,
@ -628,7 +635,7 @@ final class MangaFilterBookmarkedStateFamily extends $Family
int,
({List<Manga> mangaList, ItemType itemType, Settings settings})
> {
const MangaFilterBookmarkedStateFamily._()
MangaFilterBookmarkedStateFamily._()
: super(
retry: null,
name: r'mangaFilterBookmarkedStateProvider',
@ -666,11 +673,6 @@ abstract class _$MangaFilterBookmarkedState extends $Notifier<int> {
@$mustCallSuper
@override
void runBuild() {
final created = build(
mangaList: _$args.mangaList,
itemType: _$args.itemType,
settings: _$args.settings,
);
final ref = this.ref as $Ref<int, int>;
final element =
ref.element
@ -680,16 +682,23 @@ abstract class _$MangaFilterBookmarkedState extends $Notifier<int> {
Object?,
Object?
>;
element.handleValue(ref, created);
element.handleCreate(
ref,
() => build(
mangaList: _$args.mangaList,
itemType: _$args.itemType,
settings: _$args.settings,
),
);
}
}
@ProviderFor(MangasFilterResultState)
const mangasFilterResultStateProvider = MangasFilterResultStateFamily._();
final mangasFilterResultStateProvider = MangasFilterResultStateFamily._();
final class MangasFilterResultStateProvider
extends $NotifierProvider<MangasFilterResultState, bool> {
const MangasFilterResultStateProvider._({
MangasFilterResultStateProvider._({
required MangasFilterResultStateFamily super.from,
required ({List<Manga> mangaList, ItemType itemType, Settings settings})
super.argument,
@ -747,7 +756,7 @@ final class MangasFilterResultStateFamily extends $Family
bool,
({List<Manga> mangaList, ItemType itemType, Settings settings})
> {
const MangasFilterResultStateFamily._()
MangasFilterResultStateFamily._()
: super(
retry: null,
name: r'mangasFilterResultStateProvider',
@ -785,11 +794,6 @@ abstract class _$MangasFilterResultState extends $Notifier<bool> {
@$mustCallSuper
@override
void runBuild() {
final created = build(
mangaList: _$args.mangaList,
itemType: _$args.itemType,
settings: _$args.settings,
);
final ref = this.ref as $Ref<bool, bool>;
final element =
ref.element
@ -799,17 +803,24 @@ abstract class _$MangasFilterResultState extends $Notifier<bool> {
Object?,
Object?
>;
element.handleValue(ref, created);
element.handleCreate(
ref,
() => build(
mangaList: _$args.mangaList,
itemType: _$args.itemType,
settings: _$args.settings,
),
);
}
}
@ProviderFor(LibraryShowCategoryTabsState)
const libraryShowCategoryTabsStateProvider =
final libraryShowCategoryTabsStateProvider =
LibraryShowCategoryTabsStateFamily._();
final class LibraryShowCategoryTabsStateProvider
extends $NotifierProvider<LibraryShowCategoryTabsState, bool> {
const LibraryShowCategoryTabsStateProvider._({
LibraryShowCategoryTabsStateProvider._({
required LibraryShowCategoryTabsStateFamily super.from,
required ({ItemType itemType, Settings settings}) super.argument,
}) : super(
@ -866,7 +877,7 @@ final class LibraryShowCategoryTabsStateFamily extends $Family
bool,
({ItemType itemType, Settings settings})
> {
const LibraryShowCategoryTabsStateFamily._()
LibraryShowCategoryTabsStateFamily._()
: super(
retry: null,
name: r'libraryShowCategoryTabsStateProvider',
@ -896,7 +907,6 @@ abstract class _$LibraryShowCategoryTabsState extends $Notifier<bool> {
@$mustCallSuper
@override
void runBuild() {
final created = build(itemType: _$args.itemType, settings: _$args.settings);
final ref = this.ref as $Ref<bool, bool>;
final element =
ref.element
@ -906,17 +916,20 @@ abstract class _$LibraryShowCategoryTabsState extends $Notifier<bool> {
Object?,
Object?
>;
element.handleValue(ref, created);
element.handleCreate(
ref,
() => build(itemType: _$args.itemType, settings: _$args.settings),
);
}
}
@ProviderFor(LibraryDownloadedChaptersState)
const libraryDownloadedChaptersStateProvider =
final libraryDownloadedChaptersStateProvider =
LibraryDownloadedChaptersStateFamily._();
final class LibraryDownloadedChaptersStateProvider
extends $NotifierProvider<LibraryDownloadedChaptersState, bool> {
const LibraryDownloadedChaptersStateProvider._({
LibraryDownloadedChaptersStateProvider._({
required LibraryDownloadedChaptersStateFamily super.from,
required ({ItemType itemType, Settings settings}) super.argument,
}) : super(
@ -973,7 +986,7 @@ final class LibraryDownloadedChaptersStateFamily extends $Family
bool,
({ItemType itemType, Settings settings})
> {
const LibraryDownloadedChaptersStateFamily._()
LibraryDownloadedChaptersStateFamily._()
: super(
retry: null,
name: r'libraryDownloadedChaptersStateProvider',
@ -1003,7 +1016,6 @@ abstract class _$LibraryDownloadedChaptersState extends $Notifier<bool> {
@$mustCallSuper
@override
void runBuild() {
final created = build(itemType: _$args.itemType, settings: _$args.settings);
final ref = this.ref as $Ref<bool, bool>;
final element =
ref.element
@ -1013,16 +1025,19 @@ abstract class _$LibraryDownloadedChaptersState extends $Notifier<bool> {
Object?,
Object?
>;
element.handleValue(ref, created);
element.handleCreate(
ref,
() => build(itemType: _$args.itemType, settings: _$args.settings),
);
}
}
@ProviderFor(LibraryLanguageState)
const libraryLanguageStateProvider = LibraryLanguageStateFamily._();
final libraryLanguageStateProvider = LibraryLanguageStateFamily._();
final class LibraryLanguageStateProvider
extends $NotifierProvider<LibraryLanguageState, bool> {
const LibraryLanguageStateProvider._({
LibraryLanguageStateProvider._({
required LibraryLanguageStateFamily super.from,
required ({ItemType itemType, Settings settings}) super.argument,
}) : super(
@ -1078,7 +1093,7 @@ final class LibraryLanguageStateFamily extends $Family
bool,
({ItemType itemType, Settings settings})
> {
const LibraryLanguageStateFamily._()
LibraryLanguageStateFamily._()
: super(
retry: null,
name: r'libraryLanguageStateProvider',
@ -1108,7 +1123,6 @@ abstract class _$LibraryLanguageState extends $Notifier<bool> {
@$mustCallSuper
@override
void runBuild() {
final created = build(itemType: _$args.itemType, settings: _$args.settings);
final ref = this.ref as $Ref<bool, bool>;
final element =
ref.element
@ -1118,16 +1132,19 @@ abstract class _$LibraryLanguageState extends $Notifier<bool> {
Object?,
Object?
>;
element.handleValue(ref, created);
element.handleCreate(
ref,
() => build(itemType: _$args.itemType, settings: _$args.settings),
);
}
}
@ProviderFor(LibraryLocalSourceState)
const libraryLocalSourceStateProvider = LibraryLocalSourceStateFamily._();
final libraryLocalSourceStateProvider = LibraryLocalSourceStateFamily._();
final class LibraryLocalSourceStateProvider
extends $NotifierProvider<LibraryLocalSourceState, bool> {
const LibraryLocalSourceStateProvider._({
LibraryLocalSourceStateProvider._({
required LibraryLocalSourceStateFamily super.from,
required ({ItemType itemType, Settings settings}) super.argument,
}) : super(
@ -1184,7 +1201,7 @@ final class LibraryLocalSourceStateFamily extends $Family
bool,
({ItemType itemType, Settings settings})
> {
const LibraryLocalSourceStateFamily._()
LibraryLocalSourceStateFamily._()
: super(
retry: null,
name: r'libraryLocalSourceStateProvider',
@ -1214,7 +1231,6 @@ abstract class _$LibraryLocalSourceState extends $Notifier<bool> {
@$mustCallSuper
@override
void runBuild() {
final created = build(itemType: _$args.itemType, settings: _$args.settings);
final ref = this.ref as $Ref<bool, bool>;
final element =
ref.element
@ -1224,17 +1240,20 @@ abstract class _$LibraryLocalSourceState extends $Notifier<bool> {
Object?,
Object?
>;
element.handleValue(ref, created);
element.handleCreate(
ref,
() => build(itemType: _$args.itemType, settings: _$args.settings),
);
}
}
@ProviderFor(LibraryShowNumbersOfItemsState)
const libraryShowNumbersOfItemsStateProvider =
final libraryShowNumbersOfItemsStateProvider =
LibraryShowNumbersOfItemsStateFamily._();
final class LibraryShowNumbersOfItemsStateProvider
extends $NotifierProvider<LibraryShowNumbersOfItemsState, bool> {
const LibraryShowNumbersOfItemsStateProvider._({
LibraryShowNumbersOfItemsStateProvider._({
required LibraryShowNumbersOfItemsStateFamily super.from,
required ({ItemType itemType, Settings settings}) super.argument,
}) : super(
@ -1291,7 +1310,7 @@ final class LibraryShowNumbersOfItemsStateFamily extends $Family
bool,
({ItemType itemType, Settings settings})
> {
const LibraryShowNumbersOfItemsStateFamily._()
LibraryShowNumbersOfItemsStateFamily._()
: super(
retry: null,
name: r'libraryShowNumbersOfItemsStateProvider',
@ -1321,7 +1340,6 @@ abstract class _$LibraryShowNumbersOfItemsState extends $Notifier<bool> {
@$mustCallSuper
@override
void runBuild() {
final created = build(itemType: _$args.itemType, settings: _$args.settings);
final ref = this.ref as $Ref<bool, bool>;
final element =
ref.element
@ -1331,17 +1349,20 @@ abstract class _$LibraryShowNumbersOfItemsState extends $Notifier<bool> {
Object?,
Object?
>;
element.handleValue(ref, created);
element.handleCreate(
ref,
() => build(itemType: _$args.itemType, settings: _$args.settings),
);
}
}
@ProviderFor(LibraryShowContinueReadingButtonState)
const libraryShowContinueReadingButtonStateProvider =
final libraryShowContinueReadingButtonStateProvider =
LibraryShowContinueReadingButtonStateFamily._();
final class LibraryShowContinueReadingButtonStateProvider
extends $NotifierProvider<LibraryShowContinueReadingButtonState, bool> {
const LibraryShowContinueReadingButtonStateProvider._({
LibraryShowContinueReadingButtonStateProvider._({
required LibraryShowContinueReadingButtonStateFamily super.from,
required ({ItemType itemType, Settings settings}) super.argument,
}) : super(
@ -1400,7 +1421,7 @@ final class LibraryShowContinueReadingButtonStateFamily extends $Family
bool,
({ItemType itemType, Settings settings})
> {
const LibraryShowContinueReadingButtonStateFamily._()
LibraryShowContinueReadingButtonStateFamily._()
: super(
retry: null,
name: r'libraryShowContinueReadingButtonStateProvider',
@ -1430,7 +1451,6 @@ abstract class _$LibraryShowContinueReadingButtonState extends $Notifier<bool> {
@$mustCallSuper
@override
void runBuild() {
final created = build(itemType: _$args.itemType, settings: _$args.settings);
final ref = this.ref as $Ref<bool, bool>;
final element =
ref.element
@ -1440,16 +1460,19 @@ abstract class _$LibraryShowContinueReadingButtonState extends $Notifier<bool> {
Object?,
Object?
>;
element.handleValue(ref, created);
element.handleCreate(
ref,
() => build(itemType: _$args.itemType, settings: _$args.settings),
);
}
}
@ProviderFor(SortLibraryMangaState)
const sortLibraryMangaStateProvider = SortLibraryMangaStateFamily._();
final sortLibraryMangaStateProvider = SortLibraryMangaStateFamily._();
final class SortLibraryMangaStateProvider
extends $NotifierProvider<SortLibraryMangaState, SortLibraryManga> {
const SortLibraryMangaStateProvider._({
SortLibraryMangaStateProvider._({
required SortLibraryMangaStateFamily super.from,
required ({ItemType itemType, Settings settings}) super.argument,
}) : super(
@ -1505,7 +1528,7 @@ final class SortLibraryMangaStateFamily extends $Family
SortLibraryManga,
({ItemType itemType, Settings settings})
> {
const SortLibraryMangaStateFamily._()
SortLibraryMangaStateFamily._()
: super(
retry: null,
name: r'sortLibraryMangaStateProvider',
@ -1538,7 +1561,6 @@ abstract class _$SortLibraryMangaState extends $Notifier<SortLibraryManga> {
@$mustCallSuper
@override
void runBuild() {
final created = build(itemType: _$args.itemType, settings: _$args.settings);
final ref = this.ref as $Ref<SortLibraryManga, SortLibraryManga>;
final element =
ref.element
@ -1548,16 +1570,19 @@ abstract class _$SortLibraryMangaState extends $Notifier<SortLibraryManga> {
Object?,
Object?
>;
element.handleValue(ref, created);
element.handleCreate(
ref,
() => build(itemType: _$args.itemType, settings: _$args.settings),
);
}
}
@ProviderFor(MangasListState)
const mangasListStateProvider = MangasListStateProvider._();
final mangasListStateProvider = MangasListStateProvider._();
final class MangasListStateProvider
extends $NotifierProvider<MangasListState, List<int>> {
const MangasListStateProvider._()
MangasListStateProvider._()
: super(
from: null,
argument: null,
@ -1591,7 +1616,6 @@ abstract class _$MangasListState extends $Notifier<List<int>> {
@$mustCallSuper
@override
void runBuild() {
final created = build();
final ref = this.ref as $Ref<List<int>, List<int>>;
final element =
ref.element
@ -1601,16 +1625,16 @@ abstract class _$MangasListState extends $Notifier<List<int>> {
Object?,
Object?
>;
element.handleValue(ref, created);
element.handleCreate(ref, build);
}
}
@ProviderFor(MangasSetIsReadState)
const mangasSetIsReadStateProvider = MangasSetIsReadStateFamily._();
final mangasSetIsReadStateProvider = MangasSetIsReadStateFamily._();
final class MangasSetIsReadStateProvider
extends $NotifierProvider<MangasSetIsReadState, void> {
const MangasSetIsReadStateProvider._({
MangasSetIsReadStateProvider._({
required MangasSetIsReadStateFamily super.from,
required ({List<int> mangaIds, bool markAsRead}) super.argument,
}) : super(
@ -1666,7 +1690,7 @@ final class MangasSetIsReadStateFamily extends $Family
void,
({List<int> mangaIds, bool markAsRead})
> {
const MangasSetIsReadStateFamily._()
MangasSetIsReadStateFamily._()
: super(
retry: null,
name: r'mangasSetIsReadStateProvider',
@ -1696,7 +1720,6 @@ abstract class _$MangasSetIsReadState extends $Notifier<void> {
@$mustCallSuper
@override
void runBuild() {
build(mangaIds: _$args.mangaIds, markAsRead: _$args.markAsRead);
final ref = this.ref as $Ref<void, void>;
final element =
ref.element
@ -1706,6 +1729,9 @@ abstract class _$MangasSetIsReadState extends $Notifier<void> {
Object?,
Object?
>;
element.handleValue(ref, null);
element.handleCreate(
ref,
() => build(mangaIds: _$args.mangaIds, markAsRead: _$args.markAsRead),
);
}
}

View file

@ -85,18 +85,14 @@ Future importArchivesFromFile(
: Uint8List.fromList(coverImage).getCoverImage,
);
}
for (var chapter in book.Chapters ?? []) {
chapters.add(
Chapter(
mangaId: mangaId,
name: chapter.Title is String && chapter.Title.isEmpty
? "Book"
: chapter.Title,
archivePath: file.path,
updatedAt: DateTime.now().millisecondsSinceEpoch,
)..manga.value = manga,
);
}
chapters.add(
Chapter(
mangaId: mangaId,
name: book.Title,
archivePath: file.path,
updatedAt: DateTime.now().millisecondsSinceEpoch,
)..manga.value = manga,
);
} else {
chapters.add(
Chapter(

View file

@ -10,12 +10,12 @@ part of 'local_archive.dart';
// ignore_for_file: type=lint, type=warning
@ProviderFor(importArchivesFromFile)
const importArchivesFromFileProvider = ImportArchivesFromFileFamily._();
final importArchivesFromFileProvider = ImportArchivesFromFileFamily._();
final class ImportArchivesFromFileProvider
extends $FunctionalProvider<AsyncValue<dynamic>, dynamic, FutureOr<dynamic>>
with $FutureModifier<dynamic>, $FutureProvider<dynamic> {
const ImportArchivesFromFileProvider._({
ImportArchivesFromFileProvider._({
required ImportArchivesFromFileFamily super.from,
required (Manga?, {ItemType itemType, bool init}) super.argument,
}) : super(
@ -65,7 +65,7 @@ final class ImportArchivesFromFileProvider
}
String _$importArchivesFromFileHash() =>
r'bfc12f37ab08a8f72a6fcff8d72afcff49ba5cc8';
r'8a26aaed0c29e76899ab37c6f64a1f8b80792e41';
final class ImportArchivesFromFileFamily extends $Family
with
@ -73,7 +73,7 @@ final class ImportArchivesFromFileFamily extends $Family
FutureOr<dynamic>,
(Manga?, {ItemType itemType, bool init})
> {
const ImportArchivesFromFileFamily._()
ImportArchivesFromFileFamily._()
: super(
retry: null,
name: r'importArchivesFromFileProvider',

View file

@ -10,12 +10,12 @@ part of 'migration.dart';
// ignore_for_file: type=lint, type=warning
@ProviderFor(migration)
const migrationProvider = MigrationProvider._();
final migrationProvider = MigrationProvider._();
final class MigrationProvider
extends $FunctionalProvider<AsyncValue<void>, void, FutureOr<void>>
with $FutureModifier<void>, $FutureProvider<void> {
const MigrationProvider._()
MigrationProvider._()
: super(
from: null,
argument: null,

View file

@ -10,7 +10,7 @@ part of 'archive_reader_providers.dart';
// ignore_for_file: type=lint, type=warning
@ProviderFor(getArchivesDataFromDirectory)
const getArchivesDataFromDirectoryProvider =
final getArchivesDataFromDirectoryProvider =
GetArchivesDataFromDirectoryFamily._();
final class GetArchivesDataFromDirectoryProvider
@ -23,7 +23,7 @@ final class GetArchivesDataFromDirectoryProvider
with
$FutureModifier<List<(String, LocalExtensionType, Uint8List, String)>>,
$FutureProvider<List<(String, LocalExtensionType, Uint8List, String)>> {
const GetArchivesDataFromDirectoryProvider._({
GetArchivesDataFromDirectoryProvider._({
required GetArchivesDataFromDirectoryFamily super.from,
required String super.argument,
}) : super(
@ -78,7 +78,7 @@ final class GetArchivesDataFromDirectoryFamily extends $Family
FutureOr<List<(String, LocalExtensionType, Uint8List, String)>>,
String
> {
const GetArchivesDataFromDirectoryFamily._()
GetArchivesDataFromDirectoryFamily._()
: super(
retry: null,
name: r'getArchivesDataFromDirectoryProvider',
@ -95,7 +95,7 @@ final class GetArchivesDataFromDirectoryFamily extends $Family
}
@ProviderFor(getArchiveDataFromDirectory)
const getArchiveDataFromDirectoryProvider =
final getArchiveDataFromDirectoryProvider =
GetArchiveDataFromDirectoryFamily._();
final class GetArchiveDataFromDirectoryProvider
@ -108,7 +108,7 @@ final class GetArchiveDataFromDirectoryProvider
with
$FutureModifier<List<LocalArchive>>,
$FutureProvider<List<LocalArchive>> {
const GetArchiveDataFromDirectoryProvider._({
GetArchiveDataFromDirectoryProvider._({
required GetArchiveDataFromDirectoryFamily super.from,
required String super.argument,
}) : super(
@ -158,7 +158,7 @@ String _$getArchiveDataFromDirectoryHash() =>
final class GetArchiveDataFromDirectoryFamily extends $Family
with $FunctionalFamilyOverride<FutureOr<List<LocalArchive>>, String> {
const GetArchiveDataFromDirectoryFamily._()
GetArchiveDataFromDirectoryFamily._()
: super(
retry: null,
name: r'getArchiveDataFromDirectoryProvider',
@ -175,7 +175,7 @@ final class GetArchiveDataFromDirectoryFamily extends $Family
}
@ProviderFor(getArchivesDataFromFile)
const getArchivesDataFromFileProvider = GetArchivesDataFromFileFamily._();
final getArchivesDataFromFileProvider = GetArchivesDataFromFileFamily._();
final class GetArchivesDataFromFileProvider
extends
@ -187,7 +187,7 @@ final class GetArchivesDataFromFileProvider
with
$FutureModifier<(String, LocalExtensionType, Uint8List, String)>,
$FutureProvider<(String, LocalExtensionType, Uint8List, String)> {
const GetArchivesDataFromFileProvider._({
GetArchivesDataFromFileProvider._({
required GetArchivesDataFromFileFamily super.from,
required String super.argument,
}) : super(
@ -240,7 +240,7 @@ final class GetArchivesDataFromFileFamily extends $Family
FutureOr<(String, LocalExtensionType, Uint8List, String)>,
String
> {
const GetArchivesDataFromFileFamily._()
GetArchivesDataFromFileFamily._()
: super(
retry: null,
name: r'getArchivesDataFromFileProvider',
@ -257,7 +257,7 @@ final class GetArchivesDataFromFileFamily extends $Family
}
@ProviderFor(getArchiveDataFromFile)
const getArchiveDataFromFileProvider = GetArchiveDataFromFileFamily._();
final getArchiveDataFromFileProvider = GetArchiveDataFromFileFamily._();
final class GetArchiveDataFromFileProvider
extends
@ -267,7 +267,7 @@ final class GetArchiveDataFromFileProvider
FutureOr<LocalArchive>
>
with $FutureModifier<LocalArchive>, $FutureProvider<LocalArchive> {
const GetArchiveDataFromFileProvider._({
GetArchiveDataFromFileProvider._({
required GetArchiveDataFromFileFamily super.from,
required String super.argument,
}) : super(
@ -317,7 +317,7 @@ String _$getArchiveDataFromFileHash() =>
final class GetArchiveDataFromFileFamily extends $Family
with $FunctionalFamilyOverride<FutureOr<LocalArchive>, String> {
const GetArchiveDataFromFileFamily._()
GetArchiveDataFromFileFamily._()
: super(
retry: null,
name: r'getArchiveDataFromFileProvider',

View file

@ -10,12 +10,12 @@ part of 'isar_providers.dart';
// ignore_for_file: type=lint, type=warning
@ProviderFor(getMangaDetailStream)
const getMangaDetailStreamProvider = GetMangaDetailStreamFamily._();
final getMangaDetailStreamProvider = GetMangaDetailStreamFamily._();
final class GetMangaDetailStreamProvider
extends $FunctionalProvider<AsyncValue<Manga?>, Manga?, Stream<Manga?>>
with $FutureModifier<Manga?>, $StreamProvider<Manga?> {
const GetMangaDetailStreamProvider._({
GetMangaDetailStreamProvider._({
required GetMangaDetailStreamFamily super.from,
required int super.argument,
}) : super(
@ -63,7 +63,7 @@ String _$getMangaDetailStreamHash() =>
final class GetMangaDetailStreamFamily extends $Family
with $FunctionalFamilyOverride<Stream<Manga?>, int> {
const GetMangaDetailStreamFamily._()
GetMangaDetailStreamFamily._()
: super(
retry: null,
name: r'getMangaDetailStreamProvider',
@ -80,7 +80,7 @@ final class GetMangaDetailStreamFamily extends $Family
}
@ProviderFor(getChaptersStream)
const getChaptersStreamProvider = GetChaptersStreamFamily._();
final getChaptersStreamProvider = GetChaptersStreamFamily._();
final class GetChaptersStreamProvider
extends
@ -90,7 +90,7 @@ final class GetChaptersStreamProvider
Stream<List<Chapter>>
>
with $FutureModifier<List<Chapter>>, $StreamProvider<List<Chapter>> {
const GetChaptersStreamProvider._({
GetChaptersStreamProvider._({
required GetChaptersStreamFamily super.from,
required int super.argument,
}) : super(
@ -138,7 +138,7 @@ String _$getChaptersStreamHash() => r'0f03db54c5a639c4356a81e4bad50fa8a077ceac';
final class GetChaptersStreamFamily extends $Family
with $FunctionalFamilyOverride<Stream<List<Chapter>>, int> {
const GetChaptersStreamFamily._()
GetChaptersStreamFamily._()
: super(
retry: null,
name: r'getChaptersStreamProvider',

View file

@ -10,11 +10,11 @@ part of 'state_providers.dart';
// ignore_for_file: type=lint, type=warning
@ProviderFor(ChaptersListState)
const chaptersListStateProvider = ChaptersListStateProvider._();
final chaptersListStateProvider = ChaptersListStateProvider._();
final class ChaptersListStateProvider
extends $NotifierProvider<ChaptersListState, List<Chapter>> {
const ChaptersListStateProvider._()
ChaptersListStateProvider._()
: super(
from: null,
argument: null,
@ -48,7 +48,6 @@ abstract class _$ChaptersListState extends $Notifier<List<Chapter>> {
@$mustCallSuper
@override
void runBuild() {
final created = build();
final ref = this.ref as $Ref<List<Chapter>, List<Chapter>>;
final element =
ref.element
@ -58,16 +57,16 @@ abstract class _$ChaptersListState extends $Notifier<List<Chapter>> {
Object?,
Object?
>;
element.handleValue(ref, created);
element.handleCreate(ref, build);
}
}
@ProviderFor(IsLongPressedState)
const isLongPressedStateProvider = IsLongPressedStateProvider._();
final isLongPressedStateProvider = IsLongPressedStateProvider._();
final class IsLongPressedStateProvider
extends $NotifierProvider<IsLongPressedState, bool> {
const IsLongPressedStateProvider._()
IsLongPressedStateProvider._()
: super(
from: null,
argument: null,
@ -102,7 +101,6 @@ abstract class _$IsLongPressedState extends $Notifier<bool> {
@$mustCallSuper
@override
void runBuild() {
final created = build();
final ref = this.ref as $Ref<bool, bool>;
final element =
ref.element
@ -112,16 +110,16 @@ abstract class _$IsLongPressedState extends $Notifier<bool> {
Object?,
Object?
>;
element.handleValue(ref, created);
element.handleCreate(ref, build);
}
}
@ProviderFor(IsExtendedState)
const isExtendedStateProvider = IsExtendedStateProvider._();
final isExtendedStateProvider = IsExtendedStateProvider._();
final class IsExtendedStateProvider
extends $NotifierProvider<IsExtendedState, bool> {
const IsExtendedStateProvider._()
IsExtendedStateProvider._()
: super(
from: null,
argument: null,
@ -155,7 +153,6 @@ abstract class _$IsExtendedState extends $Notifier<bool> {
@$mustCallSuper
@override
void runBuild() {
final created = build();
final ref = this.ref as $Ref<bool, bool>;
final element =
ref.element
@ -165,16 +162,16 @@ abstract class _$IsExtendedState extends $Notifier<bool> {
Object?,
Object?
>;
element.handleValue(ref, created);
element.handleCreate(ref, build);
}
}
@ProviderFor(SortChapterState)
const sortChapterStateProvider = SortChapterStateFamily._();
final sortChapterStateProvider = SortChapterStateFamily._();
final class SortChapterStateProvider
extends $NotifierProvider<SortChapterState, SortChapter> {
const SortChapterStateProvider._({
SortChapterStateProvider._({
required SortChapterStateFamily super.from,
required int super.argument,
}) : super(
@ -229,7 +226,7 @@ final class SortChapterStateFamily extends $Family
SortChapter,
int
> {
const SortChapterStateFamily._()
SortChapterStateFamily._()
: super(
retry: null,
name: r'sortChapterStateProvider',
@ -253,7 +250,6 @@ abstract class _$SortChapterState extends $Notifier<SortChapter> {
@$mustCallSuper
@override
void runBuild() {
final created = build(mangaId: _$args);
final ref = this.ref as $Ref<SortChapter, SortChapter>;
final element =
ref.element
@ -263,17 +259,17 @@ abstract class _$SortChapterState extends $Notifier<SortChapter> {
Object?,
Object?
>;
element.handleValue(ref, created);
element.handleCreate(ref, () => build(mangaId: _$args));
}
}
@ProviderFor(ChapterFilterDownloadedState)
const chapterFilterDownloadedStateProvider =
final chapterFilterDownloadedStateProvider =
ChapterFilterDownloadedStateFamily._();
final class ChapterFilterDownloadedStateProvider
extends $NotifierProvider<ChapterFilterDownloadedState, int> {
const ChapterFilterDownloadedStateProvider._({
ChapterFilterDownloadedStateProvider._({
required ChapterFilterDownloadedStateFamily super.from,
required int super.argument,
}) : super(
@ -324,7 +320,7 @@ String _$chapterFilterDownloadedStateHash() =>
final class ChapterFilterDownloadedStateFamily extends $Family
with
$ClassFamilyOverride<ChapterFilterDownloadedState, int, int, int, int> {
const ChapterFilterDownloadedStateFamily._()
ChapterFilterDownloadedStateFamily._()
: super(
retry: null,
name: r'chapterFilterDownloadedStateProvider',
@ -348,7 +344,6 @@ abstract class _$ChapterFilterDownloadedState extends $Notifier<int> {
@$mustCallSuper
@override
void runBuild() {
final created = build(mangaId: _$args);
final ref = this.ref as $Ref<int, int>;
final element =
ref.element
@ -358,16 +353,16 @@ abstract class _$ChapterFilterDownloadedState extends $Notifier<int> {
Object?,
Object?
>;
element.handleValue(ref, created);
element.handleCreate(ref, () => build(mangaId: _$args));
}
}
@ProviderFor(ChapterFilterUnreadState)
const chapterFilterUnreadStateProvider = ChapterFilterUnreadStateFamily._();
final chapterFilterUnreadStateProvider = ChapterFilterUnreadStateFamily._();
final class ChapterFilterUnreadStateProvider
extends $NotifierProvider<ChapterFilterUnreadState, int> {
const ChapterFilterUnreadStateProvider._({
ChapterFilterUnreadStateProvider._({
required ChapterFilterUnreadStateFamily super.from,
required int super.argument,
}) : super(
@ -417,7 +412,7 @@ String _$chapterFilterUnreadStateHash() =>
final class ChapterFilterUnreadStateFamily extends $Family
with $ClassFamilyOverride<ChapterFilterUnreadState, int, int, int, int> {
const ChapterFilterUnreadStateFamily._()
ChapterFilterUnreadStateFamily._()
: super(
retry: null,
name: r'chapterFilterUnreadStateProvider',
@ -441,7 +436,6 @@ abstract class _$ChapterFilterUnreadState extends $Notifier<int> {
@$mustCallSuper
@override
void runBuild() {
final created = build(mangaId: _$args);
final ref = this.ref as $Ref<int, int>;
final element =
ref.element
@ -451,17 +445,17 @@ abstract class _$ChapterFilterUnreadState extends $Notifier<int> {
Object?,
Object?
>;
element.handleValue(ref, created);
element.handleCreate(ref, () => build(mangaId: _$args));
}
}
@ProviderFor(ChapterFilterBookmarkedState)
const chapterFilterBookmarkedStateProvider =
final chapterFilterBookmarkedStateProvider =
ChapterFilterBookmarkedStateFamily._();
final class ChapterFilterBookmarkedStateProvider
extends $NotifierProvider<ChapterFilterBookmarkedState, int> {
const ChapterFilterBookmarkedStateProvider._({
ChapterFilterBookmarkedStateProvider._({
required ChapterFilterBookmarkedStateFamily super.from,
required int super.argument,
}) : super(
@ -512,7 +506,7 @@ String _$chapterFilterBookmarkedStateHash() =>
final class ChapterFilterBookmarkedStateFamily extends $Family
with
$ClassFamilyOverride<ChapterFilterBookmarkedState, int, int, int, int> {
const ChapterFilterBookmarkedStateFamily._()
ChapterFilterBookmarkedStateFamily._()
: super(
retry: null,
name: r'chapterFilterBookmarkedStateProvider',
@ -536,7 +530,6 @@ abstract class _$ChapterFilterBookmarkedState extends $Notifier<int> {
@$mustCallSuper
@override
void runBuild() {
final created = build(mangaId: _$args);
final ref = this.ref as $Ref<int, int>;
final element =
ref.element
@ -546,16 +539,16 @@ abstract class _$ChapterFilterBookmarkedState extends $Notifier<int> {
Object?,
Object?
>;
element.handleValue(ref, created);
element.handleCreate(ref, () => build(mangaId: _$args));
}
}
@ProviderFor(ChapterFilterResultState)
const chapterFilterResultStateProvider = ChapterFilterResultStateFamily._();
final chapterFilterResultStateProvider = ChapterFilterResultStateFamily._();
final class ChapterFilterResultStateProvider
extends $NotifierProvider<ChapterFilterResultState, bool> {
const ChapterFilterResultStateProvider._({
ChapterFilterResultStateProvider._({
required ChapterFilterResultStateFamily super.from,
required Manga super.argument,
}) : super(
@ -612,7 +605,7 @@ final class ChapterFilterResultStateFamily extends $Family
bool,
Manga
> {
const ChapterFilterResultStateFamily._()
ChapterFilterResultStateFamily._()
: super(
retry: null,
name: r'chapterFilterResultStateProvider',
@ -636,7 +629,6 @@ abstract class _$ChapterFilterResultState extends $Notifier<bool> {
@$mustCallSuper
@override
void runBuild() {
final created = build(manga: _$args);
final ref = this.ref as $Ref<bool, bool>;
final element =
ref.element
@ -646,16 +638,16 @@ abstract class _$ChapterFilterResultState extends $Notifier<bool> {
Object?,
Object?
>;
element.handleValue(ref, created);
element.handleCreate(ref, () => build(manga: _$args));
}
}
@ProviderFor(ChapterSetIsBookmarkState)
const chapterSetIsBookmarkStateProvider = ChapterSetIsBookmarkStateFamily._();
final chapterSetIsBookmarkStateProvider = ChapterSetIsBookmarkStateFamily._();
final class ChapterSetIsBookmarkStateProvider
extends $NotifierProvider<ChapterSetIsBookmarkState, void> {
const ChapterSetIsBookmarkStateProvider._({
ChapterSetIsBookmarkStateProvider._({
required ChapterSetIsBookmarkStateFamily super.from,
required Manga super.argument,
}) : super(
@ -712,7 +704,7 @@ final class ChapterSetIsBookmarkStateFamily extends $Family
void,
Manga
> {
const ChapterSetIsBookmarkStateFamily._()
ChapterSetIsBookmarkStateFamily._()
: super(
retry: null,
name: r'chapterSetIsBookmarkStateProvider',
@ -736,7 +728,6 @@ abstract class _$ChapterSetIsBookmarkState extends $Notifier<void> {
@$mustCallSuper
@override
void runBuild() {
build(manga: _$args);
final ref = this.ref as $Ref<void, void>;
final element =
ref.element
@ -746,16 +737,16 @@ abstract class _$ChapterSetIsBookmarkState extends $Notifier<void> {
Object?,
Object?
>;
element.handleValue(ref, null);
element.handleCreate(ref, () => build(manga: _$args));
}
}
@ProviderFor(ChapterSetIsReadState)
const chapterSetIsReadStateProvider = ChapterSetIsReadStateFamily._();
final chapterSetIsReadStateProvider = ChapterSetIsReadStateFamily._();
final class ChapterSetIsReadStateProvider
extends $NotifierProvider<ChapterSetIsReadState, void> {
const ChapterSetIsReadStateProvider._({
ChapterSetIsReadStateProvider._({
required ChapterSetIsReadStateFamily super.from,
required Manga super.argument,
}) : super(
@ -804,7 +795,7 @@ String _$chapterSetIsReadStateHash() =>
final class ChapterSetIsReadStateFamily extends $Family
with $ClassFamilyOverride<ChapterSetIsReadState, void, void, void, Manga> {
const ChapterSetIsReadStateFamily._()
ChapterSetIsReadStateFamily._()
: super(
retry: null,
name: r'chapterSetIsReadStateProvider',
@ -828,7 +819,6 @@ abstract class _$ChapterSetIsReadState extends $Notifier<void> {
@$mustCallSuper
@override
void runBuild() {
build(manga: _$args);
final ref = this.ref as $Ref<void, void>;
final element =
ref.element
@ -838,16 +828,16 @@ abstract class _$ChapterSetIsReadState extends $Notifier<void> {
Object?,
Object?
>;
element.handleValue(ref, null);
element.handleCreate(ref, () => build(manga: _$args));
}
}
@ProviderFor(ChapterSetDownloadState)
const chapterSetDownloadStateProvider = ChapterSetDownloadStateFamily._();
final chapterSetDownloadStateProvider = ChapterSetDownloadStateFamily._();
final class ChapterSetDownloadStateProvider
extends $NotifierProvider<ChapterSetDownloadState, void> {
const ChapterSetDownloadStateProvider._({
ChapterSetDownloadStateProvider._({
required ChapterSetDownloadStateFamily super.from,
required Manga super.argument,
}) : super(
@ -898,7 +888,7 @@ String _$chapterSetDownloadStateHash() =>
final class ChapterSetDownloadStateFamily extends $Family
with
$ClassFamilyOverride<ChapterSetDownloadState, void, void, void, Manga> {
const ChapterSetDownloadStateFamily._()
ChapterSetDownloadStateFamily._()
: super(
retry: null,
name: r'chapterSetDownloadStateProvider',
@ -922,7 +912,6 @@ abstract class _$ChapterSetDownloadState extends $Notifier<void> {
@$mustCallSuper
@override
void runBuild() {
build(manga: _$args);
final ref = this.ref as $Ref<void, void>;
final element =
ref.element
@ -932,16 +921,16 @@ abstract class _$ChapterSetDownloadState extends $Notifier<void> {
Object?,
Object?
>;
element.handleValue(ref, null);
element.handleCreate(ref, () => build(manga: _$args));
}
}
@ProviderFor(ChaptersListttState)
const chaptersListttStateProvider = ChaptersListttStateProvider._();
final chaptersListttStateProvider = ChaptersListttStateProvider._();
final class ChaptersListttStateProvider
extends $NotifierProvider<ChaptersListttState, List<Chapter>> {
const ChaptersListttStateProvider._()
ChaptersListttStateProvider._()
: super(
from: null,
argument: null,
@ -976,7 +965,6 @@ abstract class _$ChaptersListttState extends $Notifier<List<Chapter>> {
@$mustCallSuper
@override
void runBuild() {
final created = build();
final ref = this.ref as $Ref<List<Chapter>, List<Chapter>>;
final element =
ref.element
@ -986,12 +974,12 @@ abstract class _$ChaptersListttState extends $Notifier<List<Chapter>> {
Object?,
Object?
>;
element.handleValue(ref, created);
element.handleCreate(ref, build);
}
}
@ProviderFor(ScanlatorsFilterState)
const scanlatorsFilterStateProvider = ScanlatorsFilterStateFamily._();
final scanlatorsFilterStateProvider = ScanlatorsFilterStateFamily._();
final class ScanlatorsFilterStateProvider
extends
@ -999,7 +987,7 @@ final class ScanlatorsFilterStateProvider
ScanlatorsFilterState,
(List<String>, List<String>, List<String>)
> {
const ScanlatorsFilterStateProvider._({
ScanlatorsFilterStateProvider._({
required ScanlatorsFilterStateFamily super.from,
required Manga super.argument,
}) : super(
@ -1056,7 +1044,7 @@ final class ScanlatorsFilterStateFamily extends $Family
(List<String>, List<String>, List<String>),
Manga
> {
const ScanlatorsFilterStateFamily._()
ScanlatorsFilterStateFamily._()
: super(
retry: null,
name: r'scanlatorsFilterStateProvider',
@ -1081,7 +1069,6 @@ abstract class _$ScanlatorsFilterState
@$mustCallSuper
@override
void runBuild() {
final created = build(_$args);
final ref =
this.ref
as $Ref<
@ -1099,6 +1086,6 @@ abstract class _$ScanlatorsFilterState
Object?,
Object?
>;
element.handleValue(ref, created);
element.handleCreate(ref, () => build(_$args));
}
}

View file

@ -10,10 +10,10 @@ part of 'track_state_providers.dart';
// ignore_for_file: type=lint, type=warning
@ProviderFor(TrackState)
const trackStateProvider = TrackStateFamily._();
final trackStateProvider = TrackStateFamily._();
final class TrackStateProvider extends $NotifierProvider<TrackState, Track> {
const TrackStateProvider._({
TrackStateProvider._({
required TrackStateFamily super.from,
required ({Track? track, ItemType? itemType, dynamic widgetRef})
super.argument,
@ -69,7 +69,7 @@ final class TrackStateFamily extends $Family
Track,
({Track? track, ItemType? itemType, dynamic widgetRef})
> {
const TrackStateFamily._()
TrackStateFamily._()
: super(
retry: null,
name: r'trackStateProvider',
@ -106,11 +106,6 @@ abstract class _$TrackState extends $Notifier<Track> {
@$mustCallSuper
@override
void runBuild() {
final created = build(
track: _$args.track,
itemType: _$args.itemType,
widgetRef: _$args.widgetRef,
);
final ref = this.ref as $Ref<Track, Track>;
final element =
ref.element
@ -120,17 +115,24 @@ abstract class _$TrackState extends $Notifier<Track> {
Object?,
Object?
>;
element.handleValue(ref, created);
element.handleCreate(
ref,
() => build(
track: _$args.track,
itemType: _$args.itemType,
widgetRef: _$args.widgetRef,
),
);
}
}
@ProviderFor(LastTrackerLibraryLocationState)
const lastTrackerLibraryLocationStateProvider =
final lastTrackerLibraryLocationStateProvider =
LastTrackerLibraryLocationStateProvider._();
final class LastTrackerLibraryLocationStateProvider
extends $NotifierProvider<LastTrackerLibraryLocationState, (int, bool)> {
const LastTrackerLibraryLocationStateProvider._()
LastTrackerLibraryLocationStateProvider._()
: super(
from: null,
argument: null,
@ -166,7 +168,6 @@ abstract class _$LastTrackerLibraryLocationState
@$mustCallSuper
@override
void runBuild() {
final created = build();
final ref = this.ref as $Ref<(int, bool), (int, bool)>;
final element =
ref.element
@ -176,6 +177,6 @@ abstract class _$LastTrackerLibraryLocationState
Object?,
Object?
>;
element.handleValue(ref, created);
element.handleCreate(ref, build);
}
}

View file

@ -10,12 +10,12 @@ part of 'update_manga_detail_providers.dart';
// ignore_for_file: type=lint, type=warning
@ProviderFor(updateMangaDetail)
const updateMangaDetailProvider = UpdateMangaDetailFamily._();
final updateMangaDetailProvider = UpdateMangaDetailFamily._();
final class UpdateMangaDetailProvider
extends $FunctionalProvider<AsyncValue<dynamic>, dynamic, FutureOr<dynamic>>
with $FutureModifier<dynamic>, $FutureProvider<dynamic> {
const UpdateMangaDetailProvider._({
UpdateMangaDetailProvider._({
required UpdateMangaDetailFamily super.from,
required ({int? mangaId, bool isInit, bool showToast}) super.argument,
}) : super(
@ -72,7 +72,7 @@ final class UpdateMangaDetailFamily extends $Family
FutureOr<dynamic>,
({int? mangaId, bool isInit, bool showToast})
> {
const UpdateMangaDetailFamily._()
UpdateMangaDetailFamily._()
: super(
retry: null,
name: r'updateMangaDetailProvider',

View file

@ -10,7 +10,7 @@ part of 'convert_to_cbz.dart';
// ignore_for_file: type=lint, type=warning
@ProviderFor(convertToCBZ)
const convertToCBZProvider = ConvertToCBZFamily._();
final convertToCBZProvider = ConvertToCBZFamily._();
final class ConvertToCBZProvider
extends
@ -20,7 +20,7 @@ final class ConvertToCBZProvider
FutureOr<List<String>>
>
with $FutureModifier<List<String>>, $FutureProvider<List<String>> {
const ConvertToCBZProvider._({
ConvertToCBZProvider._({
required ConvertToCBZFamily super.from,
required (String, String, String, List<String>) super.argument,
}) : super(
@ -78,7 +78,7 @@ final class ConvertToCBZFamily extends $Family
FutureOr<List<String>>,
(String, String, String, List<String>)
> {
const ConvertToCBZFamily._()
ConvertToCBZFamily._()
: super(
retry: null,
name: r'convertToCBZProvider',

View file

@ -309,7 +309,7 @@ Future<void> downloadChapter(
if (!file.existsSync()) {
pages.add(
PageUrl(
page.url.trim().trimLeft().trimRight(),
page.url.trim(),
headers: pageHeaders,
fileName: p.join(
chapterDirectory.path,
@ -325,7 +325,7 @@ Future<void> downloadChapter(
if (!file.existsSync()) {
pages.add(
PageUrl(
page.url.trim().trimLeft().trimRight(),
page.url.trim(),
headers: pageHeaders,
fileName: p.join(mangaMainDirectory.path, "$chapterName.mp4"),
),
@ -406,6 +406,7 @@ Future<void> processDownloads(Ref ref, {bool? useWifi}) async {
final downloadItem = ongoingDownloads[index++];
final chapter = downloadItem.chapter.value!;
chapter.cancelDownloads(downloadItem.id);
await Future.delayed(const Duration(milliseconds: 500));
ref.read(
downloadChapterProvider(
chapter: chapter,

View file

@ -10,12 +10,12 @@ part of 'download_provider.dart';
// ignore_for_file: type=lint, type=warning
@ProviderFor(addDownloadToQueue)
const addDownloadToQueueProvider = AddDownloadToQueueFamily._();
final addDownloadToQueueProvider = AddDownloadToQueueFamily._();
final class AddDownloadToQueueProvider
extends $FunctionalProvider<AsyncValue<void>, void, FutureOr<void>>
with $FutureModifier<void>, $FutureProvider<void> {
const AddDownloadToQueueProvider._({
AddDownloadToQueueProvider._({
required AddDownloadToQueueFamily super.from,
required Chapter super.argument,
}) : super(
@ -63,7 +63,7 @@ String _$addDownloadToQueueHash() =>
final class AddDownloadToQueueFamily extends $Family
with $FunctionalFamilyOverride<FutureOr<void>, Chapter> {
const AddDownloadToQueueFamily._()
AddDownloadToQueueFamily._()
: super(
retry: null,
name: r'addDownloadToQueueProvider',
@ -80,12 +80,12 @@ final class AddDownloadToQueueFamily extends $Family
}
@ProviderFor(downloadChapter)
const downloadChapterProvider = DownloadChapterFamily._();
final downloadChapterProvider = DownloadChapterFamily._();
final class DownloadChapterProvider
extends $FunctionalProvider<AsyncValue<void>, void, FutureOr<void>>
with $FutureModifier<void>, $FutureProvider<void> {
const DownloadChapterProvider._({
DownloadChapterProvider._({
required DownloadChapterFamily super.from,
required ({Chapter chapter, bool? useWifi, VoidCallback? callback})
super.argument,
@ -136,7 +136,7 @@ final class DownloadChapterProvider
}
}
String _$downloadChapterHash() => r'b64c5de46eafb0e7322eb599e49de3b09f027c04';
String _$downloadChapterHash() => r'c503cef46aa7083316b023400f0aa470ae3a3bc4';
final class DownloadChapterFamily extends $Family
with
@ -144,7 +144,7 @@ final class DownloadChapterFamily extends $Family
FutureOr<void>,
({Chapter chapter, bool? useWifi, VoidCallback? callback})
> {
const DownloadChapterFamily._()
DownloadChapterFamily._()
: super(
retry: null,
name: r'downloadChapterProvider',
@ -167,12 +167,12 @@ final class DownloadChapterFamily extends $Family
}
@ProviderFor(processDownloads)
const processDownloadsProvider = ProcessDownloadsFamily._();
final processDownloadsProvider = ProcessDownloadsFamily._();
final class ProcessDownloadsProvider
extends $FunctionalProvider<AsyncValue<void>, void, FutureOr<void>>
with $FutureModifier<void>, $FutureProvider<void> {
const ProcessDownloadsProvider._({
ProcessDownloadsProvider._({
required ProcessDownloadsFamily super.from,
required bool? super.argument,
}) : super(
@ -215,11 +215,11 @@ final class ProcessDownloadsProvider
}
}
String _$processDownloadsHash() => r'caebad3bb681d7b38de4d09325310fc08bc1cd0a';
String _$processDownloadsHash() => r'36903a1ca0140ef7d55aa68ee34d8c74573e8e71';
final class ProcessDownloadsFamily extends $Family
with $FunctionalFamilyOverride<FutureOr<void>, bool?> {
const ProcessDownloadsFamily._()
ProcessDownloadsFamily._()
: super(
retry: null,
name: r'processDownloadsProvider',

View file

@ -25,6 +25,7 @@ import 'package:mangayomi/modules/manga/home/widget/mangas_card_selector.dart';
import 'package:mangayomi/modules/widgets/gridview_widget.dart';
import 'package:mangayomi/modules/widgets/manga_image_card_widget.dart';
import 'package:mangayomi/utils/global_style.dart';
import 'package:mangayomi/utils/item_type_localization.dart';
import 'package:marquee/marquee.dart';
import 'package:super_sliver_list/super_sliver_list.dart';
@ -167,11 +168,7 @@ class _MangaHomeScreenState extends ConsumerState<MangaHomeScreen> {
Text(
!isLocal
? "${source.name}"
: "${context.l10n.local_source} ${source.itemType == ItemType.manga
? context.l10n.manga
: source.itemType == ItemType.anime
? context.l10n.anime
: context.l10n.novel}",
: "${context.l10n.local_source} ${source.itemType.localized(context.l10n)}",
),
source.notes != null && source.notes!.isNotEmpty
? SizedBox(

View file

@ -10,11 +10,11 @@ part of 'state_provider.dart';
// ignore_for_file: type=lint, type=warning
@ProviderFor(MangaHomeDisplayTypeState)
const mangaHomeDisplayTypeStateProvider = MangaHomeDisplayTypeStateProvider._();
final mangaHomeDisplayTypeStateProvider = MangaHomeDisplayTypeStateProvider._();
final class MangaHomeDisplayTypeStateProvider
extends $NotifierProvider<MangaHomeDisplayTypeState, DisplayType> {
const MangaHomeDisplayTypeStateProvider._()
MangaHomeDisplayTypeStateProvider._()
: super(
from: null,
argument: null,
@ -49,7 +49,6 @@ abstract class _$MangaHomeDisplayTypeState extends $Notifier<DisplayType> {
@$mustCallSuper
@override
void runBuild() {
final created = build();
final ref = this.ref as $Ref<DisplayType, DisplayType>;
final element =
ref.element
@ -59,6 +58,6 @@ abstract class _$MangaHomeDisplayTypeState extends $Notifier<DisplayType> {
Object?,
Object?
>;
element.handleValue(ref, created);
element.handleCreate(ref, build);
}
}

View file

@ -7,16 +7,6 @@ import 'package:mangayomi/services/get_chapter_pages.dart';
/// Manages the preloading and memory of chapters in the manga reader.
class ChapterPreloadManager {
/// Maximum number of chapters to keep in memory
static const int maxChaptersInMemory = 3;
/// Maximum number of pages to keep in the preload list
static const int maxPagesInMemory = 200;
/// Buffer size around current index to keep
static const int pageBufferBefore = 30;
static const int pageBufferAfter = 70;
/// The list of preloaded chapter data
final List<UChapDataPreload> _pages = [];
@ -34,7 +24,6 @@ class ChapterPreloadManager {
/// Callbacks
void Function()? onPagesUpdated;
void Function(int)? onIndexAdjusted;
/// Gets the list of pages (read-only)
List<UChapDataPreload> get pages => List.unmodifiable(_pages);
@ -161,9 +150,6 @@ class ChapterPreloadManager {
_chapterLoadOrder.add(chapterId);
}
// Evict old chapters if necessary
await _evictOldChaptersIfNeeded();
// Notify listeners
onPagesUpdated?.call();
@ -206,133 +192,11 @@ class ChapterPreloadManager {
return true;
}
/// Evicts old chapters to stay within memory limits.
Future<void> _evictOldChaptersIfNeeded() async {
// Evict by chapter count
while (_loadedChapterIds.length > maxChaptersInMemory &&
_chapterLoadOrder.isNotEmpty) {
final oldestChapterId = _chapterLoadOrder.first;
// Don't evict if current page is in this chapter
final currentPage = _currentIndex < _pages.length
? _pages[_currentIndex]
: null;
final currentChapterId = currentPage != null
? _getChapterIdentifier(currentPage.chapter)
: null;
if (oldestChapterId == currentChapterId) {
// Can't evict current chapter, try next
if (_chapterLoadOrder.length > 1) {
_chapterLoadOrder.removeFirst();
_chapterLoadOrder.add(oldestChapterId);
continue;
}
break;
}
await _evictChapter(oldestChapterId);
}
// Evict by page count if still too many
if (_pages.length > maxPagesInMemory) {
await _trimPagesToBuffer();
}
}
/// Evicts a specific chapter from memory.
Future<void> _evictChapter(String chapterId) async {
final pagesToRemove = <int>[];
final keysToRemoveFromCache = <String>[];
for (var i = 0; i < _pages.length; i++) {
final page = _pages[i];
if (_getChapterIdentifier(page.chapter) == chapterId) {
pagesToRemove.add(i);
// Clear the cropImage to free memory
page.cropImage = null;
// Build cache key for image cache removal
if (page.pageUrl?.url != null) {
keysToRemoveFromCache.add(page.pageUrl!.url);
}
}
}
// Remove pages from the end to avoid index shifting issues
for (var i = pagesToRemove.length - 1; i >= 0; i--) {
final index = pagesToRemove[i];
_pages.removeAt(index);
// Adjust current index if needed
if (_currentIndex > index) {
_currentIndex--;
}
}
// Remove from tracking
_loadedChapterIds.remove(chapterId);
_chapterLoadOrder.remove(chapterId);
// Notify about index adjustment
onIndexAdjusted?.call(_currentIndex);
if (kDebugMode) {
debugPrint(
'[ChapterPreload] Evicted chapter: $chapterId, '
'Removed ${pagesToRemove.length} pages',
);
}
}
/// Trims pages to keep only those within the buffer range.
Future<void> _trimPagesToBuffer() async {
if (_pages.length <= maxPagesInMemory) return;
final startKeep = (_currentIndex - pageBufferBefore).clamp(
0,
_pages.length,
);
final endKeep = (_currentIndex + pageBufferAfter).clamp(0, _pages.length);
final pagesToRemoveFromStart = startKeep;
final pagesToRemoveFromEnd = _pages.length - endKeep;
// Remove from end first
if (pagesToRemoveFromEnd > 0) {
final keysToRemove = <String>[];
for (var i = _pages.length - 1; i >= endKeep; i--) {
final page = _pages[i];
page.cropImage = null;
if (page.pageUrl?.url != null) {
keysToRemove.add(page.pageUrl!.url);
}
}
_pages.removeRange(endKeep, _pages.length);
}
// Remove from start
if (pagesToRemoveFromStart > 0) {
final keysToRemove = <String>[];
for (var i = 0; i < pagesToRemoveFromStart; i++) {
final page = _pages[i];
page.cropImage = null;
if (page.pageUrl?.url != null) {
keysToRemove.add(page.pageUrl!.url);
}
}
_pages.removeRange(0, pagesToRemoveFromStart);
_currentIndex -= pagesToRemoveFromStart;
onIndexAdjusted?.call(_currentIndex);
}
if (kDebugMode) {
debugPrint(
'[ChapterPreload] Trimmed pages, '
'New count: ${_pages.length}, Index: $_currentIndex',
);
/// Updates the cropImage for a page at the given index.
void updatePageCropImage(int index, Uint8List? cropImage) {
if (index >= 0 && index < _pages.length) {
_pages[index].cropImage = cropImage;
onPagesUpdated?.call();
}
}
@ -358,7 +222,6 @@ class ChapterPreloadManager {
// Clear callbacks
onPagesUpdated = null;
onIndexAdjusted = null;
if (kDebugMode) {
debugPrint('[ChapterPreload] Disposed');

View file

@ -38,7 +38,6 @@ mixin ReaderMemoryManagement {
GetChapterPagesModel chapterData, {
int startIndex = 0,
VoidCallback? onPagesUpdated,
void Function(int)? onIndexAdjusted,
}) {
if (_isPreloadManagerInitialized) {
if (kDebugMode) {
@ -48,7 +47,6 @@ mixin ReaderMemoryManagement {
}
_preloadManager.onPagesUpdated = onPagesUpdated;
_preloadManager.onIndexAdjusted = onIndexAdjusted;
_preloadManager.initialize(chapterData.uChapDataPreload, startIndex);
@ -88,6 +86,11 @@ mixin ReaderMemoryManagement {
return _preloadManager.addLastChapterTransition(chapter);
}
/// Updates the cropImage for a page at the given index.
void updatePageCropImage(int index, Uint8List? cropImage) {
_preloadManager.updatePageCropImage(index, cropImage);
}
/// Disposes the preload manager and clears all cached data.
Future<void> disposePreloadManager() async {
if (!_isPreloadManagerInitialized) return;

View file

@ -10,11 +10,11 @@ part of 'color_filter_provider.dart';
// ignore_for_file: type=lint, type=warning
@ProviderFor(CustomColorFilterState)
const customColorFilterStateProvider = CustomColorFilterStateProvider._();
final customColorFilterStateProvider = CustomColorFilterStateProvider._();
final class CustomColorFilterStateProvider
extends $NotifierProvider<CustomColorFilterState, CustomColorFilter?> {
const CustomColorFilterStateProvider._()
CustomColorFilterStateProvider._()
: super(
from: null,
argument: null,
@ -49,7 +49,6 @@ abstract class _$CustomColorFilterState extends $Notifier<CustomColorFilter?> {
@$mustCallSuper
@override
void runBuild() {
final created = build();
final ref = this.ref as $Ref<CustomColorFilter?, CustomColorFilter?>;
final element =
ref.element
@ -59,17 +58,17 @@ abstract class _$CustomColorFilterState extends $Notifier<CustomColorFilter?> {
Object?,
Object?
>;
element.handleValue(ref, created);
element.handleCreate(ref, build);
}
}
@ProviderFor(EnableCustomColorFilterState)
const enableCustomColorFilterStateProvider =
final enableCustomColorFilterStateProvider =
EnableCustomColorFilterStateProvider._();
final class EnableCustomColorFilterStateProvider
extends $NotifierProvider<EnableCustomColorFilterState, bool> {
const EnableCustomColorFilterStateProvider._()
EnableCustomColorFilterStateProvider._()
: super(
from: null,
argument: null,
@ -104,7 +103,6 @@ abstract class _$EnableCustomColorFilterState extends $Notifier<bool> {
@$mustCallSuper
@override
void runBuild() {
final created = build();
final ref = this.ref as $Ref<bool, bool>;
final element =
ref.element
@ -114,16 +112,16 @@ abstract class _$EnableCustomColorFilterState extends $Notifier<bool> {
Object?,
Object?
>;
element.handleValue(ref, created);
element.handleCreate(ref, build);
}
}
@ProviderFor(ColorFilterBlendModeState)
const colorFilterBlendModeStateProvider = ColorFilterBlendModeStateProvider._();
final colorFilterBlendModeStateProvider = ColorFilterBlendModeStateProvider._();
final class ColorFilterBlendModeStateProvider
extends $NotifierProvider<ColorFilterBlendModeState, ColorFilterBlendMode> {
const ColorFilterBlendModeStateProvider._()
ColorFilterBlendModeStateProvider._()
: super(
from: null,
argument: null,
@ -159,7 +157,6 @@ abstract class _$ColorFilterBlendModeState
@$mustCallSuper
@override
void runBuild() {
final created = build();
final ref = this.ref as $Ref<ColorFilterBlendMode, ColorFilterBlendMode>;
final element =
ref.element
@ -169,6 +166,6 @@ abstract class _$ColorFilterBlendModeState
Object?,
Object?
>;
element.handleValue(ref, created);
element.handleCreate(ref, build);
}
}

View file

@ -10,7 +10,7 @@ part of 'crop_borders_provider.dart';
// ignore_for_file: type=lint, type=warning
@ProviderFor(cropBorders)
const cropBordersProvider = CropBordersFamily._();
final cropBordersProvider = CropBordersFamily._();
final class CropBordersProvider
extends
@ -20,7 +20,7 @@ final class CropBordersProvider
FutureOr<Uint8List?>
>
with $FutureModifier<Uint8List?>, $FutureProvider<Uint8List?> {
const CropBordersProvider._({
CropBordersProvider._({
required CropBordersFamily super.from,
required ({UChapDataPreload data, bool cropBorder}) super.argument,
}) : super(
@ -76,7 +76,7 @@ final class CropBordersFamily extends $Family
FutureOr<Uint8List?>,
({UChapDataPreload data, bool cropBorder})
> {
const CropBordersFamily._()
CropBordersFamily._()
: super(
retry: null,
name: r'cropBordersProvider',

View file

@ -10,7 +10,7 @@ part of 'manga_reader_provider.dart';
// ignore_for_file: type=lint, type=warning
@ProviderFor(mangaReader)
const mangaReaderProvider = MangaReaderFamily._();
final mangaReaderProvider = MangaReaderFamily._();
final class MangaReaderProvider
extends
@ -20,7 +20,7 @@ final class MangaReaderProvider
FutureOr<ChapterWithPages>
>
with $FutureModifier<ChapterWithPages>, $FutureProvider<ChapterWithPages> {
const MangaReaderProvider._({
MangaReaderProvider._({
required MangaReaderFamily super.from,
required int super.argument,
}) : super(
@ -68,7 +68,7 @@ String _$mangaReaderHash() => r'cf8c44c6c3567ba4e9a0e08137ab2f29b71307eb';
final class MangaReaderFamily extends $Family
with $FunctionalFamilyOverride<FutureOr<ChapterWithPages>, int> {
const MangaReaderFamily._()
MangaReaderFamily._()
: super(
retry: null,
name: r'mangaReaderProvider',

View file

@ -10,10 +10,10 @@ part of 'reader_controller_provider.dart';
// ignore_for_file: type=lint, type=warning
@ProviderFor(CurrentIndex)
const currentIndexProvider = CurrentIndexFamily._();
final currentIndexProvider = CurrentIndexFamily._();
final class CurrentIndexProvider extends $NotifierProvider<CurrentIndex, int> {
const CurrentIndexProvider._({
CurrentIndexProvider._({
required CurrentIndexFamily super.from,
required Chapter super.argument,
}) : super(
@ -61,7 +61,7 @@ String _$currentIndexHash() => r'e0b5e5b8a2afa5e8df699784009720334e1c9e80';
final class CurrentIndexFamily extends $Family
with $ClassFamilyOverride<CurrentIndex, int, int, int, Chapter> {
const CurrentIndexFamily._()
CurrentIndexFamily._()
: super(
retry: null,
name: r'currentIndexProvider',
@ -85,7 +85,6 @@ abstract class _$CurrentIndex extends $Notifier<int> {
@$mustCallSuper
@override
void runBuild() {
final created = build(_$args);
final ref = this.ref as $Ref<int, int>;
final element =
ref.element
@ -95,16 +94,16 @@ abstract class _$CurrentIndex extends $Notifier<int> {
Object?,
Object?
>;
element.handleValue(ref, created);
element.handleCreate(ref, () => build(_$args));
}
}
@ProviderFor(ReaderController)
const readerControllerProvider = ReaderControllerFamily._();
final readerControllerProvider = ReaderControllerFamily._();
final class ReaderControllerProvider
extends $NotifierProvider<ReaderController, KeepAliveLink> {
const ReaderControllerProvider._({
ReaderControllerProvider._({
required ReaderControllerFamily super.from,
required Chapter super.argument,
}) : super(
@ -159,7 +158,7 @@ final class ReaderControllerFamily extends $Family
KeepAliveLink,
Chapter
> {
const ReaderControllerFamily._()
ReaderControllerFamily._()
: super(
retry: null,
name: r'readerControllerProvider',
@ -183,7 +182,6 @@ abstract class _$ReaderController extends $Notifier<KeepAliveLink> {
@$mustCallSuper
@override
void runBuild() {
final created = build(chapter: _$args);
final ref = this.ref as $Ref<KeepAliveLink, KeepAliveLink>;
final element =
ref.element
@ -193,6 +191,6 @@ abstract class _$ReaderController extends $Notifier<KeepAliveLink> {
Object?,
Object?
>;
element.handleValue(ref, created);
element.handleCreate(ref, () => build(chapter: _$args));
}
}

View file

@ -904,13 +904,6 @@ class _MangaChapterPageGalleryState
? (pages.length / 2).ceil() + 1
: pages.length;
if (_currentIndex! >= 0 && _currentIndex! < pagesLength) {
try {
final idx = pages[_currentIndex!].index;
if (idx != null) {
_readerController.setPageIndex(_geCurrentIndex(idx), false);
}
} catch (_) {}
if (_readerController.chapter.id != pages[_currentIndex!].chapter!.id) {
if (mounted) {
setState(() {
@ -937,6 +930,12 @@ class _MangaChapterPageGalleryState
try {
_isNextChapterPreloading = true;
if (!mounted) return;
try {
final idx = pages[_currentIndex!].index;
if (idx != null) {
_readerController.setPageIndex(_geCurrentIndex(idx), false);
}
} catch (_) {}
final value = await ref.read(
getChapterPagesProvider(
chapter: _readerController.getNextChapter(),
@ -1000,13 +999,6 @@ class _MangaChapterPageGalleryState
onPagesUpdated: () {
if (mounted) setState(() {});
},
onIndexAdjusted: (newIndex) {
if (mounted) {
setState(() {
_currentIndex = newIndex;
});
}
},
);
_readerController.setMangaHistoryUpdate();
@ -1215,9 +1207,7 @@ class _MangaChapterPageGalleryState
cropBordersProvider(data: pages[index], cropBorder: true).future,
);
if (mounted) {
setState(() {
pages[index] = pages[index]..cropImage = value;
});
updatePageCropImage(index, value);
}
}
}
@ -1233,9 +1223,7 @@ class _MangaChapterPageGalleryState
cropBordersProvider(data: pages[i], cropBorder: true).future,
);
if (mounted) {
setState(() {
pages[i] = pages[i]..cropImage = value;
});
updatePageCropImage(i, value);
}
}
}

View file

@ -9,9 +9,11 @@ import 'package:mangayomi/main.dart';
import 'package:mangayomi/models/settings.dart';
import 'package:mangayomi/modules/more/about/providers/check_for_update.dart';
import 'package:mangayomi/modules/more/about/providers/get_package_info.dart';
import 'package:mangayomi/modules/more/about/providers/logs_state.dart';
import 'package:mangayomi/modules/widgets/progress_center.dart';
import 'package:mangayomi/providers/l10n_providers.dart';
import 'package:mangayomi/providers/storage_provider.dart';
import 'package:mangayomi/utils/log/logger.dart';
import 'package:path/path.dart' as path;
import 'package:share_plus/share_plus.dart';
import 'package:url_launcher/url_launcher.dart';
@ -23,6 +25,7 @@ class AboutScreen extends ConsumerWidget {
Widget build(BuildContext context, WidgetRef ref) {
final l10n = l10nLocalizations(context);
final checkForUpdates = ref.watch(checkForAppUpdatesProvider);
final enableLogs = ref.watch(logsStateProvider);
return Scaffold(
appBar: AppBar(title: Text(l10n!.about)),
body: ref
@ -80,38 +83,58 @@ class AboutScreen extends ConsumerWidget {
},
title: Text(l10n.check_for_update),
),
ListTile(
onTap: () async {
final storage = StorageProvider();
final directory = await storage.getDefaultDirectory();
final file = File(
path.join(directory!.path, 'logs.txt'),
);
if (await file.exists()) {
if (Platform.isLinux) {
await Clipboard.setData(
ClipboardData(text: file.path),
);
}
if (context.mounted) {
final box =
context.findRenderObject() as RenderBox?;
SharePlus.instance.share(
ShareParams(
files: [XFile(file.path)],
text: "log.txt",
sharePositionOrigin:
box!.localToGlobal(Offset.zero) &
box.size,
),
);
}
SwitchListTile(
title: Text(l10n.logs_on),
value: enableLogs,
onChanged: (value) {
isar.writeTxnSync(() {
final settings = isar.settings.getSync(227);
isar.settings.putSync(
settings!..enableLogs = value,
);
});
ref.invalidate(logsStateProvider);
if (value) {
AppLogger.init();
} else {
botToast(l10n.no_app_logs);
AppLogger.dispose();
}
},
title: Text(l10n.share_app_logs),
),
if (enableLogs)
ListTile(
onTap: () async {
final storage = StorageProvider();
final directory = await storage
.getDefaultDirectory();
final file = File(
path.join(directory!.path, 'logs.txt'),
);
if (await file.exists()) {
if (Platform.isLinux) {
await Clipboard.setData(
ClipboardData(text: file.path),
);
}
if (context.mounted) {
final box =
context.findRenderObject() as RenderBox?;
SharePlus.instance.share(
ShareParams(
files: [XFile(file.path)],
text: "log.txt",
sharePositionOrigin:
box!.localToGlobal(Offset.zero) &
box.size,
),
);
}
} else {
botToast(l10n.no_app_logs);
}
},
title: Text(l10n.share_app_logs),
),
// ListTile(
// onTap: () {},
// title: const Text("What's news"),

View file

@ -10,12 +10,12 @@ part of 'check_for_update.dart';
// ignore_for_file: type=lint, type=warning
@ProviderFor(checkForUpdate)
const checkForUpdateProvider = CheckForUpdateFamily._();
final checkForUpdateProvider = CheckForUpdateFamily._();
final class CheckForUpdateProvider
extends $FunctionalProvider<AsyncValue<void>, void, FutureOr<void>>
with $FutureModifier<void>, $FutureProvider<void> {
const CheckForUpdateProvider._({
CheckForUpdateProvider._({
required CheckForUpdateFamily super.from,
required ({BuildContext? context, bool? manualUpdate}) super.argument,
}) : super(
@ -71,7 +71,7 @@ final class CheckForUpdateFamily extends $Family
FutureOr<void>,
({BuildContext? context, bool? manualUpdate})
> {
const CheckForUpdateFamily._()
CheckForUpdateFamily._()
: super(
retry: null,
name: r'checkForUpdateProvider',
@ -91,12 +91,12 @@ final class CheckForUpdateFamily extends $Family
}
@ProviderFor(checkForAppUpdates)
const checkForAppUpdatesProvider = CheckForAppUpdatesProvider._();
final checkForAppUpdatesProvider = CheckForAppUpdatesProvider._();
final class CheckForAppUpdatesProvider
extends $FunctionalProvider<bool, bool, bool>
with $Provider<bool> {
const CheckForAppUpdatesProvider._()
CheckForAppUpdatesProvider._()
: super(
from: null,
argument: null,

View file

@ -10,7 +10,7 @@ part of 'get_package_info.dart';
// ignore_for_file: type=lint, type=warning
@ProviderFor(getPackageInfo)
const getPackageInfoProvider = GetPackageInfoProvider._();
final getPackageInfoProvider = GetPackageInfoProvider._();
final class GetPackageInfoProvider
extends
@ -20,7 +20,7 @@ final class GetPackageInfoProvider
FutureOr<PackageInfo>
>
with $FutureModifier<PackageInfo>, $FutureProvider<PackageInfo> {
const GetPackageInfoProvider._()
GetPackageInfoProvider._()
: super(
from: null,
argument: null,

View file

@ -0,0 +1,9 @@
import 'package:mangayomi/main.dart';
import 'package:mangayomi/models/settings.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart';
part 'logs_state.g.dart';
@riverpod
bool logsState(Ref ref) {
return isar.settings.getSync(227)?.enableLogs ?? false;
}

View file

@ -0,0 +1,50 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'logs_state.dart';
// **************************************************************************
// RiverpodGenerator
// **************************************************************************
// GENERATED CODE - DO NOT MODIFY BY HAND
// ignore_for_file: type=lint, type=warning
@ProviderFor(logsState)
final logsStateProvider = LogsStateProvider._();
final class LogsStateProvider extends $FunctionalProvider<bool, bool, bool>
with $Provider<bool> {
LogsStateProvider._()
: super(
from: null,
argument: null,
retry: null,
name: r'logsStateProvider',
isAutoDispose: true,
dependencies: null,
$allTransitiveDependencies: null,
);
@override
String debugGetCreateSourceHash() => _$logsStateHash();
@$internal
@override
$ProviderElement<bool> $createElement($ProviderPointer pointer) =>
$ProviderElement(pointer);
@override
bool create(Ref ref) {
return logsState(ref);
}
/// {@macro riverpod.override_with_value}
Override overrideWithValue(bool value) {
return $ProviderOverride(
origin: this,
providerOverride: $SyncValueProvider<bool>(value),
);
}
}
String _$logsStateHash() => r'680ab781a039e0441394dc0b376b8add0fb80910';

View file

@ -1,3 +1,5 @@
import 'dart:io';
import 'package:flutter/foundation.dart' show kIsWeb;
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:isar_community/isar.dart';
@ -11,6 +13,8 @@ import 'package:mangayomi/modules/more/settings/reader/providers/reader_state_pr
import 'package:mangayomi/modules/more/settings/sync/providers/sync_providers.dart';
import 'package:mangayomi/modules/widgets/progress_center.dart';
import 'package:mangayomi/providers/l10n_providers.dart';
import 'package:mangayomi/utils/item_type_filters.dart';
import 'package:mangayomi/utils/item_type_localization.dart';
import 'package:super_sliver_list/super_sliver_list.dart';
class CategoriesScreen extends ConsumerStatefulWidget {
@ -24,17 +28,15 @@ class CategoriesScreen extends ConsumerStatefulWidget {
class _CategoriesScreenState extends ConsumerState<CategoriesScreen>
with TickerProviderStateMixin {
late TabController _tabBarController;
late final List<String> _tabList;
late final List<ItemType> _visibleTabTypes;
@override
void initState() {
super.initState();
final hideItems = ref.read(hideItemsStateProvider);
_tabList = [
if (!hideItems.contains("/MangaLibrary")) "/MangaLibrary",
if (!hideItems.contains("/AnimeLibrary")) "/AnimeLibrary",
if (!hideItems.contains("/NovelLibrary")) "/NovelLibrary",
];
_tabBarController = TabController(length: _tabList.length, vsync: this);
_visibleTabTypes = hiddenItemTypes(ref.read(hideItemsStateProvider));
_tabBarController = TabController(
length: _visibleTabTypes.length,
vsync: this,
);
_tabBarController.animateTo(widget.data.$2);
}
@ -46,7 +48,7 @@ class _CategoriesScreenState extends ConsumerState<CategoriesScreen>
@override
Widget build(BuildContext context) {
if (_tabList.isEmpty) {
if (_visibleTabTypes.isEmpty) {
return Scaffold(
appBar: AppBar(title: Text(context.l10n.categories)),
body: Center(child: Text("EMPTY\nMPTY\nMTY\nMT\n\n")),
@ -55,7 +57,7 @@ class _CategoriesScreenState extends ConsumerState<CategoriesScreen>
final l10n = l10nLocalizations(context)!;
return DefaultTabController(
animationDuration: Duration.zero,
length: _tabList.length,
length: _visibleTabTypes.length,
child: Scaffold(
appBar: AppBar(
elevation: 0,
@ -67,23 +69,15 @@ class _CategoriesScreenState extends ConsumerState<CategoriesScreen>
bottom: TabBar(
indicatorSize: TabBarIndicatorSize.label,
controller: _tabBarController,
tabs: _tabList.map((route) {
if (route == "/MangaLibrary") return Tab(text: l10n.manga);
if (route == "/AnimeLibrary") return Tab(text: l10n.anime);
return Tab(text: l10n.novel);
tabs: _visibleTabTypes.map((type) {
return Tab(text: type.localized(l10n));
}).toList(),
),
),
body: TabBarView(
controller: _tabBarController,
children: _tabList.map((route) {
if (route == "/MangaLibrary") {
return CategoriesTab(itemType: ItemType.manga);
}
if (route == "/AnimeLibrary") {
return CategoriesTab(itemType: ItemType.anime);
}
return CategoriesTab(itemType: ItemType.novel);
children: _visibleTabTypes.map((type) {
return CategoriesTab(itemType: type);
}).toList(),
),
),
@ -99,17 +93,75 @@ class CategoriesTab extends ConsumerStatefulWidget {
ConsumerState<CategoriesTab> createState() => _CategoriesTabState();
}
class _CategoriesTabState extends ConsumerState<CategoriesTab> {
class _CategoriesTabState extends ConsumerState<CategoriesTab>
with SingleTickerProviderStateMixin {
List<Category> _entries = [];
void _updateCategoriesOrder(List<Category> categories) {
isar.writeTxnSync(() {
isar.categorys.clearSync();
isar.categorys.putAllSync(categories);
final cats = isar.categorys.filter().posIsNull().findAllSync();
for (var category in cats) {
isar.categorys.putSync(category..pos = category.id);
}
});
late AnimationController _swapAnimationController;
int? _animatingFromIndex;
int? _animatingToIndex;
@override
void initState() {
super.initState();
_swapAnimationController = AnimationController(
vsync: this,
duration: const Duration(milliseconds: 200),
);
}
@override
void dispose() {
_swapAnimationController.dispose();
super.dispose();
}
bool get _isDesktop {
if (kIsWeb) return false;
return Platform.isMacOS || Platform.isLinux || Platform.isWindows;
}
/// Moves a category from `index` to `newIndex` in the list,
/// swaps their positions in memory, and persists the change in Isar.
Future<void> _moveCategory(int index, int newIndex) async {
// Prevent invalid moves (out of bounds)
if (newIndex < 0 || newIndex >= _entries.length) return;
if (_isDesktop && mounted) {
setState(() {
_animatingFromIndex = index;
_animatingToIndex = newIndex;
});
await _swapAnimationController.forward(from: 0.0);
// Grab the two category objects involved in the swap
final a = _entries[index];
final b = _entries[newIndex];
// Swap their positions inside the inmemory list
_entries[newIndex] = a;
_entries[index] = b;
// Swap their persisted `pos` values so ordering is saved correctly
final temp = a.pos;
a.pos = b.pos;
b.pos = temp;
// Persist both updated objects in a single Isar transaction
await isar.writeTxn(() async => isar.categorys.putAll([a, b]));
setState(() {
_animatingFromIndex = null;
_animatingToIndex = null;
});
} else {
final a = _entries[index];
final b = _entries[newIndex];
_entries[newIndex] = a;
_entries[index] = b;
final temp = a.pos;
a.pos = b.pos;
b.pos = temp;
await isar.writeTxn(() async => isar.categorys.putAll([a, b]));
setState(() {});
}
}
@override
@ -141,196 +193,37 @@ class _CategoriesTabState extends ConsumerState<CategoriesTab> {
padding: const EdgeInsets.only(bottom: 100),
itemBuilder: (context, index) {
final category = _entries[index];
return AnimatedSwitcher(
duration: const Duration(milliseconds: 900),
child: Padding(
key: Key('category_${category.id}'),
padding: const EdgeInsets.symmetric(horizontal: 8),
child: Card(
child: Column(
children: [
ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: Colors.transparent,
elevation: 0,
shadowColor: Colors.transparent,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(0),
bottomRight: Radius.circular(0),
topRight: Radius.circular(10),
topLeft: Radius.circular(10),
),
),
),
onPressed: () {
_renameCategory(category);
},
child: Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
const Icon(Icons.label_outline_rounded),
const SizedBox(width: 10),
Expanded(child: Text(category.name!)),
],
),
Widget itemWidget = _buildCategoryCard(context, category, index);
if (_isDesktop &&
_animatingFromIndex != null &&
_animatingToIndex != null) {
if (index == _animatingFromIndex ||
index == _animatingToIndex) {
final isMovingDown =
_animatingFromIndex! < _animatingToIndex!;
final offset = index == _animatingFromIndex
? (isMovingDown ? 1.0 : -1.0)
: (isMovingDown ? -1.0 : 1.0);
itemWidget = AnimatedBuilder(
animation: _swapAnimationController,
builder: (context, child) {
return Transform.translate(
offset: Offset(
0,
offset * (1 - _swapAnimationController.value) * 80,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
Row(
children: [
const SizedBox(width: 10),
IconButton(
icon: const Icon(
Icons.arrow_drop_up_outlined,
),
onPressed: index > 0
? () {
final item = _entries[index - 1];
_entries.removeAt(index);
_entries.removeAt(index - 1);
int? currentPos = category.pos;
int? pos = item.pos;
setState(() {});
_updateCategoriesOrder([
..._entries,
category..pos = pos,
item..pos = currentPos,
]);
}
: null,
),
IconButton(
icon: const Icon(
Icons.arrow_drop_down_outlined,
),
onPressed: index < _entries.length - 1
? () {
final item = _entries[index + 1];
_entries.removeAt(index + 1);
_entries.removeAt(index);
int? currentPos = category.pos;
int? pos = item.pos;
setState(() {});
_updateCategoriesOrder([
..._entries,
category..pos = pos,
item..pos = currentPos,
]);
}
: null,
),
],
),
],
),
Row(
children: [
IconButton(
onPressed: () {
_renameCategory(category);
},
icon: const Icon(
Icons.mode_edit_outline_outlined,
),
),
SizedBox(width: 10),
IconButton(
onPressed: () {
isar.writeTxnSync(() async {
category.hide = !(category.hide ?? false);
category.updatedAt =
DateTime.now().millisecondsSinceEpoch;
isar.categorys.putSync(category);
});
},
icon: Icon(
!(category.hide ?? false)
? Icons.visibility_outlined
: Icons.visibility_off_outlined,
),
),
SizedBox(width: 10),
IconButton(
onPressed: () {
showDialog(
context: context,
builder: (context) {
return StatefulBuilder(
builder: (context, setState) {
return AlertDialog(
title: Text(l10n.delete_category),
content: Text(
l10n.delete_category_msg(
category.name!,
),
),
actions: [
Row(
mainAxisAlignment:
MainAxisAlignment.end,
children: [
TextButton(
onPressed: () {
Navigator.pop(context);
},
child: Text(l10n.cancel),
),
const SizedBox(width: 15),
TextButton(
onPressed: () async {
await _removeCategory(
category,
context,
);
},
child: Text(l10n.ok),
),
],
),
],
);
},
);
},
);
},
icon: const Icon(Icons.delete_outlined),
),
],
),
],
),
],
),
),
),
transitionBuilder: (Widget child, Animation<double> animation) {
return SlideTransition(
position:
Tween<Offset>(
begin: const Offset(0, 1),
end: Offset.zero,
).animate(
CurvedAnimation(
parent: animation,
curve: Curves.fastLinearToSlowEaseIn,
),
),
child: SizeTransition(
sizeFactor: CurvedAnimation(
parent: animation,
curve: Curves.fastLinearToSlowEaseIn,
),
axisAlignment: 0.5,
child: child,
),
child: child,
);
},
child: itemWidget,
);
},
);
}
}
return itemWidget;
},
);
},
@ -446,6 +339,150 @@ class _CategoriesTabState extends ConsumerState<CategoriesTab> {
);
}
Widget _buildCategoryCard(
BuildContext context,
Category category,
int index,
) {
final l10n = l10nLocalizations(context)!;
return Padding(
key: Key('category_${category.id}'),
padding: const EdgeInsets.symmetric(horizontal: 8),
child: Card(
child: Column(
children: [
ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: Colors.transparent,
elevation: 0,
shadowColor: Colors.transparent,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(0),
bottomRight: Radius.circular(0),
topRight: Radius.circular(10),
topLeft: Radius.circular(10),
),
),
),
onPressed: () {
_renameCategory(category);
},
child: Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
const Icon(Icons.label_outline_rounded),
const SizedBox(width: 10),
Expanded(child: Text(category.name!)),
],
),
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
Row(
children: [
const SizedBox(width: 10),
IconButton(
icon: const Icon(Icons.arrow_drop_up_outlined),
onPressed: index > 0
? () {
_moveCategory(index, index - 1);
}
: null,
),
IconButton(
icon: const Icon(Icons.arrow_drop_down_outlined),
onPressed: index < _entries.length - 1
? () {
_moveCategory(index, index + 1);
}
: null,
),
],
),
],
),
Row(
children: [
IconButton(
onPressed: () {
_renameCategory(category);
},
icon: const Icon(Icons.mode_edit_outline_outlined),
),
SizedBox(width: 10),
IconButton(
onPressed: () async {
await isar.writeTxn(() async {
category.hide = !(category.hide ?? false);
category.updatedAt =
DateTime.now().millisecondsSinceEpoch;
isar.categorys.put(category);
});
},
icon: Icon(
!(category.hide ?? false)
? Icons.visibility_outlined
: Icons.visibility_off_outlined,
),
),
SizedBox(width: 10),
IconButton(
onPressed: () {
showDialog(
context: context,
builder: (context) {
return StatefulBuilder(
builder: (context, setState) {
return AlertDialog(
title: Text(l10n.delete_category),
content: Text(
l10n.delete_category_msg(category.name!),
),
actions: [
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
TextButton(
onPressed: () {
Navigator.pop(context);
},
child: Text(l10n.cancel),
),
const SizedBox(width: 15),
TextButton(
onPressed: () async {
await _removeCategory(
category,
context,
);
},
child: Text(l10n.ok),
),
],
),
],
);
},
);
},
);
},
icon: const Icon(Icons.delete_outlined),
),
],
),
],
),
],
),
),
);
}
Future<void> _removeCategory(Category category, BuildContext context) async {
await isar.writeTxn(() async {
// All Items with this category

View file

@ -10,7 +10,7 @@ part of 'isar_providers.dart';
// ignore_for_file: type=lint, type=warning
@ProviderFor(getMangaCategorieStream)
const getMangaCategorieStreamProvider = GetMangaCategorieStreamFamily._();
final getMangaCategorieStreamProvider = GetMangaCategorieStreamFamily._();
final class GetMangaCategorieStreamProvider
extends
@ -20,7 +20,7 @@ final class GetMangaCategorieStreamProvider
Stream<List<Category>>
>
with $FutureModifier<List<Category>>, $StreamProvider<List<Category>> {
const GetMangaCategorieStreamProvider._({
GetMangaCategorieStreamProvider._({
required GetMangaCategorieStreamFamily super.from,
required ItemType super.argument,
}) : super(
@ -70,7 +70,7 @@ String _$getMangaCategorieStreamHash() =>
final class GetMangaCategorieStreamFamily extends $Family
with $FunctionalFamilyOverride<Stream<List<Category>>, ItemType> {
const GetMangaCategorieStreamFamily._()
GetMangaCategorieStreamFamily._()
: super(
retry: null,
name: r'getMangaCategorieStreamProvider',

View file

@ -10,11 +10,11 @@ part of 'auto_backup.dart';
// ignore_for_file: type=lint, type=warning
@ProviderFor(BackupFrequencyState)
const backupFrequencyStateProvider = BackupFrequencyStateProvider._();
final backupFrequencyStateProvider = BackupFrequencyStateProvider._();
final class BackupFrequencyStateProvider
extends $NotifierProvider<BackupFrequencyState, int> {
const BackupFrequencyStateProvider._()
BackupFrequencyStateProvider._()
: super(
from: null,
argument: null,
@ -49,7 +49,6 @@ abstract class _$BackupFrequencyState extends $Notifier<int> {
@$mustCallSuper
@override
void runBuild() {
final created = build();
final ref = this.ref as $Ref<int, int>;
final element =
ref.element
@ -59,17 +58,17 @@ abstract class _$BackupFrequencyState extends $Notifier<int> {
Object?,
Object?
>;
element.handleValue(ref, created);
element.handleCreate(ref, build);
}
}
@ProviderFor(BackupFrequencyOptionsState)
const backupFrequencyOptionsStateProvider =
final backupFrequencyOptionsStateProvider =
BackupFrequencyOptionsStateProvider._();
final class BackupFrequencyOptionsStateProvider
extends $NotifierProvider<BackupFrequencyOptionsState, List<int>> {
const BackupFrequencyOptionsStateProvider._()
BackupFrequencyOptionsStateProvider._()
: super(
from: null,
argument: null,
@ -104,7 +103,6 @@ abstract class _$BackupFrequencyOptionsState extends $Notifier<List<int>> {
@$mustCallSuper
@override
void runBuild() {
final created = build();
final ref = this.ref as $Ref<List<int>, List<int>>;
final element =
ref.element
@ -114,16 +112,16 @@ abstract class _$BackupFrequencyOptionsState extends $Notifier<List<int>> {
Object?,
Object?
>;
element.handleValue(ref, created);
element.handleCreate(ref, build);
}
}
@ProviderFor(AutoBackupLocationState)
const autoBackupLocationStateProvider = AutoBackupLocationStateProvider._();
final autoBackupLocationStateProvider = AutoBackupLocationStateProvider._();
final class AutoBackupLocationStateProvider
extends $NotifierProvider<AutoBackupLocationState, (String, String)> {
const AutoBackupLocationStateProvider._()
AutoBackupLocationStateProvider._()
: super(
from: null,
argument: null,
@ -158,7 +156,6 @@ abstract class _$AutoBackupLocationState extends $Notifier<(String, String)> {
@$mustCallSuper
@override
void runBuild() {
final created = build();
final ref = this.ref as $Ref<(String, String), (String, String)>;
final element =
ref.element
@ -168,17 +165,17 @@ abstract class _$AutoBackupLocationState extends $Notifier<(String, String)> {
Object?,
Object?
>;
element.handleValue(ref, created);
element.handleCreate(ref, build);
}
}
@ProviderFor(checkAndBackup)
const checkAndBackupProvider = CheckAndBackupProvider._();
final checkAndBackupProvider = CheckAndBackupProvider._();
final class CheckAndBackupProvider
extends $FunctionalProvider<AsyncValue<void>, void, FutureOr<void>>
with $FutureModifier<void>, $FutureProvider<void> {
const CheckAndBackupProvider._()
CheckAndBackupProvider._()
: super(
from: null,
argument: null,

View file

@ -175,17 +175,13 @@ Future<void> doBackUp(
alignment: Alignment.topLeft,
child: ElevatedButton(
onPressed: () {
final box = () {
try {
return context.findRenderObject() as RenderBox?;
} catch (e) {
return null;
}
}();
final RenderBox? box =
context.findRenderObject() as RenderBox?;
SharePlus.instance.share(
ShareParams(
files: [XFile(p.join(path, "$name.backup"))],
text: "$name.backup",
subject: "$name.backup",
title: "Share Mangayomi backup file",
sharePositionOrigin: box == null
? null
: box.localToGlobal(Offset.zero) & box.size,

View file

@ -10,12 +10,12 @@ part of 'backup.dart';
// ignore_for_file: type=lint, type=warning
@ProviderFor(doBackUp)
const doBackUpProvider = DoBackUpFamily._();
final doBackUpProvider = DoBackUpFamily._();
final class DoBackUpProvider
extends $FunctionalProvider<AsyncValue<void>, void, FutureOr<void>>
with $FutureModifier<void>, $FutureProvider<void> {
const DoBackUpProvider._({
DoBackUpProvider._({
required DoBackUpFamily super.from,
required ({List<int> list, String path, BuildContext? context})
super.argument,
@ -65,7 +65,7 @@ final class DoBackUpProvider
}
}
String _$doBackUpHash() => r'e0d28adf6b592e34f26fd6b566151f3691f1946a';
String _$doBackUpHash() => r'5b410047be9b7dc6f7c3651750ab4b2531bedc3e';
final class DoBackUpFamily extends $Family
with
@ -73,7 +73,7 @@ final class DoBackUpFamily extends $Family
FutureOr<void>,
({List<int> list, String path, BuildContext? context})
> {
const DoBackUpFamily._()
DoBackUpFamily._()
: super(
retry: null,
name: r'doBackUpProvider',

View file

@ -10,11 +10,11 @@ part of 'restore.dart';
// ignore_for_file: type=lint, type=warning
@ProviderFor(doRestore)
const doRestoreProvider = DoRestoreFamily._();
final doRestoreProvider = DoRestoreFamily._();
final class DoRestoreProvider extends $FunctionalProvider<void, void, void>
with $Provider<void> {
const DoRestoreProvider._({
DoRestoreProvider._({
required DoRestoreFamily super.from,
required ({String path, BuildContext context}) super.argument,
}) : super(
@ -70,7 +70,7 @@ String _$doRestoreHash() => r'4e556ae822d1f48ef3519fd65393c178de14b73d';
final class DoRestoreFamily extends $Family
with
$FunctionalFamilyOverride<void, ({String path, BuildContext context})> {
const DoRestoreFamily._()
DoRestoreFamily._()
: super(
retry: null,
name: r'doRestoreProvider',
@ -90,11 +90,11 @@ final class DoRestoreFamily extends $Family
}
@ProviderFor(restoreBackup)
const restoreBackupProvider = RestoreBackupFamily._();
final restoreBackupProvider = RestoreBackupFamily._();
final class RestoreBackupProvider extends $FunctionalProvider<void, void, void>
with $Provider<void> {
const RestoreBackupProvider._({
RestoreBackupProvider._({
required RestoreBackupFamily super.from,
required (Map<String, dynamic>, {bool full}) super.argument,
}) : super(
@ -149,7 +149,7 @@ String _$restoreBackupHash() => r'adc705e1e65dedcc919a525d7bd14f6451620c43';
final class RestoreBackupFamily extends $Family
with $FunctionalFamilyOverride<void, (Map<String, dynamic>, {bool full})> {
const RestoreBackupFamily._()
RestoreBackupFamily._()
: super(
retry: null,
name: r'restoreBackupProvider',
@ -166,12 +166,12 @@ final class RestoreBackupFamily extends $Family
}
@ProviderFor(restoreKotatsuBackup)
const restoreKotatsuBackupProvider = RestoreKotatsuBackupFamily._();
final restoreKotatsuBackupProvider = RestoreKotatsuBackupFamily._();
final class RestoreKotatsuBackupProvider
extends $FunctionalProvider<void, void, void>
with $Provider<void> {
const RestoreKotatsuBackupProvider._({
RestoreKotatsuBackupProvider._({
required RestoreKotatsuBackupFamily super.from,
required Archive super.argument,
}) : super(
@ -227,7 +227,7 @@ String _$restoreKotatsuBackupHash() =>
final class RestoreKotatsuBackupFamily extends $Family
with $FunctionalFamilyOverride<void, Archive> {
const RestoreKotatsuBackupFamily._()
RestoreKotatsuBackupFamily._()
: super(
retry: null,
name: r'restoreKotatsuBackupProvider',
@ -244,12 +244,12 @@ final class RestoreKotatsuBackupFamily extends $Family
}
@ProviderFor(restoreTachiBkBackup)
const restoreTachiBkBackupProvider = RestoreTachiBkBackupFamily._();
final restoreTachiBkBackupProvider = RestoreTachiBkBackupFamily._();
final class RestoreTachiBkBackupProvider
extends $FunctionalProvider<void, void, void>
with $Provider<void> {
const RestoreTachiBkBackupProvider._({
RestoreTachiBkBackupProvider._({
required RestoreTachiBkBackupFamily super.from,
required (String, BackupType) super.argument,
}) : super(
@ -305,7 +305,7 @@ String _$restoreTachiBkBackupHash() =>
final class RestoreTachiBkBackupFamily extends $Family
with $FunctionalFamilyOverride<void, (String, BackupType)> {
const RestoreTachiBkBackupFamily._()
RestoreTachiBkBackupFamily._()
: super(
retry: null,
name: r'restoreTachiBkBackupProvider',

View file

@ -5,8 +5,7 @@ import 'package:mangayomi/models/settings.dart';
import 'package:mangayomi/providers/l10n_providers.dart';
import 'package:mangayomi/providers/storage_provider.dart';
import 'package:mangayomi/router/router.dart';
import 'package:path/path.dart';
import 'package:path_provider/path_provider.dart';
import 'package:mangayomi/utils/extensions/others.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart';
part 'storage_usage.g.dart';
@ -16,33 +15,24 @@ class TotalChapterCacheSizeState extends _$TotalChapterCacheSizeState {
String build() {
_getTotalDiskSpace().then((value) {
if (!ref.mounted) return;
state = _formatBytes(value);
state = value.formattedFileSize();
});
return "0.00 B";
}
final String _cacheImageMangaPath = join('Mangayomi', 'cacheimagemanga');
final String _cacheDownloadPath = join('Mangayomi', 'downloads');
final _storage = StorageProvider();
Future<void> clearCache({bool showToast = true}) async {
final tempPath = (await getTemporaryDirectory()).path;
String? msg;
try {
final dir = Directory(join(tempPath, _cacheImageMangaPath));
final dir = await _storage.getCacheDirectory('cacheimagemanga');
if (dir.existsSync()) {
await dir.delete(recursive: true);
}
msg = "0.00 B";
} catch (_) {}
try {
final dir = Directory(join(tempPath, _cacheDownloadPath));
if (dir.existsSync()) {
await dir.delete(recursive: true);
}
msg = "0.00 B";
} catch (_) {}
try {
await StorageProvider().deleteTmpDirectory();
await _storage.deleteTmpDirectory();
} catch (_) {}
if (msg != null && showToast) {
state = msg;
@ -53,14 +43,10 @@ class TotalChapterCacheSizeState extends _$TotalChapterCacheSizeState {
}
Future<int> _getTotalDiskSpace() async {
final tempPath = (await getTemporaryDirectory()).path;
try {
return await _getdirectorySize(
Directory(join(tempPath, _cacheImageMangaPath)),
) +
await _getdirectorySize(
Directory(join(tempPath, _cacheDownloadPath)),
);
await _storage.getCacheDirectory('cacheimagemanga'),
);
} catch (_) {}
return 0;
}
@ -79,19 +65,6 @@ class TotalChapterCacheSizeState extends _$TotalChapterCacheSizeState {
} catch (_) {}
return 0;
}
String _formatBytes(int bytes) {
const units = ['B', 'KB', 'MB', 'GB'];
int unitIndex = 0;
double size = bytes.toDouble();
while (size >= 1024 && unitIndex < units.length - 1) {
size /= 1024;
unitIndex++;
}
return '${size.toStringAsFixed(2)} ${units[unitIndex]}';
}
}
@riverpod

View file

@ -10,12 +10,12 @@ part of 'storage_usage.dart';
// ignore_for_file: type=lint, type=warning
@ProviderFor(TotalChapterCacheSizeState)
const totalChapterCacheSizeStateProvider =
final totalChapterCacheSizeStateProvider =
TotalChapterCacheSizeStateProvider._();
final class TotalChapterCacheSizeStateProvider
extends $NotifierProvider<TotalChapterCacheSizeState, String> {
const TotalChapterCacheSizeStateProvider._()
TotalChapterCacheSizeStateProvider._()
: super(
from: null,
argument: null,
@ -43,14 +43,13 @@ final class TotalChapterCacheSizeStateProvider
}
String _$totalChapterCacheSizeStateHash() =>
r'6e92eec01cc21fbea3996d220c0b2edaadec3786';
r'fdecfd853bcd1355217fcef9590d6c69fbd92ce4';
abstract class _$TotalChapterCacheSizeState extends $Notifier<String> {
String build();
@$mustCallSuper
@override
void runBuild() {
final created = build();
final ref = this.ref as $Ref<String, String>;
final element =
ref.element
@ -60,17 +59,17 @@ abstract class _$TotalChapterCacheSizeState extends $Notifier<String> {
Object?,
Object?
>;
element.handleValue(ref, created);
element.handleCreate(ref, build);
}
}
@ProviderFor(ClearChapterCacheOnAppLaunchState)
const clearChapterCacheOnAppLaunchStateProvider =
final clearChapterCacheOnAppLaunchStateProvider =
ClearChapterCacheOnAppLaunchStateProvider._();
final class ClearChapterCacheOnAppLaunchStateProvider
extends $NotifierProvider<ClearChapterCacheOnAppLaunchState, bool> {
const ClearChapterCacheOnAppLaunchStateProvider._()
ClearChapterCacheOnAppLaunchStateProvider._()
: super(
from: null,
argument: null,
@ -107,7 +106,6 @@ abstract class _$ClearChapterCacheOnAppLaunchState extends $Notifier<bool> {
@$mustCallSuper
@override
void runBuild() {
final created = build();
final ref = this.ref as $Ref<bool, bool>;
final element =
ref.element
@ -117,6 +115,6 @@ abstract class _$ClearChapterCacheOnAppLaunchState extends $Notifier<bool> {
Object?,
Object?
>;
element.handleValue(ref, created);
element.handleCreate(ref, build);
}
}

View file

@ -10,11 +10,11 @@ part of 'algorithm_weights_state_provider.dart';
// ignore_for_file: type=lint, type=warning
@ProviderFor(AlgorithmWeightsState)
const algorithmWeightsStateProvider = AlgorithmWeightsStateProvider._();
final algorithmWeightsStateProvider = AlgorithmWeightsStateProvider._();
final class AlgorithmWeightsStateProvider
extends $NotifierProvider<AlgorithmWeightsState, AlgorithmWeights> {
const AlgorithmWeightsStateProvider._()
AlgorithmWeightsStateProvider._()
: super(
from: null,
argument: null,
@ -49,7 +49,6 @@ abstract class _$AlgorithmWeightsState extends $Notifier<AlgorithmWeights> {
@$mustCallSuper
@override
void runBuild() {
final created = build();
final ref = this.ref as $Ref<AlgorithmWeights, AlgorithmWeights>;
final element =
ref.element
@ -59,6 +58,6 @@ abstract class _$AlgorithmWeightsState extends $Notifier<AlgorithmWeights> {
Object?,
Object?
>;
element.handleValue(ref, created);
element.handleCreate(ref, build);
}
}

View file

@ -10,11 +10,11 @@ part of 'downloaded_only_state_provider.dart';
// ignore_for_file: type=lint, type=warning
@ProviderFor(DownloadedOnlyState)
const downloadedOnlyStateProvider = DownloadedOnlyStateProvider._();
final downloadedOnlyStateProvider = DownloadedOnlyStateProvider._();
final class DownloadedOnlyStateProvider
extends $NotifierProvider<DownloadedOnlyState, bool> {
const DownloadedOnlyStateProvider._()
DownloadedOnlyStateProvider._()
: super(
from: null,
argument: null,
@ -49,7 +49,6 @@ abstract class _$DownloadedOnlyState extends $Notifier<bool> {
@$mustCallSuper
@override
void runBuild() {
final created = build();
final ref = this.ref as $Ref<bool, bool>;
final element =
ref.element
@ -59,6 +58,6 @@ abstract class _$DownloadedOnlyState extends $Notifier<bool> {
Object?,
Object?
>;
element.handleValue(ref, created);
element.handleCreate(ref, build);
}
}

View file

@ -10,11 +10,11 @@ part of 'incognito_mode_state_provider.dart';
// ignore_for_file: type=lint, type=warning
@ProviderFor(IncognitoModeState)
const incognitoModeStateProvider = IncognitoModeStateProvider._();
final incognitoModeStateProvider = IncognitoModeStateProvider._();
final class IncognitoModeStateProvider
extends $NotifierProvider<IncognitoModeState, bool> {
const IncognitoModeStateProvider._()
IncognitoModeStateProvider._()
: super(
from: null,
argument: null,
@ -49,7 +49,6 @@ abstract class _$IncognitoModeState extends $Notifier<bool> {
@$mustCallSuper
@override
void runBuild() {
final created = build();
final ref = this.ref as $Ref<bool, bool>;
final element =
ref.element
@ -59,6 +58,6 @@ abstract class _$IncognitoModeState extends $Notifier<bool> {
Object?,
Object?
>;
element.handleValue(ref, created);
element.handleCreate(ref, build);
}
}

View file

@ -10,11 +10,11 @@ part of 'app_font_family.dart';
// ignore_for_file: type=lint, type=warning
@ProviderFor(AppFontFamily)
const appFontFamilyProvider = AppFontFamilyProvider._();
final appFontFamilyProvider = AppFontFamilyProvider._();
final class AppFontFamilyProvider
extends $NotifierProvider<AppFontFamily, String?> {
const AppFontFamilyProvider._()
AppFontFamilyProvider._()
: super(
from: null,
argument: null,
@ -48,7 +48,6 @@ abstract class _$AppFontFamily extends $Notifier<String?> {
@$mustCallSuper
@override
void runBuild() {
final created = build();
final ref = this.ref as $Ref<String?, String?>;
final element =
ref.element
@ -58,6 +57,6 @@ abstract class _$AppFontFamily extends $Notifier<String?> {
Object?,
Object?
>;
element.handleValue(ref, created);
element.handleCreate(ref, build);
}
}

View file

@ -10,11 +10,11 @@ part of 'blend_level_state_provider.dart';
// ignore_for_file: type=lint, type=warning
@ProviderFor(BlendLevelState)
const blendLevelStateProvider = BlendLevelStateProvider._();
final blendLevelStateProvider = BlendLevelStateProvider._();
final class BlendLevelStateProvider
extends $NotifierProvider<BlendLevelState, double> {
const BlendLevelStateProvider._()
BlendLevelStateProvider._()
: super(
from: null,
argument: null,
@ -48,7 +48,6 @@ abstract class _$BlendLevelState extends $Notifier<double> {
@$mustCallSuper
@override
void runBuild() {
final created = build();
final ref = this.ref as $Ref<double, double>;
final element =
ref.element
@ -58,6 +57,6 @@ abstract class _$BlendLevelState extends $Notifier<double> {
Object?,
Object?
>;
element.handleValue(ref, created);
element.handleCreate(ref, build);
}
}

View file

@ -10,11 +10,11 @@ part of 'date_format_state_provider.dart';
// ignore_for_file: type=lint, type=warning
@ProviderFor(DateFormatState)
const dateFormatStateProvider = DateFormatStateProvider._();
final dateFormatStateProvider = DateFormatStateProvider._();
final class DateFormatStateProvider
extends $NotifierProvider<DateFormatState, String> {
const DateFormatStateProvider._()
DateFormatStateProvider._()
: super(
from: null,
argument: null,
@ -48,7 +48,6 @@ abstract class _$DateFormatState extends $Notifier<String> {
@$mustCallSuper
@override
void runBuild() {
final created = build();
final ref = this.ref as $Ref<String, String>;
final element =
ref.element
@ -58,16 +57,16 @@ abstract class _$DateFormatState extends $Notifier<String> {
Object?,
Object?
>;
element.handleValue(ref, created);
element.handleCreate(ref, build);
}
}
@ProviderFor(RelativeTimesTampsState)
const relativeTimesTampsStateProvider = RelativeTimesTampsStateProvider._();
final relativeTimesTampsStateProvider = RelativeTimesTampsStateProvider._();
final class RelativeTimesTampsStateProvider
extends $NotifierProvider<RelativeTimesTampsState, int> {
const RelativeTimesTampsStateProvider._()
RelativeTimesTampsStateProvider._()
: super(
from: null,
argument: null,
@ -102,7 +101,6 @@ abstract class _$RelativeTimesTampsState extends $Notifier<int> {
@$mustCallSuper
@override
void runBuild() {
final created = build();
final ref = this.ref as $Ref<int, int>;
final element =
ref.element
@ -112,6 +110,6 @@ abstract class _$RelativeTimesTampsState extends $Notifier<int> {
Object?,
Object?
>;
element.handleValue(ref, created);
element.handleCreate(ref, build);
}
}

View file

@ -10,11 +10,11 @@ part of 'flex_scheme_color_state_provider.dart';
// ignore_for_file: type=lint, type=warning
@ProviderFor(FlexSchemeColorState)
const flexSchemeColorStateProvider = FlexSchemeColorStateProvider._();
final flexSchemeColorStateProvider = FlexSchemeColorStateProvider._();
final class FlexSchemeColorStateProvider
extends $NotifierProvider<FlexSchemeColorState, FlexSchemeColor> {
const FlexSchemeColorStateProvider._()
FlexSchemeColorStateProvider._()
: super(
from: null,
argument: null,
@ -49,7 +49,6 @@ abstract class _$FlexSchemeColorState extends $Notifier<FlexSchemeColor> {
@$mustCallSuper
@override
void runBuild() {
final created = build();
final ref = this.ref as $Ref<FlexSchemeColor, FlexSchemeColor>;
final element =
ref.element
@ -59,6 +58,6 @@ abstract class _$FlexSchemeColorState extends $Notifier<FlexSchemeColor> {
Object?,
Object?
>;
element.handleValue(ref, created);
element.handleCreate(ref, build);
}
}

View file

@ -10,11 +10,11 @@ part of 'pure_black_dark_mode_state_provider.dart';
// ignore_for_file: type=lint, type=warning
@ProviderFor(PureBlackDarkModeState)
const pureBlackDarkModeStateProvider = PureBlackDarkModeStateProvider._();
final pureBlackDarkModeStateProvider = PureBlackDarkModeStateProvider._();
final class PureBlackDarkModeStateProvider
extends $NotifierProvider<PureBlackDarkModeState, bool> {
const PureBlackDarkModeStateProvider._()
PureBlackDarkModeStateProvider._()
: super(
from: null,
argument: null,
@ -49,7 +49,6 @@ abstract class _$PureBlackDarkModeState extends $Notifier<bool> {
@$mustCallSuper
@override
void runBuild() {
final created = build();
final ref = this.ref as $Ref<bool, bool>;
final element =
ref.element
@ -59,6 +58,6 @@ abstract class _$PureBlackDarkModeState extends $Notifier<bool> {
Object?,
Object?
>;
element.handleValue(ref, created);
element.handleCreate(ref, build);
}
}

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