Skip to content

iOS: keep foreground notifications in Notification Center (MOB-353) - #206

Merged
GenericJam merged 2 commits into
masterfrom
mob-353-notification-list
Oct 15, 2026
Merged

GenericJam merged 2 commits into
masterfrom
mob-353-notification-list

Conversation

@GenericJam

Copy link
Copy Markdown
Owner

Fixes MOB-353.

MobNotificationDelegate's willPresentNotification: (ios/mob_nif.m) completed with Banner | Sound. Without UNNotificationPresentationOptionList, iOS 14+ doesn't add a notification that arrived while the app was in the foreground to Notification Center, so once the banner timed out it was gone. Now Banner | List | Sound. No deployment-target impact: Banner is already iOS 14+, and every build path compiles mob_nif.m for iOS 17.0.

Verification: iOS 27 simulator (iPhone 17, D134E7BC), before and after. The delegate lives in mob_nif.m, which needs erl_nif, and test/native/ only compiles standalone headers, so the harness can't reach it. A harness test of the options constant would only restate the fix, so there is no automated test.

  • Host: a fresh mix mob.new --ios --blank app plus mob_notify (Hex), with :mob and mob_dir pointed at this branch. A button calls MobNotify.schedule(socket, delay_seconds: 3, …), and mount requests :notifications. Permission was granted on the sim.
  • This branch: with the app in the foreground, the screen got {:notification, %{presentation: :foreground, source: :local}} and the banner showed. After the banner went (~45 s), I opened Notification Center: the entry "MOB-353 foreground / Should stay in Notification Center — 1m ago" is there (screenshot taken).
  • origin/master (db44323), same host reinstalled: the same foreground delivery and banner. After the banner went, Notification Center was empty (screenshot taken).

Docs: guides/push_notifications.md says that on iOS a foreground notification stays in Notification Center. CHANGELOG under Unreleased.

Review: reviewer subagent (Codex rate-limited until 12:17 PM today): MERGE. One nitpick (a CHANGELOG sentence about Android overstated heads-ups), fixed.

willPresent answered Banner|Sound only. Without
UNNotificationPresentationOptionList, iOS 14+ does not add a notification
that arrived while the app was open to Notification Center, so once the
banner timed out it was gone. Add List.
@GenericJam
GenericJam force-pushed the mob-353-notification-list branch from 5d94293 to 3e45264 Compare October 15, 2026 17:18
@GenericJam
GenericJam merged commit d3021d3 into master Oct 15, 2026
4 checks passed
@GenericJam
GenericJam deleted the mob-353-notification-list branch October 15, 2026 17:21
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