hex/ios/HEXMobile/WhatsNew/WhatsNewSheet.swift
Ryan Vogel 841f495598 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).
2026-11-25 12:25:54 -05:00

97 lines
3.9 KiB
Swift

import SwiftUI
/// What's new: a title, the items one under another, each a picture from the real app over
/// its name and sentence, and Continue kept at the bottom. Swiping the sheet down closes it too.
struct WhatsNewSheet: View {
let release: WhatsNewRelease
@Environment(\.dismiss) private var dismiss
@State private var visibleHeight: CGFloat = 700
/// A picture leaves room for its words: half the visible height, so in landscape a whole
/// item fits, and at most 360 pt.
private var pictureHeight: CGFloat {
min(360, max(150, visibleHeight * 0.5))
}
var body: some View {
ScrollView {
VStack(alignment: .leading, spacing: 0) {
Text("What's new in Hex")
.font(.system(size: 28, weight: .semibold))
.tracking(-0.4)
.foregroundStyle(HexTheme.textBase)
.fixedSize(horizontal: false, vertical: true)
.accessibilityAddTraits(.isHeader)
.padding(.top, 36)
.padding(.bottom, 28)
VStack(alignment: .leading, spacing: 36) {
ForEach(release.items) { item in
WhatsNewItemView(item: item, pictureHeight: pictureHeight)
}
}
}
.frame(maxWidth: 500, alignment: .leading)
.padding(.horizontal, 20)
.padding(.bottom, 24)
.frame(maxWidth: .infinity)
}
.scrollBounceBehavior(.basedOnSize)
.onGeometryChange(for: CGFloat.self) { $0.size.height } action: { visibleHeight = $0 }
.safeAreaInset(edge: .bottom, spacing: 0) {
OnboardingPrimaryButton(title: "Continue") { dismiss() }
.frame(maxWidth: 500)
.padding(.horizontal, 20)
.padding(.top, 12)
.padding(.bottom, 8)
.frame(maxWidth: .infinity)
.background(HexTheme.bgDeep)
}
.background(HexTheme.bgDeep.ignoresSafeArea())
.presentationDetents([.large])
.presentationDragIndicator(.visible)
.presentationBackground(HexTheme.bgDeep)
.preferredColorScheme(.dark)
}
}
private struct WhatsNewItemView: View {
let item: WhatsNewItem
let pictureHeight: CGFloat
private static let pictureShape = RoundedRectangle(cornerRadius: HexTheme.cardRadius, style: .continuous)
/// VoiceOver reads the name, the sentence, then what the picture shows.
var body: some View {
VStack(alignment: .leading, spacing: 14) {
Image(item.imageName)
.resizable()
.aspectRatio(contentMode: .fit)
.clipShape(Self.pictureShape)
.overlay(Self.pictureShape.strokeBorder(HexTheme.borderWeak, lineWidth: 0.5))
.frame(maxWidth: .infinity, maxHeight: pictureHeight, alignment: .leading)
.accessibilityLabel(Text(item.pictureLabel))
.accessibilityAddTraits(.isImage)
.accessibilitySortPriority(1)
VStack(alignment: .leading, spacing: 4) {
Text(item.title)
.font(.system(size: 17, weight: .semibold))
.tracking(-0.2)
.foregroundStyle(HexTheme.textBase)
.fixedSize(horizontal: false, vertical: true)
.accessibilityAddTraits(.isHeader)
.accessibilitySortPriority(3)
Text(item.detail)
.font(.system(size: 15))
.foregroundStyle(HexTheme.textMuted)
.fixedSize(horizontal: false, vertical: true)
.accessibilitySortPriority(2)
}
.padding(.horizontal, 4)
.accessibilityElement(children: .contain)
.accessibilitySortPriority(2)
}
.accessibilityElement(children: .contain)
}
}