Commit graph

210 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
Moustapha Kodjo Amadou
8c416563d4
Merge pull request #714 from NBA2K1/main
Rewrite chapter update & sorting; Preserve read state & improve ChapterRecognition & adapt EndOfMangaCard to reading mode & Clean Code
2026-04-30 11:19:11 +01:00
NBA2K1
3051c0ab97 Fix bug
Fix a rare bug in the chapter list.
2026-04-27 22:58:38 +02:00
NBA2K1
dd6ff2580a Use Platform Helper Everywhere Possible 2026-04-26 19:42:13 +02:00
NBA2K1
0c46b88002 Remove isMobile and isDesktop Extension
Platform checks shouldn't be dependent on BuildContext.
2026-04-26 19:39:14 +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
b05c17518f Reduce Code Duplication Across 3 Files
By extracting:

```
      SystemChrome.setEnabledSystemUIMode(
        SystemUiMode.manual,
        overlays: SystemUiOverlay.values,
      );
```

to a file `system_ui.dart` and calling the method `restoreSystemUI()`
2026-04-26 15:03:56 +02:00
NBA2K1
a9e307b2a4 Add multi-season support and split parse methods
Changes:
- Add season-keyword regex (staffel, season, saison, temporada) and
  episode-keyword regex (folge, episode, ep.) to reliably extract
  the correct number regardless of name format
- parseChapterNumber() now encodes season context into the sort key
  (season * 100000 + episode) so multi-season anime sort correctly
  across seasons without mixing episode numbers
- Add parseEpisodeNumber() which strips season context and returns
  only the episode number within a season; use this for tracker
  updates (MAL/AniList/Kitsu) and AniSkip lookups, where the tracker
  entry is already season-specific
- Switch updateTrackChapterRead and getAniSkipResults to
  parseEpisodeNumber to fix incorrect episode reporting for
  multi-season anime
- Compile all RegExp objects as static finals instead of per-call
  instantiation
- Refactor duplicated parse logic into a single private _parse()
  method with an applySeason flag
2026-04-26 03:32:28 +02:00
NBA2K1
085c731bce Make chapter UI list descending by default
- remove the reverse parameter because false is already the model default, so passing it is redundant.
- flip the reverse bool, to keep the chapter sorting of already added manga the same.
  Otherwise the user would have to change the sorting orientation for the chapters in the library.
2026-04-26 03:29:27 +02:00
NBA2K1
8ac25750a2 Why reverse the reading list and then calculate -1 2026-04-25 00:15:13 +02:00
Moustapha Kodjo Amadou
85f154d738
Merge pull request #713 from NBA2K1/Reorder-code
Reorder code
2026-04-24 19:52:11 +01:00
NBA2K1
4077511022 Improve chapter sorting & update logic
- Add ChapterRecognition for numeric chapter parsing
- Replace old comparators with chapter‑number–aware sorting
- Unify sort modes and simplify list handling
- Rewrite updateMangaDetail with URL‑based dedupe
- Preserve read state across scanlators
- Update existing chapters instead of recreating
- Only create Update entries for new unread chapters
- Recompute smartUpdateDays using combined chapter list
- Remove outdated reversed/index‑based logic
2026-04-24 19:00:10 +02:00
NBA2K1
0a2c8e2649 rename files manga.dart and chapter.dart 2026-04-23 18:53:25 +02:00
NBA2K1
148943093f Move String Extension to correct place 2026-04-21 22:59:12 +02:00
NBA2K1
a381e7baa7 Fix Exception
- Replace synchronous Isar writes with async transactions in `AboutScreen`
- Make `AppLogger.init()` and `dispose()` fully async and guarded with `_busy`
- Remove `StreamController` queue and write directly to the IOSink
- Prevent double‑initialization and race conditions using `_initialized` + `_busy`
- Update log toggle handler to await logger init/dispose for consistency

Fix following Exception when disabling and re-enabling logger:

```
Exception has occurred.
StateError (Bad state: Stream has already been listened to.)
```
2026-04-21 21:45:40 +02:00
Moustapha Kodjo Amadou
6fe1b8e844 Refactor chapter navigation and improve page indicator responsiveness 2026-04-21 16:52:43 +01:00
NBA2K1
47ed3cbef9 Update manga.dart
implement suggestion by Copilot.

https://github.com/kodjodevf/mangayomi/pull/703#discussion_r3093233947
2026-04-16 16:43:06 +02:00
NBA2K1
45a6633344 Update manga.dart
implement suggestion by Copilot.

https://github.com/kodjodevf/mangayomi/pull/703#discussion_r3093233926
2026-04-16 16:36:45 +02:00
NBA2K1
6aef999fd1 move extensions to correct files 2026-04-15 23:41:19 +02:00
NBA2K1
09a4517d33 Fix reader 2026-04-15 22:08:54 +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
f8dda0a07c refactor: enhance headers function for mihon source 2026-04-06 13:03:41 +01:00
NBA2K1
820b4d468e Add slider to change backup file compression 2026-04-05 19:06:12 +02:00
Moustapha Kodjo Amadou
2e102f9db9 Update dependencies, refactor HTTP client handling and fix dart extension header handling 2026-04-03 12:13:11 +01:00
Moustapha Kodjo Amadou
566da0ae06 feat: implement multiple bug fixes and feature requests\n\n- #339: Remember window size/position on desktop (WindowGeometry utility)\n- #256: Add S key shortcut to skip intro in desktop anime player\n- #372: Auto-delete downloaded chapters after reading (new setting + toggle)\n- #402: Fix manhwa reader scroll jumps by caching image dimensions for placeholders\n- #608: Fix 'Fit width' scale type cropping pages in paged reader mode\n- #572: Add mouse back button navigation support on desktop" 2026-03-17 14:31:21 +01:00
Moustapha Kodjo Amadou
95a55d5f81 feat: Implement upcoming manga calendar feature
- Added UpcomingUIModel for managing upcoming manga list items with headers and items.
- Introduced CalendarDay widget to display individual days with event indicators.
- Created CalendarHeader widget for navigating between months.
- Developed CalendarIndicator for visualizing events on specific days.
- Implemented UpcomingCalendar to manage the calendar view and event loading.
- Added UpcomingItem widget for displaying individual upcoming manga with cover images.
- Introduced FetchInterval utility to calculate fetch intervals based on chapter upload dates.
- Refactored updateMangaDetail to utilize FetchInterval for smart update days.
- Enhanced MedianExtension to ensure correct median calculation.
- Removed unused imports and commented-out code for cleaner implementation.
2026-03-05 12:05:29 +01:00
Moustapha Kodjo Amadou
1256e608c7 Refactor 2026-03-02 11:49:19 +01:00
Moustapha Kodjo Amadou
eec96c6258
Merge pull request #644 from NBA2K1/main
Improve extension service lifecycle, isolate robustness, dedupe lists, and UI/lifecycle cleanups
2026-02-13 10:50:32 +01:00
Schnitzel5
ac21eae8d4 small adjustments for a better reading experience of many single pages in a row
- to prevent old entries (before sourceId was introduced) from accidentally using conflicting sources with the same name even if they are not installed
2026-01-30 23:15:26 +01:00
NBA2K1
8b1f7fc581 Add service disposal and lifecycle cleanup
This commit improves memory management, reduces redundant interpreter
instantiation, and standardizes service usage patterns.

- Add `dispose()` to `ExtensionService` interface and implement it across
  Dart, JS, LNReader, and Mihon services.
- Replace repeated interpreter creation in `DartExtensionService` with a
  persistent `_interpreter` instance initialized once in the constructor.
- Add disposal logic for JS DOM selector and Cheerio instances to prevent
  memory leaks.
- Introduce `withExtensionService()` helper to ensure services are always
  disposed after use.
- Update call sites across the codebase to use `withExtensionService()`
  or manual try/finally disposal.
- Improve isolate service message handling by extracting `responsePort`
  earlier.
- Ensure safer defaults (e.g., returning empty lists, const lists) when
  service calls fail.
2026-01-13 01:11:19 +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
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
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
Moustapha Kodjo Amadou
e342fe16fb
Merge pull request #632 from NBA2K1/path-optimizations
Path optimizations
2025-12-18 17:09:33 +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
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
Moustapha Kodjo Amadou
749b35083e Initialize rpcShowReadingWatchingProgress to false 2025-11-08 23:57:32 +01:00
Moustapha Kodjo Amadou
b42e0ad4bd + 2025-11-08 23:43:01 +01:00
Moustapha Kodjo Amadou
93a17cc797 Enhance DOM extension methods with additional pseudo-selector handlers and improve nth-child logic 2025-10-30 14:24:43 +01:00
Moustapha Kodjo Amadou
430e81e021 Refactor and update dependencies for Isar and Riverpod 2025-10-29 13:08:42 +01:00
Schnitzel5
05d0ddf0d6 reworked local source
- allow multiple local folders
- added support for scanning .epub novels
- added metadata,json support
- scanned entries now appear in browse screen instead of the default library category (can be added to library)
2025-09-04 23:02:27 +02: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
Moustapha Kodjo Amadou
40a0e080f9
Merge pull request #567 from Schnitzel5/logger
add option to download online subtitles
2025-08-27 09:09:54 +01:00
Moustapha Kodjo Amadou
334fe2f86a
Merge branch 'main' into tracker/simkl 2025-08-27 09:05:45 +01:00
Schnitzel5
f6c2a24af2 added app logger 2025-08-26 22:07:49 +02:00
Schnitzel5
809db56b35 adjusted tracker icons 2025-08-25 19:08:50 +02:00
Schnitzel5
31338eb023 final change: Trakt.tv icon 2025-08-25 14:58:18 +02:00