Repository navigation
mobile: daily question on/off and time in Settings - #411
Conversation
Notifications section gets a Daily question switch, a Time row (whole hours, default 18:00) and an Allow notifications link while the OS permission is off. Changes reschedule at once; off cancels every scheduled prompt. Closes #364
✅ Deploy Preview for whocards-app canceled.
|
|
Caution Review failedThe pull request is closed.
Tip 🎯 Customize your risk assessments
✅ Automatic approvals, with your rules
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
✅ Deploy Preview for whocards-calmly canceled.
|
| export const setDailySetting = async ({enabled, hour}: DailySetting): Promise<void> => { | ||
| await (enabled | ||
| ? AsyncStorage.removeItem(KEY_DAILY_OFF) | ||
| : AsyncStorage.setItem(KEY_DAILY_OFF, '1')) | ||
| await AsyncStorage.setItem(KEY_DAILY_HOUR, String(hour)) | ||
| await refillDailyQuestions() |
There was a problem hiding this comment.
If a user disables Daily question before their second app launch, recordOpenAndMaybeAsk still asks “Get a daily question?”. Choosing Yes requests permission but leaves daily questions disabled, so no notifications arrive. Have the launch prompt respect the saved setting, and add a test for this path.
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — Adds an on/off switch and hourly delivery-time selection for daily questions, retaining the existing default and OS permission controls. Effects are limited to local reminders, and the launch-prompt concern is addressed with a saved-setting guard and targeted test. No code changes detected at You can add or adjust custom eligibility rules. Learn more. |
…pen ask while off, and an empty stored hour means 18:00
|
Two-axis review: no blockers. Fixed in a070572: turning the switch on asks the OS if it never asked; the second-open "Get a daily question?" ask is skipped while the switch is off; an empty stored hour means 18:00; Allow row copy is now true whether the OS never asked or was denied. Open for Avi: whole hours only (no installed time picker; the usual one is native, so a store build). "Not now" on the second-open ask leaves the switch on. |
Settings → Notifications: Daily question on/off + Time (whole hours, default 18:00). Off cancels every scheduled prompt; a new time reschedules at once. OS permission off → "Allow notifications" row opens OS settings.
Shot on a070572, iPhone 18 Pro sim, iOS 27, notification permission granted (so no Allow row).
Closes #364 📋
For AI
apps/mobile/src/lib/notification-store.ts:getDailySetting/setDailySetting(AsyncStoragewhocards-notifications:daily-off,whocards-notifications:daily-hour; a corrupt hour falls back toDAILY_HOUR).refillDailyQuestionsreads the setting: if off, it cancels everything; otherwise it schedules at the stored hour. Runs are serialized so a quick off/on can't interleave a cancel with another run's scheduling.notificationsAllowedis exported.apps/mobile/src/components/daily-time-settings-page.tsx: a new pager page with 24 hour rows, followingLanguageSettingsPage, and it scrolls the current hour into view. Whole hours only: no time-picker dep is installed, and@react-native-community/datetimepickerwould be a native module (store build).settings-modal.tsx: the Notifications section extends the #381 🔀 row. It shows the switch, a Time row (only while on) and an Allow row (only while on and the OS permission is not granted; usesopenNotificationSetting). An AppState listener re-checks permission and refills when the app returns to the foreground with the sheet open, so granting in OS settings takes effect without a relaunch. The section stays in the in-play sheet (#400 🔀).notification-store.test.tscovers the default; off cancels all and launch schedules none; a time change reschedules at the new hour; turning back on; off/on/off ends off; a corrupt hour.settings-modal.test.tsxcovers toggle off hides Time, the time page pick, the Allow row shown only when not allowed, and no Allow row while off.ui-snapshot-surfacessnapshots are updated, plus a new time-page snapshot.pnpm checkgreen locally.Note
Add daily question on/off toggle and hour picker to mobile Settings
refillDailyQuestionsnow queues refills sequentially, so a rejected earlier refill does not block a later oneDAILY_HOURdefault; existing installs without a stored hour still default toDAILY_HOURMacroscope summarized f345528.
The PR appears safe to merge, with a non-blocking mismatch between the off choice and the launch permission prompt.
Findings
Summary
Adds daily-question controls to mobile Settings:
Non-blocking issue: the launch permission prompt ignores the new off choice.
acharlopexplicitly acknowledged that light and dark screenshots are owed because another session held the simulator; this was not reported as a finding.Diagram
%%{init: {'theme': 'neutral'}}%% flowchart TD A[Change daily setting] --> B[Save enabled choice and hour] B --> C[Queue refill] D[Launch or return from OS settings] --> C C --> E{Daily question enabled?} E -->|No| F[Cancel scheduled notifications] E -->|Yes| G{OS permission granted?} G -->|No| H[Do not schedule] G -->|Yes| I[Replace window at chosen hour]Reviews (1) · Last reviewed commit: "mobile: daily question on/off and time i..." · Reviewed by Greptile