Commit graph

1932 commits

Author SHA1 Message Date
NBA2K1
3aa5c73dba Improve Performance
`_resize(fit)` was called on every Build.
`_resize` posts a WidgetsBinding frame callback unconditionally. If fit hasn't changed, this is wasted work.
2026-04-26 17:38:26 +02:00
NBA2K1
47f3296e9e Reduce Code Duplication in anime_player_view.dart
by extracting the helper methods `_seekTo()` and `_seekBy()`.
This also fixes a potential bug, where in line 1634 it was calculated
`skipDuration - _currentPosition.value.inSeconds` instead of the other way around.
That doesn't make sense. If currentPosition = 120 and skipDuration = 10, this becomes:
`_tempPosition = Duration(seconds: 10 - 120)`; so `= Duration(seconds: -110)`
A negative duration makes no sense as a UI indicator of a seek target.
2026-04-26 15:28:52 +02:00
NBA2K1
cc189fd4e3 Reduce Code Duplication in anime_player_view.dart
by extracting the same MPV Event Handler Boilerplate into a helper method.
2026-04-26 15:05:23 +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
d625b9c77d Improve EndOfMangaCard
When in vertical mode, it now shows the last_page icon pointing down,
2026-04-26 03:32:28 +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
29f202d31d remove redundant methods
`_getFilteredAndSortedChapters()` and `_filterAndSortChapter()` are duplicates of `getFilteredChapterList()` from MangaExtensions.
2026-04-26 03:25:59 +02:00
NBA2K1
8ac25750a2 Why reverse the reading list and then calculate -1 2026-04-25 00:15:13 +02:00
NBA2K1
3434a2b16e Add Copilot suggested change (3/3)
https://github.com/kodjodevf/mangayomi/pull/714#discussion_r3139743045
2026-04-24 22:23:57 +02:00
NBA2K1
519eb9d589
Add Copilot suggested change (2/3)
https://github.com/kodjodevf/mangayomi/pull/714#discussion_r3139743018

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-04-24 22:22:56 +02:00
NBA2K1
518b484a69 Add Copilot suggested change (1/3)
https://github.com/kodjodevf/mangayomi/pull/714#discussion_r3139743002
2026-04-24 22:21:41 +02: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
8adb8bee17 reduce memory usage
`chapters.length - chapters.reversed.toList().indexOf(chapters.reversed.toList()[finalIndex]) - 1;`
is just the same as
`chapters.length - 1 - finalIndex`
but it creates two lists, which is wasteful.
2026-04-24 00:50:22 +02:00
NBA2K1
0a2c8e2649 rename files manga.dart and chapter.dart 2026-04-23 18:53:25 +02:00
Moustapha Kodjo Amadou
67680cbfb9
Merge pull request #712 from NBA2K1/fix-logger-exception
Fix AppLogger Exception
2026-04-21 23:07:09 +01:00
Moustapha Kodjo Amadou
29e2068665
Merge pull request #711 from NBA2K1/main
Only init discordRPC when not in debugMode
2026-04-21 23:06:14 +01:00
Moustapha Kodjo Amadou
583ad3fa33
Merge pull request #710 from NBA2K1/fix-chapter-transition-page
Fix RenderFlex/RenderBox layout exceptions in ChapterTransitionPage on horizontal reading modes
2026-04-21 23:05:19 +01: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
NBA2K1
b87eecf6b6 Only init discordRPC when not in debugMode 2026-04-21 21:42:07 +02:00
NBA2K1
5104f6c19b Fix ChapterTransitionPage layout exceptions
The horizontal layout (_buildHorizontalLayout) used FittedBox as a
shared scaffold for both vertical and horizontal reading modes.
FittedBox passes unbounded width constraints to its child, which caused
RenderFlex to throw "children have non-zero flex but incoming width
constraints are unbounded" when Row + Expanded children were used.
This cascaded into a chain of "RenderBox was not laid out" assertions
all the way up through IntrinsicHeight, ConstrainedBox, FittedBox,
LayoutBuilder, and into the ScrollablePositionedList in
image_view_webtoon.dart.

Fix: split the two layout paths before they reach a scaffold widget.
The vertical path keeps FittedBox (safe, maxWidth is capped at 480px).
The horizontal path uses SizedBox(width: MediaQuery screenWidth) so
Row/Expanded always receive a finite width constraint.
2026-04-21 21:33:16 +02:00
GitHub Action
50ce9e6855 source update: v0.7.60 2026-04-21 16:30:19 +00:00
Moustapha Kodjo Amadou
853a9d599b v0.7.60 2026-04-21 17:05:15 +01:00
Moustapha Kodjo Amadou
8595d62c71
Merge pull request #703 from NBA2K1/fix-reader
Fix reader and Code Cleanup
2026-04-21 16:54:08 +01:00
Moustapha Kodjo Amadou
6fe1b8e844 Refactor chapter navigation and improve page indicator responsiveness 2026-04-21 16:52:43 +01:00
Moustapha Kodjo Amadou
7f0c69020d
Merge pull request #705 from NBA2K1/improve-manga-home-screen-performance
Improve performance of library, manga home, and tracker screens
2026-04-21 11:12:20 +01:00
Moustapha Kodjo Amadou
7bec3c551a Disable previous chapter preloading for optimization 2026-04-21 10:23:47 +01:00
Moustapha Kodjo Amadou
b5de2693ba Revert "Disable previous chapter preloading for optimization"
This reverts commit a0512564b4.
2026-04-21 10:08:33 +01:00
Moustapha Kodjo Amadou
a0512564b4 Disable previous chapter preloading for optimization 2026-04-21 09:58:45 +01:00
NBA2K1
07470c08c7 Add Copilot suggested change (3/3)
https://github.com/kodjodevf/mangayomi/pull/705#discussion_r3112086148
2026-04-20 18:47:05 +02:00
NBA2K1
0d64ca8875 Add Copilot suggested change (2/3)
https://github.com/kodjodevf/mangayomi/pull/705#discussion_r3112086120
2026-04-20 18:46:47 +02:00
NBA2K1
81a4893ad4 Add Copilot suggested change (1/3)
https://github.com/kodjodevf/mangayomi/pull/705#discussion_r3112086061
2026-04-20 18:46:20 +02:00
Moustapha Kodjo Amadou
03422887d0
Merge pull request #707 from Schnitzel5/fix/aniyomi-backup
updated grpc fields for Aniyomi backup
2026-04-20 17:10:00 +01:00
NBA2K1
af49eaee68 Make cards equal in size 2026-04-20 02:33:50 +02:00
NBA2K1
e68815bde2 Fix Overflow Exception 2026-04-20 01:09:48 +02:00
Schnitzel5
f1bc5f16a2 updated grpc fields for Aniyomi backup 2026-04-19 23:42:12 +02:00
NBA2K1
ef31d94e01 Use animatePageTransitions value 2026-04-19 21:10:12 +02:00
NBA2K1
519dd048ee Use width for minCacheExtent when in horizontal 2026-04-19 21:09:49 +02:00
NBA2K1
ee0f283cc3 Update manga_home_screen.dart
add a defensive guard as a safety net for any pre-existing duplicate records in users' databases.
2026-04-19 05:03:56 +02:00
NBA2K1
233ffa1b2c Update manga_image_card_widget.dart 2026-04-19 04:57:36 +02:00
Whiskas101
232ae8ea86 change: switch to async fetch for isar due to lag in large libraries 2026-04-19 02:19:41 +02:00
NBA2K1
98b3121c04 Move tracker lookup to parent
Replace per-card Isar tracking streams with a single subscription in
TrackerSectionScreen.

- Build a mediaId -> Track index at the screen level
- Pass resolved Track? into TrackerLibraryImageCard
- Convert TrackerLibraryImageCard to a plain StatelessWidget
- Remove StreamBuilder, ConsumerStatefulWidget, and keep-alive boilerplate
- Keep the same UI while reducing widget-level DB work

This follows the same parent-index pattern used elsewhere and makes
the tracker library view lighter and easier to maintain.
2026-04-19 01:48:59 +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
525eeea3ac Use shared library index for manga cards
Replace per-widget Isar StreamBuilder usage with a single shared
library index managed in MangaHomeScreen.

- Subscribe once to manga updates and build a name -> Manga map
- Pass libraryManga down to card widgets instead of querying per item
- Remove StreamBuilder logic from MangaImageCardWidget and list tile
- Use library data for cover, tracker image, and favorite state
- Add favorite overlay indicator based on libraryManga
- Clean up redundant filtering and improve performance

This reduces rebuild overhead and avoids multiple database listeners
per list/grid item.
2026-04-19 01:48:39 +02:00
NBA2K1
e6b10f7a97 Fix memory leak
`addListener` is called inside the `data:` callback of `build()`.
Every single time the widget rebuilds, which happens on scroll, on tab switch,
on any `setState`, it adds *another* listener to `_scrollController`,
stacking up indefinitely. With 100 items and active scrolling,
you can easily accumulate hundreds of listeners,
each one firing `setState` + `_loadMore()` on every scroll-to-bottom.

Fix: Move the listener setup to `initState()` and remove it in `dispose()`
2026-04-18 21:33:44 +02:00
Whiskas101
b670ac9e85 fix: removed unnecessary listeners created (.read instead of .watch) 2026-04-18 20:45:28 +02:00
Whiskas101
37e831fd4e fix: forcing keep alive causing memory leak 2026-04-18 20:43:54 +02:00
NBA2K1
1eed6fe01e add ordered prefetch to prioritize early pages 2026-04-18 20:15:03 +02:00
NBA2K1
0cfc8456b7 set _isNextChapterPreloading = false if it isn't 2026-04-17 17:21:49 +02: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