Route iOS notification settings intent into the app (#11003)

This commit is contained in:
Samuel Newman
2026-06-30 22:23:52 +03:00
committed by GitHub
parent de51ceb577
commit 52aaba4051
6 changed files with 97 additions and 6 deletions
+20 -1
View File
@@ -249,7 +249,26 @@ export function useRequestNotificationsPermission() {
return
}
const res = await Notifications.requestPermissionsAsync()
const res = await Notifications.requestPermissionsAsync({
ios: {
/*
* These three default to true when no argument is passed to
* `requestPermissionsAsync`, but passing an options object opts out of
* that default, so we have to set them explicitly to preserve the
* existing behavior.
*/
allowAlert: true,
allowBadge: true,
allowSound: true,
/*
* Adds an in-app notification settings button to the system Settings
* screen for Bluesky. When tapped, iOS calls back into the app, which
* we route to the in-app notification settings (see the
* NotificationSettings module in expo-bluesky-swiss-army).
*/
provideAppNotificationSettings: true,
},
})
ax.metric(`notifications:request`, {
context: context,
@@ -82,7 +82,19 @@ export function NotificationSettingsScreen({}: Props) {
const onRequestPermissions = async () => {
if (IS_WEB) return
if (permissions?.canAskAgain) {
const response = await Notification.requestPermissionsAsync()
const response = await Notification.requestPermissionsAsync({
ios: {
/*
* These default to true only when no argument is passed, so set them
* explicitly to preserve behavior alongside
* provideAppNotificationSettings.
*/
allowAlert: true,
allowBadge: true,
allowSound: true,
provideAppNotificationSettings: true,
},
})
queryClient.setQueryData(RQKEY, response)
} else {
if (IS_ANDROID) {