Skip to content

mobile: daily question on/off and time in Settings - #411

Merged
acharlop merged 4 commits into
mainfrom
mobile/364-daily-question-settings
Nov 7, 2026
Merged

acharlop merged 4 commits into
mainfrom
mobile/364-daily-question-settings

Conversation

@acharlop

@acharlop acharlop commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

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.

Light Dark
Notifications, switch on
Time page

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 (AsyncStorage whocards-notifications:daily-off, whocards-notifications:daily-hour; a corrupt hour falls back to DAILY_HOUR). refillDailyQuestions reads 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. notificationsAllowed is exported.
  • apps/mobile/src/components/daily-time-settings-page.tsx: a new pager page with 24 hour rows, following LanguageSettingsPage, and it scrolls the current hour into view. Whole hours only: no time-picker dep is installed, and @react-native-community/datetimepicker would 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; uses openNotificationSetting). 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 🔀).
  • Tests: notification-store.test.ts covers 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.tsx covers toggle off hides Time, the time page pick, the Allow row shown only when not allowed, and no Allow row while off. ui-snapshot-surfaces snapshots are updated, plus a new time-page snapshot.
  • pnpm check green locally.

Note

Add daily question on/off toggle and hour picker to mobile Settings

  • Lets users enable or disable the daily question and pick its hour (00:00–23:00) in SettingsModal, via a new daily-time settings page
  • notification-store.ts persists the enabled flag and hour, cancels all notifications when disabled, and schedules the daily prompt at the selected hour when permission is granted
  • Requests OS notification permission when enabling with undetermined status; the second-open permission prompt is skipped while the daily question is off
  • refillDailyQuestions now queues refills sequentially, so a rejected earlier refill does not block a later one
  • Risk: scheduling behavior changed in the refill helper — the daily window uses the stored hour instead of the fixed DAILY_HOUR default; existing installs without a stored hour still default to DAILY_HOUR

Macroscope summarized f345528.

RetriggerView in GreptileConfidence Score: 4/5

The PR appears safe to merge, with a non-blocking mismatch between the off choice and the launch permission prompt.

Findings

  1. P2 Off still triggers the prompt ▶

Summary

Adds daily-question controls to mobile Settings:

  • Players can turn daily questions off or choose when they arrive.
  • Settings points blocked daily questions to phone notification settings.

Non-blocking issue: the launch permission prompt ignores the new off choice.

acharlop explicitly 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]
Loading

Reviews (1) · Last reviewed commit: "mobile: daily question on/off and time i..." · Reviewed by Greptile

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
@netlify

netlify Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for whocards-app canceled.

Name Link
🔨 Latest commit f345528
🔍 Latest deploy log https://app.netlify.com/projects/whocards-app/deploys/6aeece18204bad7dae305684

@coderabbitai

coderabbitai Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Explain Change →

Caution

Review failed

The pull request is closed.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Tip

🎯 Customize your risk assessments

Guide how CodeRabbit assesses merge risk and security architecture risk. Highlight sensitive changes and explain your security boundaries using Merge Risk Instructions and Security Risk Instructions in your review settings. Security architecture risk assessments require the Advanced plan or above.

✅ Automatic approvals, with your rules

Let CodeRabbit approve pull requests once required threads are resolved, pre-merge checks pass, and your risk limits are met. Enable Automatic approvals in review settings, with overrides for teams or file paths.

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.

Share

@netlify

netlify Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for whocards-calmly canceled.

Name Link
🔨 Latest commit f345528
🔍 Latest deploy log https://app.netlify.com/projects/whocards-calmly/deploys/6aeece189574512c5e99bd01

Comment on lines +71 to +76
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()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Off still triggers the prompt

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.

@macroscopeapp

macroscopeapp Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Approvability

Verdict: Approved at a070572

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 f345528. Prior analysis still applies.

You can add or adjust custom eligibility rules. Learn more.

@acharlop

acharlop commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author

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.

@acharlop
acharlop enabled auto-merge (squash) November 6, 2026 23:25
@acharlop
acharlop disabled auto-merge November 6, 2026 23:25
@acharlop
acharlop enabled auto-merge (squash) November 6, 2026 23:37
@acharlop
acharlop merged commit 403bdd6 into main Nov 7, 2026
14 of 15 checks passed
@acharlop
acharlop deleted the mobile/364-daily-question-settings branch November 7, 2026 07:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Push: Settings section for daily question (on/off + time)

1 participant