Skip to content

fix(ios): Markdown reader can't be closed, shared files don't open into the Reader - #296

Merged
libravault-xyz merged 2 commits into
devfrom
fix/ios-markdown-close-and-redirect
Aug 19, 2026
Merged

libravault-xyz merged 2 commits into
devfrom
fix/ios-markdown-close-and-redirect

Conversation

@libravault-xyz

@libravault-xyz libravault-xyz commented Aug 19, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Build 35 tester feedback (R, via Messages, Dutch) surfaced two related iOS bugs, filed as #293 and #294 and both fixed here — see each issue for the full root-cause writeup.

#293 — can't close a Markdown document ("Ik kan een md niet sluiten?")

MarkdownReaderContent's center-tap toolbar toggle was .simultaneousGesture, which doesn't reliably win against the same view's .textSelection(.enabled) tap-to-place-cursor interaction. When the tap gets swallowed by text selection instead of reaching onCenterTap, ReaderView's navigation bar (hidden along with the rest of the toolbar) never comes back — no back button, no way out. Switched to .highPriorityGesture so the toggle always wins.

This also fixes #294 — shared-file redirect opens the Library, not the document ("de redirect is er nu.. maar die open libra.. niet de md zelf")

AppState.importSharedFile (triggered by .onOpenURL) copied the shared file into the Imported vault and reloaded the Library, but never navigated into the Reader for it. Added AppState.pendingImportedBook (mirrors the existing shouldNavigateToPlayer pattern) + a .navigationDestination(item:) on RootView, so a successful import now pushes straight into the document. Matched by the actual fileURL post-copy (not the original filename), since uniqueDestinationURL may have renamed it to avoid clobbering an existing file.

navigationDestination(item:) requires Hashable, not just Identifiable — added Hashable to BookItem/MediaFormat for that (caught by this PR's own iOS Simulator CI run, not by me — no local Xcode in the environment that wrote this).

Only one closing keyword above (Fixes #293) — this repo's PR-intake script only supports a single linked issue per PR (see .github/scripts/resolve_linked_issue.sh). #294 will be closed manually referencing this PR once it merges, since both bugs are fixed by the same small, tightly-coupled change.

Testing

  • Added AppStateFileImportTests coverage for pendingImportedBook: set on success, follows a renamed (name-collision) destination, stays nil on a failed copy.
  • No local Xcode/Simulator available in the environment that wrote this — this repo's macOS CI (iOS App Build & Test) is what actually compiles/runs LibraVaultTests/LibraVaultUITests here; watching that before merge.
  • [bug] iOS Reader: no way to close/exit once the toolbar auto-hides (center-tap swallowed on Markdown) #293's gesture-priority fix is a well-known SwiftUI workaround for .textSelection swallowing taps, but on-device behavior can't be confirmed from CI alone — worth a real-device retest by R once the next TestFlight build ships.
  • ReaderTapZoneTests (unchanged) still covers the tap-zone classification logic itself, which wasn't the bug.

Fixes #293

🤖 Generated with Claude Code

…to the Reader

Two bugs from build 35 tester feedback (Dutch, via Messages):

- "Ik kan een md niet sluiten?" (#293): once the immersive-toolbar toggle
  hides ReaderView's navigation bar (and its back button), the only way
  back is the center-tap gesture in MarkdownReaderContent. That gesture
  was attached as .simultaneousGesture, which doesn't reliably win against
  the same view's .textSelection(.enabled) tap-to-place-cursor interaction
  — so the tap can get swallowed and the toolbar never comes back.
  .highPriorityGesture forces the center-tap to resolve first.

- "de redirect is er nu.. maar die open libra.. niet de md zelf" (#294):
  opening a shared file via "Open in LibraVault" now correctly launches
  the app (onOpenURL -> importSharedFile), but importSharedFile only
  copied the file into the Imported vault and reloaded the Library list
  — nothing pushed the Reader for it. Added AppState.pendingImportedBook
  (mirroring the existing shouldNavigateToPlayer pattern) and a
  .navigationDestination(item:) on RootView so a successful import opens
  straight into the document, matched by the actual (possibly renamed by
  uniqueDestinationURL) fileURL.

Fixes #293
Fixes #294

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@libravault-xyz libravault-xyz added bug Something isn't working ios labels Aug 19, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📱 iOS Build Status: FAILED

❌ iOS Simulator Build & Unit Tests - failure
✅ Android Core Modules - success

iOS UI tests run in a separate, informational job and are not reflected above — check "iOS UI Tests (informational)" for those.

View run details

…n(item:)

CI's iOS Simulator build caught what local review missed (no Xcode available
in this environment): navigationDestination(item:) requires D: Hashable, not
just Identifiable. BookItem and its MediaFormat property pick up Hashable
conformance — a plain no-associated-values enum plus all-Hashable stored
properties, so synthesis is free.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

📱 iOS Build Status: PASSED

✅ iOS Simulator Build & Unit Tests - success
✅ Android Core Modules - success

iOS UI tests run in a separate, informational job and are not reflected above — check "iOS UI Tests (informational)" for those.

View run details

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working ios

Projects

None yet

1 participant