Commit graph

47 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
0316afc2c6 Make downloadedChapterIdsProvider async 2026-05-09 00:33:36 +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
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
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
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
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
2eb4efe435 Code refactor & some fix 2023-08-25 17:40:17 +01:00
kodjomoustapha
1340ffa88c Added feature that allow to import local anime 2023-08-24 18:21:02 +01:00
kodjomoustapha
35e5e2a015 New feature : add Anime
-add trackers support for anime
2023-07-27 19:24:18 +01:00
kodjomoustapha
b38f737c96 Big changes ( added support for external sources ) 2023-07-07 22:38:49 +01:00
kodjomoustapha
d91edcb27d local source badge & more 2023-06-15 16:01:10 +01:00
kodjomoustapha
ac5995cb79 feature: add local archive & manage local chapter 2023-06-14 21:28:57 +01:00
kodjomoustapha
7e3bd7b775 feature: reimplement local archive 2023-06-14 01:00:11 +01:00
kodjomoustapha
e2115f0a0a add download settings 2023-06-04 14:09:38 +01:00
kodjomoustapha
92b04a62aa Inkwell for library cover card 2023-06-04 00:36:28 +01:00
kodjomoustapha
03c4ab56e7 rename views to modules 2023-05-19 16:11:03 +01:00
Renamed from lib/views/library/widgets/library_gridview_widget.dart (Browse further)