mirror of
https://github.com/stablyai/orca.git
synced 2026-10-18 16:03:17 +00:00
feat(mobile): default push notifications to off
Per App Store guideline 4.5.4 + Apple HIG, the iOS notification permission prompt should fire on user-initiated action, not opportunistically. Previously the toggle defaulted to true and the prompt fired the moment the desktop sent its first notification — reads as unsolicited. Now the toggle defaults to false; the OS prompt only fires when the user explicitly enables notifications in Settings → Notifications. Also fixes a brief 'on' flash on the Notifications screen before the saved preference loads. Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
@@ -13,7 +13,7 @@ import { ensureNotificationPermissions } from '../src/notifications/mobile-notif
|
||||
export default function NotificationsScreen() {
|
||||
const router = useRouter()
|
||||
const insets = useSafeAreaInsets()
|
||||
const [pushEnabled, setPushEnabled] = useState(true)
|
||||
const [pushEnabled, setPushEnabled] = useState(false)
|
||||
|
||||
useFocusEffect(
|
||||
useCallback(() => {
|
||||
|
||||
@@ -4,13 +4,18 @@ const PINS_PREFIX = 'orca:pins:'
|
||||
const PREFS_PREFIX = 'orca:prefs:'
|
||||
const NOTIF_KEY = 'orca:pushNotificationsEnabled'
|
||||
|
||||
// Why: default-off so the iOS notification permission prompt never
|
||||
// fires until the user explicitly opts in via Settings → Notifications.
|
||||
// Apple's review guideline 4.5.4 and HIG both prefer user-initiated
|
||||
// permission prompts; default-on would fire the prompt the moment the
|
||||
// desktop sent its first notification, which can read as unsolicited.
|
||||
export async function loadPushNotificationsEnabled(): Promise<boolean> {
|
||||
try {
|
||||
const raw = await AsyncStorage.getItem(NOTIF_KEY)
|
||||
if (raw === null) return true
|
||||
if (raw === null) return false
|
||||
return raw === 'true'
|
||||
} catch {
|
||||
return true
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user