mirror of
https://github.com/anomalyco/hex.git
synced 2026-11-28 13:02:21 +01:00
Ryan decided Hex Mobile won't open other apps' URL schemes after the keyboard hands off to the Hex app: no return-to-app tricks, since they are an App Review risk and only worked for apps with a known scheme. Removed: - HostApp / HostAppCatalog (the curated scheme list) and the bridge's returnAppID / quickReturnApps settings. The stored App Group keys (settings.returnAppID, settings.quickReturnAppIDs) are just ignored; no migration. - KeyboardLaunchRequest's returnAppID and the URL's return= item. An older keyboard that still sends return= parses fine and it is ignored. - DictationController's auto-return: AutoReturnState, the URL opener, setReturnAppID, setQuickReturnApps, returnToHostApp, maybeAutoReturnAfterActivation, triggerAutoReturn, the ~1 s fallback task, noteSceneDidEnterBackground, and the attemptAutoReturn flags. - The app's Settings "Return to" row, its "Edit apps…" sheet (ReturnAppsSheet.swift), and the handoff screen's quick-jump app chips. - The dictation bar's return chip and its app tray, and the full keyboard Hex key menu's "Return to" row and page (with its return_app typing-log event). - The handoff-returning snapshot scene. Replaced by: the handoff screen's existing quiet "Swipe bar to return" cue over the home indicator, now shown whenever it records or a warm session is on (it used to hide while an auto-return was attempted). The rest of the handoff and warm-session flow is unchanged. Docs: ios/README.md (cold start, Hex key menu, proof limits) and ios/docs/typing-logs.md. Verified: xcodebuild test on an iPhone 18 Pro simulator (iOS 27.2): 220 tests, 1 skipped, 0 failures. The handoff test now checks the 10 s window alone, and the launch URL test checks that a legacy return= is ignored. Rendered --snap-state setup, warm, handoff-listening, handoff-no-home-bar, keyboard-cold and full-keyboard-style and checked them: no Return to row, chips or return trigger; the swipe cue shows on the handoff screen.
61 lines
2.4 KiB
Swift
61 lines
2.4 KiB
Swift
import SwiftUI
|
|
|
|
@main
|
|
struct HEXMobileApp: App {
|
|
@Environment(\.scenePhase) private var scenePhase
|
|
@State private var dictation = DictationController.shared
|
|
@State private var openedFromKeyboard = Self.initialOpenedFromKeyboard
|
|
@State private var showSetup = false
|
|
|
|
init() {
|
|
FullKeyboardSettings().applyLaunchArguments()
|
|
TypingLogSettings().applyLaunchArguments()
|
|
}
|
|
|
|
private static var initialOpenedFromKeyboard: Bool {
|
|
let args = ProcessInfo.processInfo.arguments
|
|
guard let idx = args.firstIndex(of: "--snap-state"), idx + 1 < args.count else {
|
|
return false
|
|
}
|
|
return args[idx + 1].hasPrefix("handoff-")
|
|
}
|
|
|
|
var body: some Scene {
|
|
WindowGroup {
|
|
if ProcessInfo.processInfo.environment["XCTestConfigurationFilePath"] != nil {
|
|
Color.clear
|
|
} else if let keyboardScene = KeyboardSnapshotStage.requestedScene {
|
|
KeyboardSnapshotStage(scene: keyboardScene)
|
|
} else if let fullKeyboardScene = FullKeyboardSnapshotStage.requestedScene {
|
|
FullKeyboardSnapshotStage(scene: fullKeyboardScene)
|
|
} else if let experimentsScene = ExperimentsSnapshotStage.requestedScene {
|
|
ExperimentsSnapshotStage(scene: experimentsScene)
|
|
} else if let hostedScene = HostedKeyboardConversationStage.requestedScene {
|
|
HostedKeyboardConversationStage(scene: hostedScene, dictation: dictation)
|
|
} else {
|
|
ContentView(
|
|
dictation: dictation,
|
|
openedFromKeyboard: $openedFromKeyboard,
|
|
showSetup: $showSetup
|
|
)
|
|
.onOpenURL { url in
|
|
guard let request = KeyboardLaunchRequest(url: url) else { return }
|
|
if case .setup = request {
|
|
openedFromKeyboard = false
|
|
showSetup = true
|
|
} else {
|
|
openedFromKeyboard = true
|
|
}
|
|
dictation.handleKeyboardLaunch(request)
|
|
}
|
|
.onChange(of: scenePhase) { _, phase in
|
|
if phase == .background {
|
|
openedFromKeyboard = false
|
|
} else if phase == .active {
|
|
dictation.endStaleLiveActivities()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|