Commit graph

60 commits

Author SHA1 Message Date
Mehakdeep Singh
861ee65113 perf(library): decode covers at thumbnail resolution to cut image-cache RAM
Refs #609 (high RAM with stutters).

Manga / anime covers from sources are typically 720x1080 or larger
(~3 MB decoded RGBA per cover). The library grid, library list and
generic browse / search card widgets render those covers at roughly
150x220 logical pixels, but every cover decoded to its full source
resolution and that decoded bitmap landed in Flutter's `imageCache`.
With 30-50 covers in flight during a normal scroll, the default
100 MB cache filled and the engine started evicting + re-decoding
aggressively — exactly the symptom in #609 (stutters + high RAM).

Mangayomi already had `ExtendedResizeImage` available via the
`extended_image_library` package and used it in one place
(`cachedCompressedNetworkImage`, called only from the History
screen). This commit generalises that pattern.

Add a `coverProvider()` helper in `lib/utils/cached_network.dart`
that wraps `CustomExtendedNetworkImageProvider` in
`ExtendedResizeImage` with a 200 KB encoded budget — sharp at
typical thumbnail size on high-DPR screens, ~3.6x smaller decoded
than a full-resolution cover. Pass through the same `cache` /
`cacheMaxAge` knobs the underlying provider exposes so existing
disk-cache behaviour is preserved.

Swap the three high-traffic thumbnail call sites to use it:

* `lib/modules/library/widgets/library_gridview_widget.dart`
* `lib/modules/library/widgets/library_listview_widget.dart`
* `lib/modules/widgets/manga_image_card_widget.dart`
  (both `MangaImageCardWidget` and `MangaImageCardListTileWidget`,
  used by browse and search results)

Deliberately not changed:

* The manga / anime detail page hero cover — large display, full
  resolution is appropriate.
* Reader pages — already memory-managed by `ChapterPreloadManager`
  and need full resolution for actual reading.
* `cachedNetworkImage()` and other lower-traffic thumbnail surfaces
  (tracker results, calendar, recommendation grid). Easy to extend
  in a follow-up if anyone asks; kept narrow here so review is
  manageable.

Verified

* `flutter analyze` clean on every touched file
* `flutter build macos --release` succeeds
* Smoke-tested on macOS with the local-all-fixes build: library
  grid, library list and browse card all render identical-looking
  covers at typical thumbnail sizes; no visible quality regression
  at the displayed scale
2026-05-09 23:37:44 -07:00
NBA2K1
e0a8301595 Use downloadedChapterIdsProvider instead
Use the already-existing downloadedChapterIdsProvider and do a simple Set.contains() lookup instead of the synchronous Isar query.

Performance improvement
2026-05-09 12:52:26 +02:00
NBA2K1
0316afc2c6 Make downloadedChapterIdsProvider async 2026-05-09 00:33:36 +02:00
NBA2K1
5bab1492a4 Reduce Code Duplication by Adding Platform Helper
New file `lib/utils/platform_utils.dart`, to stop defining isDesktop and isMobile everywhere.
2026-04-26 19:39:14 +02:00
NBA2K1
0a2c8e2649 rename files manga.dart and chapter.dart 2026-04-23 18:53:25 +02:00
NBA2K1
bcc44e94cb Replace download queries with cached provider
Remove synchronous Isar queries from each library grid item when
downloadedChapter is enabled.

- Replace per-card download queries with downloadedChapterIdsProvider
- Compute downloadCount via in-memory lookup instead of DB calls
- Eliminate repeated sync queries on rebuilds and tab switches
- Minor cleanup of unread chapter filter

This avoids dozens of synchronous queries per frame and significantly
improves grid performance and responsiveness.
2026-04-19 01:48:59 +02:00
NBA2K1
cc05ee13e8 Reduce code duplication
Also, change
`entry.chapters.toList().reversed.toList().last`
to
`entry.chapters.first`
Why reverse the list and then get the last item, when you can just get the first?
2026-04-12 23:03:50 +02:00
NBA2K1
05111da02b Extract ContinueReaderButton 2026-04-12 23:03:44 +02:00
NBA2K1
d706e82fd8 simplify query for continueReaderBtn
Refactor history lookup to use a direct mangaIdEqualTo query instead of the previous multi‑level chapter/manga filter.
The new approach improves performance, readability, and maintainability without changing how the play button behaves or how history entries are resolved.
2026-04-12 23:03:37 +02:00
NBA2K1
3f19636fcf Optimize download check
Change per‑chapter synchronous lookups inside isar.txnSync to a single batched anyOf query using collected chapter IDs.

Reduces repeated filtering, removes unnecessary loop, and improves performance.
2026-04-12 23:03:32 +02:00
NBA2K1
81123dc3cb Change the MangasListStateProvider to Set<int>
MangasListState previously stored selected manga IDs as List<int>.
Every visible library card called .contains() on that list once per
rebuild to determine its highlight state, making each check O(n) in
the number of selected items. The provider's own update/selectAll/
selectSome methods also used .contains() and .remove() on a List.

Change the state type to Set<int> throughout, making all membership
checks O(1). Updated all consumers: library_gridview_widget,
library_listview_widget, library_app_bar, library_dialogs, and
MangasSetIsReadState.
2026-04-12 23:03:18 +02:00
NBA2K1
d8ff9fb01d performance+
Change Clip.antiAliasWithSaveLayer to Clip.antiAlias
2026-04-12 23:03:07 +02:00
Moustapha Kodjo Amadou
0df04bcfad feat #682 option to split chapter whe importing local epub 2026-04-07 11:55:42 +01:00
Moustapha Kodjo Amadou
f1dfbbaefc Fix #480/#165 #479 #443 #541 #554 #452: reader and download fixes
- #480/#165: Fix double page mode chapter navigation index conversion
- #479: Fix page jump when switching single/double page mode
- #443: Clear zoom cache on page change for swipe-back
- #541: Add shift-click range selection for chapters (desktop)
- #554: Auto-clean orphaned download records, cascade delete
- #452: Add horizontal continuous RTL reader mode
2026-03-18 09:47:41 +01:00
Moustapha Kodjo Amadou
f729380223 feat: Implement app lock feature with biometric authentication
- Added AppLockScreen for biometric authentication to unlock the app.
- Introduced security settings screen to enable/disable app lock.
- Integrated local_auth package for biometric authentication support.
- Created security state providers to manage app lock state.
- Updated chapter list tile widget to support dismiss actions for bookmarking and marking chapters as read.
- Enhanced CBZ conversion process to include ComicInfo.xml metadata.
- Added conditional UI elements based on platform capabilities.
- Added Completed & Tracked filter in library
2026-03-04 11:56:49 +01:00
Moustapha Kodjo Amadou
1256e608c7 Refactor 2026-03-02 11:49:19 +01:00
Moustapha Kodjo Amadou
430e81e021 Refactor and update dependencies for Isar and Riverpod 2025-10-29 13:08:42 +01:00
Moustapha Kodjo Amadou
600a699708 feat: Add use sourceId property if not null to get source model 2025-08-28 12:12:23 +01:00
NBA2K1
69df87ff0e Merge two identical providers
Merge `isLongPressedMangaStateProvider` and `isLongPressedStateProvider`

Both providers do the same thing and it is impossible to change the value of the provider in different places in the app at the same time.

So just use one `isLongPressedStateProvider`. Reduces code duplication and there is no confusion about which one to use.
2025-07-29 14:02:48 +02:00
NBA2K1
3313e6e53a Don't focus searchbar when migrating
The searchbar already has input.
2025-07-12 20:26:31 +02:00
NBA2K1
d7dbce7a9a DRY 2025-07-12 20:24:42 +02:00
Moustapha Kodjo Amadou
538f87630c + 2025-06-02 12:41:06 +01:00
Moustapha Kodjo Amadou
80efee40d1 dart format 2025-05-30 17:43:42 +01:00
Enbiya Olgun
2446756552 moved super() call of initState to top of method 2025-04-22 04:57:52 +02:00
Moustapha Kodjo Amadou
2eb4545082 refactor: replace ListView with SuperListView across multiple widgets 2025-03-09 12:02:38 +01:00
Moustapha Kodjo Amadou
3e401c8af2 dart format 2025-02-23 15:31:49 +01:00
Schnitzel5
aa946c9d51 enhanced sync feature 2025-02-12 19:13:16 +01:00
Moustapha Kodjo Amadou
3eeb4777a6 feat: improve chapter download 2025-01-30 15:09:47 +01:00
Schnitzel5
34179a17a5 Merge branch 'feature/novel' into feature/light-novel 2024-12-20 15:59:06 +01:00
kodjomoustapha
a41ccaff22 fix & reformat 2024-12-20 10:15:15 +01:00
Yegor Shovkun
adbd1529f7 fix: cs fix (reformat with 120 line length) 2024-12-14 12:38:56 +02:00
kodjomoustapha
4748f3c699 fix 2024-12-13 10:31:57 +01:00
Schnitzel5
62f378f5ee added novel reader view 2024-12-10 00:01:54 +01:00
playerterra1
752387ccde changes for novel support 2024-11-05 14:55:54 +00:00
playerterra1
04ddbb6ac7 change data structure for novel type 2024-10-31 13:53:55 +00:00
kodjomoustapha
2ff3c0ebcc + 2024-08-02 11:21:42 +01:00
kodjomoustapha
15c8fea384 + 2024-07-29 15:00:53 +01:00
kodjomoustapha
8ae2ef20be some fixes 2024-05-14 13:06:46 +01:00
kodjomoustapha
3a6fc6abe0 Fix unread count 2024-05-02 15:45:22 +01:00
kodjomoustapha
932f26421f + 2024-05-02 14:25:06 +01:00
kodjomoustapha
123c05f393 fix 2024-03-19 17:42:29 +01:00
kodjomoustapha
d168b6ddcd Added cronet_http & cupertino_http, remove unnecessary packages 2024-03-14 17:40:15 +01:00
kodjomoustapha
6fa0e8a89f Added JavaScript extension runtime, gridview count 2024-03-12 17:24:41 +01:00
kodjomoustapha
910524d9bf fix 2024-02-08 20:52:23 +01:00
kodjomoustapha
9ee32a2380 Added Artist attr in model 2024-01-09 16:29:16 +01:00
kodjomoustapha
9d55733e97 Relocate extensions
-refactor
-also modify display widget in library draggabalble menu
2024-01-09 12:06:39 +01:00
kodjomoustapha
43be09db8f feat/pick-cover-image-from-trackers
-ability to choose anime/manga cover image from trackers as custom image
2024-01-08 15:36:00 +01:00
kodjomoustapha
9569a261bd WIP 2023-10-30 19:02:17 +01:00
kodjomoustapha
2f0b01db16 fix chapter list when adding new chapter entry 2023-09-20 15:34:12 +01:00
kodjomoustapha
2ddbc0b40a fix 2023-08-25 21:08:21 +01:00