Skip to content

fix(ios,android): keep title for untitled ToC entries, align overlays - #379

Open
ddfreiling wants to merge 2 commits into
Notalib:mainfrom
ddfreiling:fix/native-toc-title-fallback
Open

ddfreiling wants to merge 2 commits into
Notalib:mainfrom
ddfreiling:fix/native-toc-title-fallback

Conversation

@ddfreiling

@ddfreiling ddfreiling commented Dec 1, 2026 •

Copy link
Copy Markdown
Member

Summary

On iOS and Android the plugin takes title (and tocHref) for emitted locators from the matching ToC entry. A ToC Link.title is optional in RWPM, but the plugin assigned it unconditionally, so an untitled entry replaced the title already set upstream with nil/null. The media-overlay (sync narration) code had the same overwrite, and the two platforms disagreed on the initial item title and on how "no title" is exposed.

Native counterpart of #368 and #376 (web). Only affects ToC entries without a title.

Change

  • Locators: title = entry.title ?? existing on iOS (FlutterReadiumPlugin.swift, EPUBReaderView.swift, PDFReaderView.swift) and Android (ReadiumReader.kt: both EPUB paths and PDF). The Android tocHref path also no longer nulls the title when no ToC entry matches. tocHref handling is unchanged.
  • Media overlays: the same fallback where ToC titles are applied to overlay items (iOS FlutterMediaOverlay.swift, ReadiumExtensions.swift; Android ReadiumExtensions.kt, FlutterMediaOverlay.kt).
  • Android overlay locators emit title: null for "no title" instead of "" (FlutterMediaOverlayItem.syncTextLocator and skipToAudioLocator), matching iOS.
  • iOS overlay items now start from the reading-order title, as Android already did (sync narration and both guided-navigation paths).

Review notes

  • The iOS seeding is the one deliberate behavior addition: iOS overlay text locators now carry the reading-order title when the ToC has none for them, as on Android.
  • iOS still has no equivalent of Android's skipToAudioLocator title; not changed.
  • PDF: upstream PDF locators carry no title, so that change is for consistency only.

Verification

  • ./gradlew :flutter_readium:compileDebugKotlin :flutter_readium:testDebugUnitTest (existing tests): pass.
  • ktlint on the changed Kotlin files: the only finding is FlutterMediaOverlayItem.kt:215 (audioStart?: 0.0), which is already on main.
  • flutter build ios --no-codesign in example/: pass.
  • bin/changelog check: pass.

Not covered

  • No new unit test: the enrich functions live on the ReadiumReader singleton (needs an Android context and an opened publication) and there is no Swift test target. A regression test would need new scaffolding.
  • Not exercised at runtime (no untitled-ToC or sync-narration fixture run on a device or emulator).

ddfreiling and others added 2 commits December 1, 2026 13:29
A ToC entry's title is optional in RWPM. The plugin assigned it to the
locator unconditionally, so an untitled entry replaced the title that
the toolkit had already set with nil/null. Keep the existing title in
that case. tocHref handling is unchanged.

Native counterpart of Notalib#368 and Notalib#376.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Media-overlay items had the same unconditional ToC-title overwrite as
the locator paths. Android replaced the reading-order title with an
empty string for an untitled ToC entry, and exposed "" instead of null
on the text and audio locators. iOS never started from the
reading-order title at all.

Keep the existing item title when a ToC entry has none, emit null
instead of "" on the Android locators, and seed iOS overlay items with
the reading-order title as Android does.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@ddfreiling ddfreiling changed the title fix(ios,android): keep locator title when ToC entry has none fix(ios,android): keep title for untitled ToC entries, align overlays Dec 1, 2026

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant