feat(train): Halkyon Train's shell, Todo's copied and renamed (ADR 0030, D12)

apps/train with halkyon_train_server, _client and _flutter, as Todo's:
halkyon_base configured by trainBase(), its own register alone and a
member of the instance's where the operator names one, the app on
halkyon_app's gates with Train's frame, account sheet and About, texts
in British English and German that speak of workouts, app.halkyon.train
on Android, iOS, Linux, macOS and Windows.

Where it differs from Todo: development ports of its own (8180 to 8190),
so it runs beside Learn's server; one initial migration with the schema
Todo's migrations end at (the same tables, compared line by line), not
Todo's seventeen; and Todo's icon as a placeholder until the icon tool
of ADR 0031 draws Train's bike. The workspace, the licences, the READMEs
and AGENTS.md name it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
Tizian 「ティツィアーン」 2026-10-28 10:26:49 +01:00
commit 7b5fbee913
Signed by: raisondetredev
GPG key ID: 07F6FCF405488B64

View file

@ -0,0 +1,49 @@
import Cocoa
import FlutterMacOS
class MainFlutterWindow: NSWindow {
/// The channel halkyon_app's SecretScreen asks to keep the window out of
/// screenshots and screen recordings while something secret shows (the
/// recovery phrase, recovery codes, an authenticator's key), and how many
/// show: counted, as several may at once.
private var screenGuard: FlutterMethodChannel?
private var secretsShown = 0
override func awakeFromNib() {
let flutterViewController = FlutterViewController()
let windowFrame = self.frame
self.contentViewController = flutterViewController
self.setFrame(windowFrame, display: true)
RegisterGeneratedPlugins(registry: flutterViewController)
guardScreen(messenger: flutterViewController.engine.binaryMessenger)
super.awakeFromNib()
}
private func guardScreen(messenger: FlutterBinaryMessenger) {
let channel = FlutterMethodChannel(
name: "app.halkyon/screen_guard", binaryMessenger: messenger)
channel.setMethodCallHandler { [weak self] call, result in
guard let self = self else {
result(nil)
return
}
switch call.method {
case "hold":
self.secretsShown += 1
self.sharingType = .none
result(nil)
case "release":
self.secretsShown = max(0, self.secretsShown - 1)
if self.secretsShown == 0 {
self.sharingType = .readOnly
}
result(nil)
default:
result(FlutterMethodNotImplemented)
}
}
screenGuard = channel
}
}