Commit graph

1975 commits

Author SHA1 Message Date
Mehakdeep Singh
b42bceb6f9 fix(macos): host libmdbx DB under Application Support to avoid TCC permission denial on launch
On macOS, the libmdbx / Isar database lives under
`getApplicationDocumentsDirectory()` -> `~/Documents/...`. With iCloud
Drive's "Desktop & Documents Folders" sync enabled (a common default),
macOS protects ~/Documents with TCC and denies unsigned / sideloaded /
dev / not-yet-permission-granted builds the file access libmdbx needs
to open its database. The result is a black screen on launch with the
following error in the Flutter / app log:

    [ERROR:flutter/runtime/dart_isolate.cc(1402)] Unhandled exception:
    IsarError: Cannot open Environment: MdbxError (13): Permission denied

POSIX errno 13 is EACCES, raised by the OS for the access denial — not
errno 15 (ENOTBLK / "Block device required"), and not iCloud "Optimise
Mac Storage" evicting files. Verified on macOS 26.3 / Apple Silicon
with iCloud Desktop & Documents sync active: a Terminal `mkdir`+`echo
> file` to the same path succeeds (Terminal inherits the user's TCC
grant), but the unsigned dev build fails on first DB open with the
error above.

Fix: on macOS only, host the database under `getApplicationSupport-
Directory()` -> `~/Library/Application Support/<bundle id>/...`. That
location is app-private, not TCC-gated, and Apple's recommended
location for app data files. iOS, Windows, Linux are unchanged — they
keep using Documents (iOS for Files-app visibility next to backups,
Windows / Linux because Documents is the conventional location and
neither has TCC).

Includes a one-shot best-effort migration: existing macOS users with a
DB at `~/Documents/Mangayomi/databases/` have it renamed to the new
path on first launch. Migration is skipped if the new location is
non-empty so we never overwrite user data, and any failure falls back
to a fresh DB rather than crashing on launch (the user can then move
the legacy directory manually if needed). Subsequent launches skip the
migration branch because the new path already exists.

Repro
- macOS with iCloud Drive's "Desktop & Documents Folders" sync enabled
- Unsigned / sideloaded / dev build of Mangayomi (or signed build that
  hasn't yet received the user's "Files and Folders > Documents" TCC
  grant)
- Launch -> black screen, IsarError MdbxError (13)

Verification
- Reproduced the exact error on this branch's parent commit
  (upstream/main 25c1d72c) on macOS 26.3, iCloud Desktop & Documents
  sync active, captured `MdbxError (13): Permission denied`
- After this patch the same build launches cleanly and opens the
  database at `~/Library/Application Support/<bundle>/Mangayomi/
  databases/mangayomiDb.isar`
- Existing 15 MB Isar database from a prior run preserved through the
  rebuild — no data loss

Notes
- This is a narrower follow-up to the earlier proposed Application-
  Support move that was correctly rejected for being cross-platform
  and missing migration. This change is gated by `Platform.isMacOS`
  and migrates existing macOS users.
- Hive (`Hive.initFlutter` in main.dart) still uses Documents on
  macOS. It is initialized after Isar via `_postLaunchInit` and is
  unawaited, so a Hive failure wouldn't reproduce the black screen.
  If Hive turns out to be affected by the same TCC denial, a
  follow-up PR can move it the same way.
2026-05-09 22:09:53 -07:00
Moustapha Kodjo Amadou
25c1d72c8b
Merge pull request #721 from NBA2K1/improve-updates
Improve updates
2026-05-09 16:07:59 +01:00
Moustapha Kodjo Amadou
e2d67e7157
Merge pull request #722 from NBA2K1/fix-exception
Fix null pointer exception
2026-05-09 16:06:47 +01:00
Moustapha Kodjo Amadou
db4a777609
Merge pull request #720 from NBA2K1/fix-downloadedChapterIdsProvider
Fix downloadedChapterIdsProvider
2026-05-09 16:04:06 +01:00
NBA2K1
caab37f662 Fix null pointer exception 2026-05-09 15:03:26 +02:00
NBA2K1
1b630954b1 Remove BuildContext from checkForUpdate Provider
Do not pass Context into any provider.

Handle logic and BotToasts in the onTap of the AboutScreen, not inside the provider.

Also make _checkUpdate() more efficient, by fetching the `/latest` API.
Before, it was fetching 10 releases and immediately discarding 9, only leaving the latest.
2026-05-09 12:59:32 +02:00
NBA2K1
27690975f4 Make _updateLibrary() fully async
also make _updateNumbers() readable.
2026-05-09 12:59:12 +02: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
8914357d89 Fix downloadedChapterIdsProvider
Before the "Downloaded" filter in the library AND the "Downloaded chapters" badge would not update, unless you restart the app.

Now the "Downloaded chapters" badge is increasing and the "Downloaded" filter is showing new downloaded manga chapters and hiding deleted manga chapters.
2026-05-08 23:52:52 +02:00
Moustapha Kodjo Amadou
56ab6151e6 Update 2026-05-08 15:05:03 +01:00
Moustapha Kodjo Amadou
73a7528abf
Merge pull request #717 from NBA2K1/main
Improve _handlePageNavigation()
2026-05-04 11:51:13 +01:00
NBA2K1
3fe74f8883 Clean up _setReaderMode()
No logic difference. This refactor just makes the helper more readable.
2026-04-30 19:47:46 +02:00
NBA2K1
d6bc53ab1f Add comments to ReaderModeExtension 2026-04-30 19:23:00 +02:00
NBA2K1
ffe8dee065 Improve _handlePageNavigation()
The helper now handles every continuous reading mode, not just webtoon.
2026-04-30 17:32:15 +02:00
NBA2K1
456589ccfb Use ReaderModeExtension 2026-04-30 17:30:43 +02:00
GitHub Action
d8df3a361e source update: v0.7.70 2026-04-30 13:19:10 +00:00
Moustapha Kodjo Amadou
f5ebd01dc7 v0.7.70 2026-04-30 13:58:16 +01:00
Moustapha Kodjo Amadou
fe42b43cf8 Update Dart SDK version to 3.11.5 in pubspec files 2026-04-30 13:57:16 +01:00
Moustapha Kodjo Amadou
2ecd78283a
Merge pull request #716 from 5y3b/QoF-webtoon
Refactor page navigation handling in reader view
2026-04-30 13:08:46 +01:00
abdelmonm alsnajleh
bc19e2d7cb
Merge branch 'main' into QoF-webtoon 2026-04-30 14:25:01 +03: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
Abdelmonm Alsnajleh
0894b94767 Refactor page navigation handling in reader view
* Extracted page navigation to its own function
* Allow for better reading in webtoon mode
2026-04-27 20:14:24 +03:00
NBA2K1
8d5aa05952 Fix potential focus flicker
`wrapWithKeyboardListener` creates a `FocusNode()` internally on every call.
If no `focusNode` is passed, a new one is allocated every rebuild, which can cause focus flicker.
Without this fix, keyboard focus can be intermittently lost after widget rebuilds,
which would silently swallow keyboard shortcuts.
2026-04-27 00:08:15 +02:00
NBA2K1
ad4207da82 Add Copilot suggested change
https://github.com/kodjodevf/mangayomi/pull/714#discussion_r3144115142
2026-04-26 23:57:23 +02:00
NBA2K1
49eed6405e Add Copilot suggested change
https://github.com/kodjodevf/mangayomi/pull/714#discussion_r3144115192
2026-04-26 23:41:35 +02:00
NBA2K1
64d22741a5 Add Copilot suggested change
https://github.com/kodjodevf/mangayomi/pull/714#discussion_r3144115131
2026-04-26 23:33:14 +02:00
NBA2K1
262fb44792 Add Copilot suggested change
https://github.com/kodjodevf/mangayomi/pull/714#discussion_r3144115200
2026-04-26 23:26:01 +02:00
NBA2K1
bf25129b56 Reduce Code Duplication in novel_reader_view.dart
`ReaderKeyboardHandler` already does everything here.
2026-04-26 23:12:54 +02:00
NBA2K1
da2682aa48 Reduce Code Duplication
by extracting `hasPreviousChapter` and `hasNextChapter` logic to the `ChapterControllerMixin`.
2026-04-26 22:49:34 +02:00
Moustapha Kodjo Amadou
40d2455247
Merge pull request #715 from NBA2K1/Mark-duplicate-chapter-numbers-as-read
New Setting: Mark duplicate chapter as read
2026-04-26 21:25:04 +01:00
NBA2K1
8a2a57fbe5 Reduce Code Duplication in novel_reader_view.dart
Why duplicate the entire `ReaderAutoScrollButton` inside novel_reader_view.dart??
2026-04-26 21:55:00 +02:00
NBA2K1
b1459cffc1 Reduce Code Duplication in novel_reader_view.dart
Why duplicate the entire `ReaderAppBar` inside novel_reader_view.dart??
2026-04-26 21:50:22 +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
ffa8f15c88 ReaderModeExtension to Reduce Code Duplication 2026-04-26 19:12:56 +02:00
NBA2K1
c09eb5351d Reduce Code Duplication in reader_view.dart
extract helper method `_goToChapter()`, to reduce the code duplication in the `ReaderKeyboardHandler` and `ReaderBottomBar` call.
2026-04-26 17:45:02 +02:00
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
4a44dd6658 New Setting: Mark duplicate chapter as read
When this setting is turned on, the app will automatically mark chapters as read if they have the same chapter number as a chapter you've already read.

This is useful for sources where:

- multiple scanlators upload the same chapter number
- duplicate entries appear due to different naming formats
- a series has repeated or alternative releases of the same chapter

With the setting enabled, you won’t have to manually mark each duplicate as read.
2026-04-26 01:09:28 +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