hex/ios/HEXMobile/HEXMobileApp.swift
Ryan Vogel 1bbac97741
iOS: What's new, once after an update (1.0.5) (#2859)
* iOS: What's new, once after an update, with six pictures for 1.0.5

What: a full-height sheet over Home, "What's new in Hex", with the release's
items in one vertical scroll (a cropped picture from the real app over a name
and one sentence) and Continue kept at the bottom; Continue or a swipe down
closes it. Home gets a What's new row under Run setup again that opens it any
time. 1.0.5's six: Dutch, Swedish and Slovak; Emoji as you type; Word
replacements; Kept when the screen locks; Key colors; Send feedback. English
and Simplified Chinese for every string; the two pictures that show Hex's own
words have a zh-Hans variant.

When it shows (WhatsNew, WhatsNewMoment): the newest list at or below the
app's version (TestFlight's 9.0.0 gets the newest list once), marked seen in
Hex's UserDefaults (whatsNew.seen) as it appears. Never on a first run: a
launch that opens onboarding marks the list seen. Only on a plain open over
Home: 1 s after Hex comes to the front, and not if a link opened Hex since it
was last in the background (keyboard hand-off, Open Hex, a words file, setup),
a sheet, page or anything presented is showing, a dictation is recording or
transcribing, Hex is asking for the microphone, or Hex isn't active. The
keyboard never shows it; it downloads nothing.

Why: Ryan asked for a short visual changelog shown only the first time the app
opens after an update.

Pictures: eight JPEGs at 3x in Assets.xcassets/WhatsNew (344 KB), cropped from
iPhone 18 Pro simulator screenshots; scenes and crop boxes in
docs/settings-and-home.md. Two picture scenes are new and debug builds only
(#if DEBUG in FullKeyboardSnapshotStage): emoji-word and strip-stopped. Also
new: --snap-state settings-whats-new.

Verified (Mac Studio simbox, iPhone 18 Pro, iOS 27.2):
- Real update: ios-beta-appstore-1.0.4's tree built as 1.0.4, onboarding
  finished in its UI, then this build stamped 1.0.5 installed over it. Opened
  by the keyboard's hand-off, Open Hex and the setup link: no sheet, nothing
  marked. First plain open: the sheet. Second open: none (seen 1.0.5).
- A Hex words file opening Hex, and iOS's microphone prompt: no sheet. A fresh
  install: onboarding, then Home without it, and none on the next open.
- iPhone SE (3rd generation) and landscape, English and Chinese: everything
  wraps; VoiceOver reads the title, then each name, sentence and picture label.
- Release build: the debug-only scene strings are absent.
- New tests in SettingsHierarchyTests (which list a version gets, first run,
  once after an update, each blocking moment, every picture present).

* iOS What's new: pictures retaken from the 1.0.5 screens

What: the eight What's new pictures are retaken from this head, which has the 17
quality-review fixes (#2862) and #2863. Three files changed: word replacements
(the same three entries) and Send feedback in English and Chinese; the four
keyboard pictures came out byte-identical, as nothing they show changed.
docs/settings-and-home.md names the Word replacements path in full and the size
(336 KB).

Why: the pictures had to come from the screens that ship in 1.0.5.

Verified: every crop looked at (no cut-off text, nothing from the old layout:
none shows the Keyboard or Dictation cards #2862 reorganised); each item's
sentence checked against the merged settings (Keyboard › Languages, Dictation ›
Custom vocabulary › Word replacements, Labs › Key colors, Home's Send feedback,
the keyboard's Paste). Suite, sizes and the 1.0.4 to 1.0.5 run on this commit
are in the pull request.
2026-11-25 19:37:56 -05:00

100 lines
4.6 KiB
Swift
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import SwiftUI
import UIKit
@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?
/// Counts the keyboard's Open Hex taps from the Hex key menu: each one shows Home.
@State private var homeRequests = 0
init() {
FullKeyboardSettings().applyLaunchArguments()
TypingLogSettings().turnOffOnce()
TypingLogSettings().applyLaunchArguments()
HinglishSettings().applyLaunchArguments()
GreeklishSettings().applyLaunchArguments()
TwoLanguageDictationSettings().applyLaunchArguments()
VoiceIsolationSettings().applyLaunchArguments()
MultilingualParakeetSettings().applyLaunchArguments()
KeyboardParakeetSettings().applyLaunchArguments()
KeyboardParakeetSettings().forgetUnavailableWithoutReason()
SettingsSnapshotFixture.applyDefaults()
HexInbox.sweep()
}
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,
homeRequests: homeRequests
)
.onOpenURL { url in
// What's new waits for an open that no link asked for.
WhatsNew.openedByLink = true
// A Hex words file from AirDrop, Files or Open in Hex: its review sheet.
if HexInbox.open(url) { return }
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 if case .home = request {
openedFromKeyboard = false
showSetup = false
homeRequests += 1
} else if case .pasteSettings = request {
openedFromKeyboard = false
openPage = .keyboard
if let settingsURL = URL(string: UIApplication.openSettingsURLString) {
UIApplication.shared.open(settingsURL)
}
} else {
openedFromKeyboard = true
}
dictation.handleKeyboardLaunch(request)
}
.onChange(of: scenePhase) { _, phase in
if phase == .background {
// The next open counts as plain again unless a link comes with it.
WhatsNew.openedByLink = false
openedFromKeyboard = false
dictation.appMovedToBackground()
} else if phase == .active {
dictation.endStaleLiveActivities()
dictation.appBecameActive()
// Settings › Dictation › Speech model in keyboard: picks its download up.
dictation.startKeyboardParakeetDownloadIfWanted()
}
}
}
}
}
}