Skip to content

Deep-link airing notifications to the media details page #111

Closed

Description

@zhollis21

Summary

Tapping an airing notification should open that anime's media-details page. Today the notification uses a generic launch intent, so a tap just opens the app to its home screen.

Split out from #106 (the episode-info text change landed there; deep-linking is tracked here).

Background

NotificationHelper.Show (src/AniSprinkles/Platforms/Android/NotificationHelper.cs) already has the mediaId at build time but wires a generic GetLaunchIntentForPackage PendingIntent. There is no intent-filter or deep-link routing.

Desired behavior

  • Tapping a notification routes to media-details for the notification's mediaId.
  • Works from both warm start (app already running) and cold start (process not running).

Implementation notes

  • Build a deep-link PendingIntent carrying the mediaId (extra or app://media-details?mediaId= URI) instead of the generic launch intent.
  • Add an intent-filter in AndroidManifest.xml (or handle the extra in MainActivity / App.CreateWindow).
  • Route via the existing Shell route: GoToAsync("media-details", new { mediaId }) (see AppShell.xaml.cs route registration + MediaDetailsPage.ApplyQueryAttributes).
  • Handle cold start: the navigation must run after Shell is constructed.

Constraint

  • Tapping an airing notification opens the correct media-details page from both cold and warm start.
  • Build clean.

References

Activity

  1. added
    enhancement
    UI/UX
    p4-low
    on Jun 27, 2026
  2. added a commit that references this issue on Aug 20, 2026
  3. zhollis21 commented on Aug 28, 2026

    @zhollis21
    OwnerAuthor

    Verification pass before kickoff. Checked against main (925d79f); facts only.

    Still unimplemented. git log --since=2026-06-27 on NotificationHelper.cs, MainActivity.cs and Platforms/Android/AndroidManifest.xml returns only 490fdd5, the Core extraction move. NotificationHelper.Show still builds its PendingIntent from GetLaunchIntentForPackage.

    No intent handling exists yet. Grepping the source (excluding obj/) for OnNewIntent, intent-filter and deeplink finds nothing. Platforms/Android/AndroidManifest.xml declares only the three uses-permission entries and the CustomTabs queries block — every intent-filter in the built manifest comes from MAUI/[Activity] defaults.

    MainActivity is LaunchMode.SingleTop (MainActivity.cs:13). A warm-start tap therefore arrives at OnNewIntent, which the class does not override today.

    The destination side is already in place. AppShell.xaml.cs:23 registers media-details → MediaDetailsPage, and MediaDetailsPage.ApplyQueryAttributes reads the id via QueryAttributeParser.ParseInt(query, "mediaId"). MediaDetailsPage also has a parameterless constructor that resolves from ServiceProviderHelper, so Shell can construct it.

    PendingIntent request code is already mediaId (NotificationHelper.cs:40), with UpdateCurrent | Immutable. Two episodes of the same media share a request code, so extras carrying only mediaId are unaffected by the update-in-place.

    Related: #141 is open against the same subsystem (moving the worker's pure logic into Core). It touches AiringCheckWorker.cs / AiringNotificationService.cs, which none of the work above touches.

  4. zhollis21 commented on Aug 28, 2026

    @zhollis21
    OwnerAuthor

    Kickoff decisions, agreed before any code.

    Payload: an explicit intent with an int extra, not a URI scheme. The implementation notes above offer either; neither actually needs an intent-filter, since both use an explicit PendingIntent to MainActivity and only the payload differs. The anilist.co URL option — routing through the AniListLinkTarget resolver added in #137 — was considered seriously now that it is on main, but it means synthesizing https://anilist.co/anime/{id} purely to parse it back into the int the worker already holds. The reuse it buys is one line of routing; the untestable Android code is identical either way, and it would couple notifications to the bio-link parser so that #12 landing manga routing changes notification behaviour as a side effect.

    Repeat taps push, not replace. Three notifications tapped in sequence gives three stacked details pages, and back walks them in reverse to the Library tab. Chosen for simplicity: the alternative needs a "what page am I on" check on the Android side, which is the part that cannot be unit-tested.

    The cold/warm split in the constraint above is too coarse. There are four states, and the middle one breaks a lifecycle-branched design:

    State Delivery Shell when the intent arrives
    Process dead OnCreate, savedInstanceState == null Does not exist
    Process alive, activity destroyed OnCreate, savedInstanceState != null May already be non-null
    Backgrounded, activity alive OnNewIntent Live, on whatever page the user left
    Foreground OnNewIntent while resumed Live

    ServiceProviderHelper's own remarks describe the second state as a real scenario here. So the drain is attempt-based and idempotent rather than branched on lifecycle: attempted when the intent arrives, again from AppShell's existing OnShellNavigated handler (whose first fire means Shell finished its initial route), and once more from OnResume as a backstop.

    Three things that fall out of that:

    1. Clear on success, not on read. MauiShellNavigationService.GoToAsync returns Task.CompletedTask when Shell.Current is null — it logs a warning and bails — so a caller cannot tell a no-op from a real navigation. The holder checks Shell readiness itself and clears only after navigating, or a cold-start attempt that lands early swallows the link silently.
    2. Stale intent replay. After a cold-start deep link, an activity recreation re-runs OnCreate with the same intent still attached and would re-navigate, pulling the user off wherever they had since browsed. Guarded by RemoveExtra after reading, SetIntent(intent) in OnNewIntent (Activity.Intent otherwise keeps returning the original launch intent), and a last-consumed nonce — for which the now-deterministic notification id from Airing notifications: parsing, pruning and title selection sit in the app project where no test can reach them #141 serves.
    3. CustomTabs sits in the task. The manifest declares a CustomTabsService queries block and auth uses a Custom Tab, so mid-sign-in there can be a Chrome tab above MainActivity. Flags are NewTask | ClearTop | SingleTop. Side effect: tapping a notification mid-OAuth pulls the user out of the sign-in tab.

    Nothing reads Activity.Intent today, so the SetIntent hygiene collides with nothing.

    Also on the device verification list, as untested interactions rather than things designed around: a tap while a CommunityToolkit popup is open, and back-from-cold-start landing on the Library tab rather than exiting.

    Being done on one branch with #141: feature/111-141-airing-notification-core-seams-and-deep-link.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    UI/UXenhancementp4-low

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions