Skip to content

Add gentle distraction nudges#290

Open
caezium wants to merge 1 commit into
JerryZLiu:mainfrom
caezium:feature/distraction-nudges
Open

Add gentle distraction nudges#290
caezium wants to merge 1 commit into
JerryZLiu:mainfrom
caezium:feature/distraction-nudges

Conversation

@caezium

@caezium caezium commented Jun 23, 2026

Copy link
Copy Markdown

What

Adds an optional, non-blocking distraction nudge: when you've spent more than a configurable amount of time distracted within a recent trailing window, Dayflow posts a local notification gently suggesting a reset.

How it works

  • It leans on the existing AI categorization — time on cards classified as Distraction — rather than any URL/app blocklist. Nothing is ever blocked.
  • A background service re-evaluates on a light cadence; ProductivityStats keeps a trailing-window distraction total fresh from epoch start_ts/end_ts. When the total crosses the threshold and the cooldown has elapsed (and you're recording, not paused, not idle), it fires a single local notification.
  • Because analysis is batched (~15 min), a nudge naturally lags real time by about a batch — it's a gentle reminder, not a real-time blocker.

UX / configuration

  • On by default, with a cooldown so it never spams.
  • Settings → Other: Distraction nudges toggle, plus Nudge after (how much distraction triggers it) and Wait between nudges (cooldown). Stored in UserDefaults and read live.

Files

  • New: DistractionNudgeService, ProductivityStats, ProductivityPreferences, and a small epoch-based fetchTimelineActivity query on StorageManager.
  • Touched: NotificationService (nudge delivery + tap handling), AppDelegate (startup), SettingsOtherTabView + OtherSettingsViewModel.

Builds against main. Shares a small ProductivityStats/fetchTimelineActivity helper with the companion focus Mini Timer change — if both land, that helper merges trivially.

Adds an optional, non-blocking nudge: when you've spent more than a
configurable amount of time distracted within a recent trailing window,
Dayflow posts a local notification suggesting a reset. It relies on the
existing AI categorization (cards classified as Distraction) rather than
any URL/app blocklist, and never blocks anything.

- On by default; a cooldown enforces quiet time between nudges.
- Configurable in Settings > Other: 'Nudge after' (distraction threshold)
  and 'Wait between nudges' (cooldown). Backed by UserDefaults, read live.

New: DistractionNudgeService, ProductivityStats (trailing-window distraction
aggregation over epoch start_ts/end_ts), ProductivityPreferences, and a
small fetchTimelineActivity query. Touches NotificationService (nudge
delivery + tap handling), AppDelegate (startup), and Settings.
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.

1 participant