Startup route logic (reopen last project)#164
Merged
kirich1409 merged 1 commit intomainfrom Apr 17, 2026
Merged
Conversation
AppDelegate now lazily builds the root Store with a computed initial route. When reopenLastProject is on and ProjectRepository has a recent project, the app opens in main with that project; otherwise it shows Welcome. Logic is extracted into StartupRouteResolver for testability. Closes #148
There was a problem hiding this comment.
Pull request overview
Implements “reopen last project” startup routing by deriving the initial AppFeature.State.Route from settings + persisted recent-project data, and extracting the branching logic into a pure, unit-testable resolver.
Changes:
- Added
StartupRouteResolver/StartupDecisionto compute whether startup should show Welcome or reopen the last project. - Made
AppDelegatebuild the root TCA store lazily with a computed initial route and (optionally) send an.openProject(url)on launch. - Added unit tests covering the resolver’s decision branches and edge cases.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| MacApp/Relay/StartupRouteResolver.swift | Introduces pure resolver that maps (reopenLastProject, latestProjectPath) to a startup decision. |
| MacApp/Relay/AppDelegate.swift | Switches store initialization to lazy var, computes initial route, and attempts to dispatch pending .openProject. |
| MacApp/RelayTests/StartupRouteResolverTests.swift | Adds unit coverage for resolver behavior across main scenarios and edge cases. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This was referenced Apr 17, 2026
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.
Summary
.welcome.SettingsStore.reopenLastProjectis on andProjectRepositoryhas a recent project, the app opens in.mainand auto-sends.openProject(url); otherwise it shows Welcome.StartupRouteResolverso the three branches are unit-testable without SwiftData/UIKit.Files
MacApp/Relay/StartupRouteResolver.swift— new pure resolver (StartupDecision+resolve(reopenLastProject:latestProjectPath:)).MacApp/Relay/AppDelegate.swift—storebecomeslazy var; resolver output determinesAppFeature.State.Route; pending URL dispatched inapplicationDidFinishLaunching.MacApp/RelayTests/StartupRouteResolverTests.swift— 5 cases covering the 3 required scenarios plus two edge cases (empty-string path, false+empty).Test plan
swiftlint lint --strict— 0 violations (148 files)xcodebuild build— BUILD SUCCEEDEDxcodebuild test -only-testing:RelayTests— 22/22 unit tests pass (including 5 newStartupRouteResolverTests)RelayUITestsfailures are unrelated — they also fail on main (verified by reverting the change and re-runningtestOpenTerminal_newTab)Closes #148