Skip to content

The daily notification

Every day at 10:00 a.m. the phone shows one notification: Good morning, "Tap here to open your memories." A single tap on it opens the app. Nothing else is asked of the senior; there are no buttons in the notification and nothing to reply to.

Turning it on

The phone asks for permission the first time the app opens: iOS shows its own "Would Like to Send You Notifications" prompt. Whoever is setting up the phone taps Allow. iOS shows that prompt only once per install.

  • Allow: the notification is set for 10 a.m. from that day on.
  • Don't Allow: nothing is set, and the app cannot ask again. Settings then says "Turn on notifications for this app in the iPhone's Settings." Once they are turned on there, the notification is set the next time the app comes back to the screen.

Turning it off

Settings has a Daily notification at 10 a.m. switch, on by default. Turning it off takes the notification away; turning it on sets it again (and asks for permission, if iOS still can). It is saved on the phone, not per senior.

How it works

  • src/features/daily-notification/daily-notification.ts: syncDailyNotification reads the switch, asks for permission when iOS still can, and schedules a local notification with expo-notifications under one fixed identifier, daily-memories, on a daily trigger at 10:00. Scheduling again under that identifier replaces the one already set, so there is never more than one.
  • use-daily-notification.ts: useDailyNotification, mounted in the root layout, syncs when the app starts and each time it returns from the background. useDailyNotificationSetting drives the Settings switch and its note.
  • The time is the phone's own clock, so it follows the senior across time zones and daylight saving.
  • It is a local notification: no server, no push token, and it fires offline. The app does not log when it fires or is tapped.
  • While the app is open at 10 a.m., the notification is not shown; the senior is already in the app.
  • A tap opens the app where it was left. From a fresh start that is the start screen.
  • Tests: tests/daily-notification.test.tsx, with the mock in tests/helpers/notifications.ts.

Building it

Adding expo-notifications is a native change: it reaches Tom only in a new TestFlight build. Its config plugin (in app.config.ts) also adds the push entitlement (aps-environment), which EAS turns on for the App ID during the build. If the first build stops on "Failed to patch capabilities", start it once interactively from a terminal, as for the widget's App Group (Home screen widget).