Skip to content

Preserve Welcome choices across Accessibility reauthorization - #1862

Open
dank-openai wants to merge 1 commit into
rxhanson:mainfrom
dank-openai:dank/wip/rectangle-welcome-upstream
Open

dank-openai wants to merge 1 commit into
rxhanson:mainfrom
dank-openai:dank/wip/rectangle-welcome-upstream

Conversation

@dank-openai

Copy link
Copy Markdown
Contributor

Summary

  • Show Welcome only while first-launch onboarding is pending, preserving returning users' shortcut and repeated-action choices after Accessibility reauthorization.
  • Keep Welcome pending across an exit before the first permission grant, including when permission is already granted at restart.

Problem solved

The new-permission callback opens Welcome unconditionally. For example, a returning user who chose Resize can reauthorize Rectangle, see Welcome again, and select Recommended, changing the saved choice to Across Monitor.

Save that Welcome is pending before version bookkeeping records the first launch, so exiting before permission is granted does not suppress Welcome on restart. Both newly granted permission and an already-trusted launch check that pending state. Clear the marker after the Welcome callback returns. Existing installations retain their preferences without a migration.

Validation

  • Added three focused regression tests: returning-user Resize preservation, new-user Welcome, and interrupted first launch. The latter two exercise both authorization paths.
  • All three pass. Restoring the old authorization handling reopens Welcome for returning users and skips it for new or interrupted first launches when permission is already granted. Preventing creation of the pending marker also makes the new-user and interrupted-launch tests fail.
  • Unsigned Debug application and focused test builds pass. The focused test bundle was built with EXCLUDED_SOURCE_FILE_NAMES=RectangleTests.swift: that existing file has an unrelated outdated setFrame override that prevents the full suite from compiling. No exclusion or unrelated test repair is included in this PR.
  • Tests use isolated UserDefaults suites and fake authorization and Welcome callbacks. The returning-user test models selecting Recommended without opening UI. Restart is simulated by recreating the controller and preferences object; real process restart, Accessibility permission, and modal UI were not exercised.

@dank-openai
dank-openai marked this pull request as ready for review September 18, 2026 19:31
@dank-openai

Copy link
Copy Markdown
Contributor Author

This issue cropped up while I was developing, so I found it useful to fix it.

@rxhanson

Copy link
Copy Markdown
Owner

Thanks for the follow-on.

To keep it simpler, I think we could instead add this to the beginning of the showWelcomeWIndow function:

        if Defaults.hasShownWelcomeWindow.enabled {
            return
        }
        Defaults.hasShownWelcomeWindow.enabled = true

And add that BoolDefault to Defaults.

    static let hasShownWelcomeWindow = BoolDefault(key: "hasShownWelcomeWindow")

There isn't a need to make that part unit testable, in my opinion, so we could get by with this simple change.

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