mirror of
https://github.com/anomalyco/hex.git
synced 2026-11-28 13:02:21 +01:00
* 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.
113 lines
5 KiB
Swift
113 lines
5 KiB
Swift
import Foundation
|
|
import UIKit
|
|
import XCTest
|
|
@testable import HEX
|
|
|
|
final class SettingsHierarchyTests: XCTestCase {
|
|
private var suiteName = ""
|
|
private var defaults: UserDefaults!
|
|
|
|
override func setUp() async throws {
|
|
suiteName = "hex.tests.settings.(UUID().uuidString)"
|
|
defaults = UserDefaults(suiteName: suiteName)!
|
|
}
|
|
|
|
override func tearDown() async throws {
|
|
defaults.removePersistentDomain(forName: suiteName)
|
|
}
|
|
|
|
func testLiveDictationModeMapsCleanlyToExistingSettingsKeys() {
|
|
let settings = LiveDictationSettings(defaults: defaults)
|
|
// Default: preview on, typing off -> .preview
|
|
XCTAssertEqual(LiveDictationMode.read(from: settings), .preview)
|
|
|
|
LiveDictationMode.off.write(to: settings)
|
|
XCTAssertFalse(settings.showsPreview)
|
|
XCTAssertFalse(settings.typesIntoField)
|
|
XCTAssertFalse(settings.wantsLiveWords)
|
|
XCTAssertEqual(LiveDictationMode.read(from: settings), .off)
|
|
|
|
LiveDictationMode.typeIntoField.write(to: settings)
|
|
XCTAssertFalse(settings.showsPreview)
|
|
XCTAssertTrue(settings.typesIntoField)
|
|
XCTAssertTrue(settings.wantsLiveWords)
|
|
XCTAssertEqual(LiveDictationMode.read(from: settings), .typeIntoField)
|
|
|
|
LiveDictationMode.preview.write(to: settings)
|
|
XCTAssertTrue(settings.showsPreview)
|
|
XCTAssertFalse(settings.typesIntoField)
|
|
XCTAssertTrue(settings.wantsLiveWords)
|
|
XCTAssertEqual(LiveDictationMode.read(from: settings), .preview)
|
|
}
|
|
|
|
func testLegacyBothEnabledReadsAsTypeIntoField() {
|
|
let settings = LiveDictationSettings(defaults: defaults)
|
|
settings.showsPreview = true
|
|
settings.typesIntoField = true
|
|
XCTAssertEqual(LiveDictationMode.read(from: settings), .typeIntoField)
|
|
}
|
|
|
|
// MARK: - What's new
|
|
|
|
private func list(_ version: String) -> WhatsNewRelease {
|
|
WhatsNewRelease(version: version, items: [])
|
|
}
|
|
|
|
@MainActor
|
|
func testWhatsNewPicksTheNewestListAtOrBelowTheVersion() {
|
|
let lists = [list("1.0.7"), list("1.0.5")]
|
|
XCTAssertNil(WhatsNew.release(forAppVersion: "1.0.4", in: lists))
|
|
XCTAssertEqual(WhatsNew.release(forAppVersion: "1.0.5", in: lists)?.version, "1.0.5")
|
|
// A version without a list of its own keeps the last one, which has shown by then.
|
|
XCTAssertEqual(WhatsNew.release(forAppVersion: "1.0.6", in: lists)?.version, "1.0.5")
|
|
XCTAssertEqual(WhatsNew.release(forAppVersion: "1.0.10", in: lists)?.version, "1.0.7")
|
|
// TestFlight stays at 9.0.0, above every App Store version: the newest list.
|
|
XCTAssertEqual(WhatsNew.release(forAppVersion: "9.0.0", in: lists)?.version, "1.0.7")
|
|
XCTAssertEqual(WhatsNew.release(forAppVersion: "9.0.0")?.version, "1.0.5")
|
|
XCTAssertNil(WhatsNew.release(forAppVersion: "1.0.4"))
|
|
}
|
|
|
|
@MainActor
|
|
func testWhatsNewNeverShowsOnAFirstRunAndStaysSeenAfterSetup() {
|
|
XCTAssertNil(WhatsNew.decideAtLaunch(list("1.0.5"), defaults: defaults, firstRun: true))
|
|
XCTAssertEqual(defaults.string(forKey: WhatsNew.seenKey), "1.0.5")
|
|
XCTAssertNil(WhatsNew.decideAtLaunch(list("1.0.5"), defaults: defaults, firstRun: false))
|
|
}
|
|
|
|
@MainActor
|
|
func testWhatsNewShowsOnceAfterAnUpdate() {
|
|
// Updated from 1.0.4, which never saved a list.
|
|
XCTAssertEqual(WhatsNew.decideAtLaunch(list("1.0.5"), defaults: defaults, firstRun: false)?.version, "1.0.5")
|
|
WhatsNew.markSeen(list("1.0.5"), defaults: defaults)
|
|
XCTAssertNil(WhatsNew.decideAtLaunch(list("1.0.5"), defaults: defaults, firstRun: false))
|
|
// A later release's list shows once in its turn; a version without one shows nothing.
|
|
XCTAssertEqual(WhatsNew.decideAtLaunch(list("1.0.7"), defaults: defaults, firstRun: false)?.version, "1.0.7")
|
|
XCTAssertNil(WhatsNew.decideAtLaunch(nil, defaults: defaults, firstRun: false))
|
|
}
|
|
|
|
@MainActor
|
|
func testWhatsNewWaitsForAPlainOpenOverHome() {
|
|
let due = list("1.0.5")
|
|
XCTAssertEqual(WhatsNew.shows(due, at: WhatsNewMoment()), due)
|
|
XCTAssertNil(WhatsNew.shows(nil, at: WhatsNewMoment()))
|
|
let blocked = [
|
|
WhatsNewMoment(openedByLink: true), // the keyboard's hand-off or Open Hex, a words file, setup
|
|
WhatsNewMoment(shownThisLaunch: true),
|
|
WhatsNewMoment(setupSheet: true),
|
|
WhatsNewMoment(settingsPage: true),
|
|
WhatsNewMoment(presenting: true), // a words file's review, Safari, Send feedback
|
|
WhatsNewMoment(dictationBusy: true), // recording, transcribing, asking for the microphone
|
|
WhatsNewMoment(active: false), // iOS's microphone prompt, the screen locking
|
|
]
|
|
for moment in blocked {
|
|
XCTAssertNil(WhatsNew.shows(due, at: moment), "\(moment)")
|
|
}
|
|
}
|
|
|
|
@MainActor
|
|
func testEveryWhatsNewItemHasItsPicture() {
|
|
for item in WhatsNew.releases.flatMap(\.items) {
|
|
XCTAssertNotNil(UIImage(named: item.imageName), item.picture)
|
|
}
|
|
}
|
|
}
|