Skip to content

Add configurable break allowances and reset policies - #512

Closed
michaelmvh wants to merge 1 commit into
awaseem:mainfrom
michaelmvh:feature/configurable-break-allowances
Closed

michaelmvh wants to merge 1 commit into
awaseem:mainfrom
michaelmvh:feature/configurable-break-allowances

Conversation

@michaelmvh

@michaelmvh michaelmvh commented Sep 2, 2026 •

Copy link
Copy Markdown

Add configurable break allowances and reset policies

Summary

Adds configurable break allowances that persist across focus sessions. Users can choose between a fixed allowance for each break or a shared cumulative time budget, configure how many breaks are available, and decide whether usage resets daily or only when manually reset.

User-facing changes

  • Add two break allowance modes:
    • Per Break — each break receives the configured duration.
    • Shared Budget — breaks consume time from one cumulative allowance.
  • Support break durations from 5 minutes through 24 hours.
  • Provide recommended duration choices and a custom hours/minutes picker.
  • Configure per-break limits using 1, 3, 5, 10, a custom amount, or unlimited breaks.
  • Add two reset policies:
    • Daily — reset allowances at a configurable time.
    • Never — preserve usage until it is manually reset.
  • Add a Reset Break Usage Now action for finite never-reset allowances.
  • Display remaining breaks, unlimited status, or remaining shared time on the active-session screen.
  • Redesign the break settings using native Settings-style rows, menus, checkmarked choices, and navigation-based custom controls.

Demo

foqos-break-allowances.mp4
Per-break allowance with a daily reset Shared budget without automatic resets
Per-break allowance settings Shared budget with manual reset

Remaining allowance during an active session
Active session showing the remaining break allowance

Allowance accounting

  • Store allowance usage by profile rather than by individual session.
  • Share accounting between the main app and Device Activity extension through the app-group store.
  • Consume finite per-break allowances when a break begins.
  • Record cumulative time when a break ends.
  • Prevent duplicate cumulative accounting when both the app and extension process the same completed break.
  • Correctly allocate cumulative usage when a break crosses its configured daily reset boundary.
  • Preserve never-reset usage across sessions until manually cleared.
  • Handle local calendar and daylight-saving-time reset boundaries.

Compatibility

Existing profiles retain their previous break behavior:

  • Profiles that previously allowed multiple breaks use the shared cumulative budget.
  • Other existing profiles use per-break behavior.
  • Profiles without an explicit reset policy default to daily resets.
  • The existing allowMultipleBreaks value remains available for persisted-profile and snapshot compatibility.

Documentation and diagnostics

  • Document the new allowance modes, duration range, and reset policies in the README.
  • Include allowance configuration and usage details in debug views and profile diagnostics.
  • Update guided-profile review summaries to describe the selected allowance and reset behavior.

AI Disclaimer

I’m a software engineer, but Swift and iOS development are not my primary stack. This PR was developed with the assistance of GitHub Copilot, powered by GPT-5.6 Sol. I reviewed the resulting behavior in the iOS Simulator, and the complete test target passes.

Testing

  • Daily reset-boundary calculation
  • Configurable finite break limits
  • Unlimited per-break allowances
  • Remaining-break counts
  • Shared cumulative budgets across sessions
  • Breaks spanning a daily reset boundary
  • 24-hour cumulative allowances
  • Never-reset per-break and cumulative usage
  • Manual usage resets
  • Idempotent cumulative recording
  • Historical usage reads
  • Existing-profile compatibility
  • Draft preservation of reset-policy settings

Run with:

DEVELOPER_DIR=/Applications/Xcode-beta.app/Contents/Developer make test

The complete foqosTests target passes.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@awaseem

awaseem commented Sep 2, 2026

Copy link
Copy Markdown
Owner

Most likely won't be merging this btw. Doesn't make sense, you can keep your fork and use that version of the app

@awaseem awaseem closed this Sep 2, 2026
@michaelmvh

Copy link
Copy Markdown
Author

Hey @awaseem thanks for taking a look. Would you mind elaborating on why you did not like this feature request? I'm looking for feedback in case I would like to contribute in the future

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.

2 participants