Refactor code structure for improved readability and maintainability

This commit is contained in:
2026-04-19 00:46:00 +02:00
parent ce19d00de3
commit a11d88d365
14 changed files with 2947 additions and 76 deletions
+46 -11
View File
@@ -20,6 +20,37 @@ Multiplatform SwiftUI mail client scaffold for macOS, iPadOS, and iOS.
- an iPad simulator
- an iPhone simulator
## tsswift workflow
From the repo root:
```bash
corepack pnpm install
corepack pnpm swift:doctor
corepack pnpm swift:emulators
corepack pnpm swift:build
corepack pnpm swift:test
corepack pnpm swift:run
corepack pnpm swift:launch
corepack pnpm swift:review
```
This repo now uses `@git.zone/tsswift` with project config in `SocialIO/.smartconfig.json`.
- `build` targets macOS, iPhone Simulator, and iPad Simulator in parallel
- `test` targets macOS, which matches the current test bundle setup
- `run` defaults to macOS unless you pass `--platform ios` or `--platform ipad`
- `launch` starts the app with the configured control-file transport enabled
- `review` replaces the old shell-script review loop and captures screenshot sets for iPhone, iPad, and macOS
Useful direct commands:
```bash
corepack pnpm exec tsswift prefer-emulator --path SocialIO/SocialIO.xcodeproj --platform ios --udid <iphone-simulator-udid>
corepack pnpm exec tsswift prefer-emulator --path SocialIO/SocialIO.xcodeproj --platform ipad --udid <ipad-simulator-udid>
corepack pnpm exec tsswift command --path SocialIO/SocialIO.xcodeproj --route 'socialio://open?thread=launch-copy&message=launch-copy-2'
```
## App control contract
The app can be driven in three ways:
@@ -66,30 +97,34 @@ That gives us a mocked backend transport now, and we can swap the same command m
## Screenshot automation
After the app is built and installed in Simulator, run:
Single-platform capture examples:
```bash
/Users/philkunz/gitea/social.io-swiftapp/Scripts/capture-controlled-screenshots.sh booted /tmp/socialio-shots
corepack pnpm swift:screenshots:ios
corepack pnpm swift:screenshots:ipad
corepack pnpm swift:screenshots:macos
```
The script launches the app with `SOCIALIO_CONTROL_FILE`, rewrites that file with a series of routes, and saves screenshots for each destination.
The route list now lives in `SocialIO/Automation/ui-screenshot-routes.txt`.
## Standard UI review loop
For UI-affecting changes, use the one-shot verification script:
For UI-affecting changes, use:
```bash
/Users/philkunz/gitea/social.io-swiftapp/Scripts/verify-ios-ui.sh
corepack pnpm swift:review
```
That standard flow:
That flow now:
- builds the iPhone simulator app
- installs it into Simulator
- runs the backend-control screenshot pass
- saves the review set to `/tmp/socialio-ui-review`
- builds and captures an iPhone review pass
- builds and captures an iPad review pass
- builds and captures a macOS review pass
- saves the review set to `/tmp/socialio-ui-review/ios`, `/tmp/socialio-ui-review/ipad`, and `/tmp/socialio-ui-review/macos`
The screenshot list lives in `/Users/philkunz/gitea/social.io-swiftapp/Scripts/ui-screenshot-routes.txt`, so we can keep expanding the review set as the app grows.
Simulator selection is now handled through `tsswift emulators` and `tsswift prefer-emulator`, and the chosen devices are written into `SocialIO/.smartconfig.json`.
The macOS capture path still needs Accessibility and Screen Recording permission for the terminal app that runs the command, because `tsswift` positions the app window before each screenshot.
## UI test hooks