Add gentle distraction nudges#290
Open
caezium wants to merge 1 commit into
Open
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
Distraction— rather than any URL/app blocklist. Nothing is ever blocked.ProductivityStatskeeps a trailing-window distraction total fresh from epochstart_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.UX / configuration
Distraction nudgestoggle, plusNudge after(how much distraction triggers it) andWait between nudges(cooldown). Stored in UserDefaults and read live.Files
DistractionNudgeService,ProductivityStats,ProductivityPreferences, and a small epoch-basedfetchTimelineActivityquery onStorageManager.NotificationService(nudge delivery + tap handling),AppDelegate(startup),SettingsOtherTabView+OtherSettingsViewModel.Builds against
main. Shares a smallProductivityStats/fetchTimelineActivityhelper with the companion focus Mini Timer change — if both land, that helper merges trivially.