Route iOS notification settings intent into the app

Request push notification permissions with provideAppNotificationSettings
so iOS surfaces an in-app notification settings button on the system
Settings screen. Since passing an options object opts out of the default
alert/badge/sound permissions, set those explicitly to preserve behavior.

Handle the resulting openSettingsForNotification callback in a new
NotificationSettings sub-module in expo-bluesky-swiss-army, which registers
a NotificationDelegate with expo-notifications' NotificationCenterManager
and converts the callback into a bluesky://settings/notifications deep link
that the existing linking config routes to the notification settings screen.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017BwQMxeGwza3oUcWSBNiKq
This commit is contained in:
Claude
2026-06-27 13:57:48 +00:00
committed by Samuel Newman
parent b8608ac03b
commit 38ba6e66c1
6 changed files with 97 additions and 6 deletions
@@ -10,6 +10,7 @@ Pod::Spec.new do |s|
s.static_framework = true
s.dependency 'ExpoModulesCore'
s.dependency 'EXNotifications'
# Swift/Objective-C compatibility
s.pod_target_xcconfig = {
@@ -0,0 +1,40 @@
import EXNotifications
import ExpoModulesCore
import UIKit
import UserNotifications
/*
* When we request push notification permissions with
* `provideAppNotificationSettings: true`, iOS adds an in-app notification
* settings button to the system Settings screen for Bluesky (and may surface
* it elsewhere, e.g. from a delivered notification). Tapping it launches the
* app and calls `userNotificationCenter(_:openSettingsFor:)`.
*
* expo-notifications owns the `UNUserNotificationCenter` delegate via its
* `NotificationCenterManager`, which fans that callback out to any registered
* `NotificationDelegate` through `openSettings(_:)`. We register here and turn
* the callback into a `bluesky://settings/notifications` deep link so the app's
* existing linking config routes the user to the notification settings screen.
*/
public class ExpoBlueskyNotificationSettingsModule: Module, NotificationDelegate {
public func definition() -> ModuleDefinition {
Name("ExpoBlueskyNotificationSettings")
OnCreate {
NotificationCenterManager.shared.addDelegate(self)
}
OnDestroy {
NotificationCenterManager.shared.removeDelegate(self)
}
}
public func openSettings(_ notification: UNNotification?) {
guard let url = URL(string: "bluesky://settings/notifications") else {
return
}
DispatchQueue.main.async {
UIApplication.shared.open(url, options: [:], completionHandler: nil)
}
}
}