Commit graph

108 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
Schnitzel5
ef8a90165e integrated ApkBridge for desktop 2026-04-04 23:05:51 +02:00
Moustapha Kodjo Amadou
74b194602c update dependencies & update riverpod provider declarations 2026-01-08 14:27:08 +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
Moustapha Kodjo Amadou
a8f78d41fb fix: update directory handling for macOS 2025-11-12 11:45:27 +01:00
NBA2K1
a307e9d049 Merge remote-tracking branch 'upstream/main' into Correct-directory 2025-10-29 18:30:50 +01:00
Moustapha Kodjo Amadou
430e81e021 Refactor and update dependencies for Isar and Riverpod 2025-10-29 13:08:42 +01:00
NBA2K1
e6b6fd6a92 Merge remote-tracking branch 'upstream/main' into Correct-directory 2025-08-30 00:33:31 +02:00
Schnitzel5
4d89cfe32b fixed Trakt refresh token
- now refreshes expired tokens at startup
- prevents accidental logouts for users who has the tracking screen as default navigation
2025-08-27 18:21:22 +02:00
Moustapha Kodjo Amadou
3a577a4c9e Add fixed versions packages of isar_generator and hive_generator to avoid the Analyzer plugin error 2025-08-25 13:21:37 +01:00
Schnitzel5
8f2fe123bf adjusted lua code 2025-08-04 00:13:23 +02:00
Schnitzel5
0fea3ab84e switched to lua scripts 2025-08-01 02:57:05 +02:00
Schnitzel5
4682ab3577 added custom buttons 2025-07-28 23:42:55 +02:00
Schnitzel5
1f0938fab9 adding custom buttons 2025-07-28 02:24:32 +02:00
Schnitzel5
38728ce0cb Merge branch 'temp/mpv-anime4k' into feature/mpv-anime4k 2025-07-24 22:31:58 +02:00
Schnitzel5
1450641f16 added mpv config for Anime4K 2025-07-24 22:25:14 +02:00
NBA2K1
cbeb70b79e edit comment 2025-07-24 16:58:21 +02:00
NBA2K1
0b83be6d7a Revert Android changes 2025-07-24 16:50:55 +02:00
NBA2K1
7245552ade Merge branch 'main' into Correct-directory 2025-07-24 13:01:42 +02:00
Schnitzel5
5932cf44f2 added sync for settings
- added option to toggle sync for history, update and settings
2025-07-21 23:37:51 +02:00
NBA2K1
5a18d5f0f0 storage permission
potentially fixes #430
2025-07-16 18:21:04 +02:00
NBA2K1
18d6079420 Why create and then delete BtDirectory?
Same as previous commit
2025-07-12 06:45:39 +02:00
NBA2K1
eb4f82f040 Why create and then delete TpmDirectory?
When deleteTmpDirectory() calls getTmpDirectory(), the directory is first being created and then it is being deleted.
Redundant operation.
2025-07-12 06:41:21 +02:00
NBA2K1
7d13a80a11 No need to make inspector nullable
why make it nullable, set a default value and then use a non-null-assertion (!)?
2025-07-12 06:38:57 +02:00
NBA2K1
1f423dd3ca typo 2025-07-12 06:05:52 +02:00
NBA2K1
609e8196db Update storage_provider.dart
to make the requestPermission() a little shorter. It's just optics. The logic stays the same.
2025-07-12 05:35:21 +02:00
NBA2K1
5e43cf0468 Do not create Mangayomi folder inside AppDir
macOS and iOS already create a separate "Mangayomi" folder. There is no need to nest the downloads and backup folders in another "Mangayomi" folder.
2025-07-12 05:34:18 +02:00
NBA2K1
4d564b9308 Put the database into its separate folder
On Android, iOS and macOS just like how it's done on Windows and Linux.
Before the database files were in the top directory.
2025-07-12 05:30:26 +02:00
NBA2K1
7e1eb44667 Fix #478 2025-06-04 16:21:14 +02:00
Moustapha Kodjo Amadou
4d27a2c0e3 fix #468 2025-06-02 11:41:12 +01:00
Moustapha Kodjo Amadou
80efee40d1 dart format 2025-05-30 17:43:42 +01:00
NBA2K1
6b81d0fc02 Update storage_provider.dart
- Move manageExternalStorage inside if (android), as it is Android only.
- Cache permission state, to only check for permission once per app start preventing redundant checks.
- Made `initDB` fully async to enhance efficiency and avoid sync operations
2025-05-26 15:37:09 +02:00
Moustapha Kodjo Amadou
b57683f1a1 fix 2025-05-11 15:22:22 +01:00
Schnitzel5
24c4c89418 Merge branch 'temp/epub' into feature/epub 2025-05-07 22:25:11 +02:00
Schnitzel5
3677938bf8 added support for epubs
embedded images not supported yet
2025-05-07 22:17:23 +02:00
NBA2K1
34206dbc42 storage_provider trim()
trim whitespace to prevent Exception
2025-05-02 13:02:50 +02:00
Schnitzel5
e2a862d30b limited the amount of downloading operations
+ fixed failed downloads caused by spaces in file path
2025-05-02 02:10:57 +02:00
NBA2K1
2698db6085 Reduce I/O operations
getMangaChapterDirectory() now accepts an optional mangaMainDirectory
to avoid calling getMangaMainDirectory() and thus getDirectory() twice in places where both methods are called successively.
2025-04-29 18:47:43 +02:00
Enbiya Olgun
3d69caa392 Remove duplicate code
Why wasn't getMangaChapterDirectory simply using getMangaMainDirectory?
2025-04-07 19:14:43 +02:00
Enbiya Olgun
6afe7c97f7 What happened here?
fixSeparator? Just directly use join...
2025-04-07 04:04:05 +02:00
NBA2K1
fcc6aa0f7f Localized messages are generated into source.
https://docs.flutter.dev/release/breaking-changes/flutter-generate-i10n-source
The flutter tool will no longer generate a synthetic package:flutter_gen or modify the package_config.json of the app.
Applications or tools that referenced package:flutter_gen should instead reference source files generated into the app's source directory directly.
2025-04-03 01:27:24 +02:00
Schnitzel5
17128cccbd added options to migrate sources and clean the database 2025-03-02 01:22:41 +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
3bc85cf5aa saving novel chapter progress + removed sync for now 2024-12-21 21:18:21 +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
f0cf52813a refactor: refactor extension services 2024-12-14 13:55:40 +02:00
Yegor Shovkun
adbd1529f7 fix: cs fix (reformat with 120 line length) 2024-12-14 12:38:56 +02:00