Skip to content

fix: start timed unblocks at iOS's activity limit and show unblock errors - #113

Merged
ykisana merged 1 commit into
mainfrom
fix/show-default-unblock-errors
Nov 17, 2026
Merged

ykisana merged 1 commit into
mainfrom
fix/show-default-unblock-errors

Conversation

@ykisana

@ykisana ykisana commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Problem

When iOS refuses to register a timed unblock's timer, the unblock fails:

  • Home, the group card, and the widget and shortcut link handler: with the default duration, nothing is shown (catch {} / try?). The key check passes and apps stay blocked.
  • Duration sheet: shows iOS's raw error, "This application is monitoring excessive activities".

The usual cause is excessiveActivities: iOS only allows 20 schedules and timers per app. Schedules can't be turned off while anything is blocked, so there was nothing the user could do.

Fix

  • At the limit, the unblock still starts. TimedUnblockService returns UnblockTiming.mayEndLate instead of throwing. The unblock is saved without its own timer, and the monitor re-blocks it at the next :00 or :30 heartbeat. The heartbeat is registered before schedules, so it's never the one refused. While Normal is open, its in-app timer re-blocks on time.
  • Only when the heartbeat is registered. A phone that already had 20 activities when it updated from 1.5 or earlier (no heartbeat then) has no slot for it. Nothing would re-block an unblock there until Normal is opened, so at the limit without the heartbeat the unblock still fails, as before.
  • Home, the group card, the link handler and the duration sheet then show "Unblocked: iOS only tracks 20 schedules and timers at once, so this unblock may end up to 30 minutes late."
  • Other failures (e.g. unauthorized) show "Couldn't Unblock" with the error's description, instead of failing silently.
  • Shared alert: both cases use the new unblockAlert modifier (View+UnblockAlert.swift). The group card's alert is hosted on GroupsView, the same as its duration sheet.
  • Shortcuts: at the limit (with the heartbeat registered) they now unblock instead of throwing. They show no dialog on success, so they don't mention ending late.

Test-only launch arguments:

  • -uiTestTimerLimitReached: the UI-test activity center throws excessiveActivities for timed-unblock activities.
  • -uiTestTimedUnblockFails: same, with unauthorized.
  • -uiTestSlowScan: the QR stub waits 1 s, like a real scan. With the instant stub, a cold link launch finished the scan while the key sheet was still presenting, and the alert was dropped.

Tests

Unit:

  • At the limit, startMain returns .mayEndLate, saves the unblock and registers no timer for it.
  • At the limit without the heartbeat, startMain throws and saves nothing. With 20 schedules carried over and no heartbeat, Unblock All throws and apps stay blocked.
  • An all-apps unblock at 10:01 at the limit is re-blocked when the monitor wakes at the 10:30 heartbeat.
  • A Shortcut unblock at the limit succeeds. The existing failure test now uses unauthorized.

UI:

  • testDefaultDurationUnblockAtTheTimerLimitSaysItMayEndLate and testDurationSheetUnblockAtTheTimerLimitSaysItMayEndLate. They seed a schedule so the heartbeat is registered, as on a phone at the limit.
  • testFailedDefaultDurationUnblockShowsError, testFailedDefaultDurationGroupUnblockShowsError and testFailedUnlockLinkShowsError. Before the fix all three failed ("should say so").

Results:

  • Full UI suite, iPhone Air iOS 27.0: 47/47.
  • Full unit suite: 884/884. The two no-heartbeat tests fail without the guard.

Caveat: on a locked phone, heartbeat callbacks have been measured up to ~15 minutes late, so "up to 30 minutes" can stretch further.

Note: on the iOS 27 simulator, XCUIApplication.open(URL) force-quits and relaunches the app, so link UI tests start from fresh in-memory state. The existing link tests are affected too; that's left for a separate change.

@ykisana
ykisana force-pushed the fix/show-default-unblock-errors branch from 31b411e to c862dd9 Compare November 15, 2026 23:20
@ykisana ykisana changed the title fix: show an error when an unblock with the default duration fails fix: start timed unblocks at iOS's activity limit and show unblock errors Nov 15, 2026
…rors

At iOS's 20 schedules-and-timers limit, a timed unblock now starts without
its own timer and the monitor re-blocks it at the next :00/:30 heartbeat.
The app says it may end up to 30 minutes late. This only applies when the
heartbeat is registered; without it (a phone that filled every slot before
1.6) nothing would re-block the unblock, so it still fails.

Other failures to start an unblock with the default duration now show
"Couldn't Unblock" instead of failing silently.
@ykisana
ykisana force-pushed the fix/show-default-unblock-errors branch from c862dd9 to 0c76e4a Compare November 16, 2026 12:58
@ykisana
ykisana merged commit 150a21f into main Nov 17, 2026
1 check passed
@ykisana
ykisana deleted the fix/show-default-unblock-errors branch November 17, 2026 03:51
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