mirror of
https://github.com/anomalyco/hex.git
synced 2026-11-28 13:02:21 +01:00
* iOS: add a Greeklish experiment for Greek dictation
Greeklish writes Greek dictation in Latin letters before the rest of the
pipeline, like Hinglish does for Hindi: accents are stripped, digraphs and
letters are transliterated by rule, and a diaeresis keeps vowels apart.
It is off by default under Settings > Experiments (experiments.greeklish,
--experiment-greeklish), applies only to Greek (el / el-GR), renames Greek in
the language menus and offers it on the keyboard's quick switch. A dictation
that translates keeps its Greek letters, as Hinglish keeps Devanagari, and is
romanized only when it goes in as spoken. The app, its keyboard handoff and
in-keyboard dictation all read the same App Group setting.
* iOS: fix Greeklish punctuation, one-letter caps, and Greek ranges
Speak Greek question marks and ano teleia are usually normalized to a plain
";" and "·", so a ";" directly after a Greek letter now becomes "?" and a
"·" directly after one becomes ";", while both stay as written after Latin.
A one-letter Greek word only takes its capital ("Θ' αργήσω" -> "Th'
argiso"), instead of reading as all caps. The Greek letter test now covers
only the Greek block's letters (not Coptic or U+03F6) and the polytonic
letters (not its spacing marks), and the Greeklish tests move to their own
file.
* iOS: read Greek letter variants and document Greeklish
Greeklish reads the variant Greek letters fonts and keyboards produce (ϐ ϑ ϕ
ϖ ϰ ϱ ϲ ϵ) as their base letters, the feature map lists the experiment beside
Hinglish, and the test settings use their own suite and clean it up.
* iOS: split the Experiments body so it type-checks
Adding the Greeklish row pushed the Experiments page's one modifier chain past
what the Swift compiler would type-check in reasonable time. Split it into a
page and three short chains, with no behavior change.
74 lines
3.1 KiB
Swift
74 lines
3.1 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 = SettingsSnapshotFixture.showsSetupSheet
|
|
@State private var openPage: SettingsPage?
|
|
|
|
init() {
|
|
FullKeyboardSettings().applyLaunchArguments()
|
|
TypingLogSettings().turnOffOnce()
|
|
TypingLogSettings().applyLaunchArguments()
|
|
HinglishSettings().applyLaunchArguments()
|
|
GreeklishSettings().applyLaunchArguments()
|
|
TwoLanguageDictationSettings().applyLaunchArguments()
|
|
MultilingualParakeetSettings().applyLaunchArguments()
|
|
SettingsSnapshotFixture.applyDefaults()
|
|
}
|
|
|
|
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,
|
|
openPage: $openPage
|
|
)
|
|
.onOpenURL { url in
|
|
guard let request = KeyboardLaunchRequest(url: url) else { return }
|
|
if case .setup = request {
|
|
openedFromKeyboard = false
|
|
showSetup = true
|
|
} else if case .translationSettings = request {
|
|
openedFromKeyboard = false
|
|
openPage = .dictation
|
|
} else {
|
|
openedFromKeyboard = true
|
|
}
|
|
dictation.handleKeyboardLaunch(request)
|
|
}
|
|
.onChange(of: scenePhase) { _, phase in
|
|
if phase == .background {
|
|
openedFromKeyboard = false
|
|
dictation.appMovedToBackground()
|
|
} else if phase == .active {
|
|
dictation.endStaleLiveActivities()
|
|
dictation.appBecameActive()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|