Skip to content

VoiceStudio is the open-source, fully-local ElevenLabs alternative — voice cloning, voice design, video dubbing, dictation, transcription & audiobook creation in 646 languages.

iOS: simulator screenshot tour in CI + visual fixes (#2968)

Palash Debnath18bf05a0ef52
diff --git a/.github/workflows/mobile.yml b/.github/workflows/mobile.yml
index 30384f403..1ca821e80 100644
--- a/.github/workflows/mobile.yml
+++ b/.github/workflows/mobile.yml
@@ -103,8 +103,25 @@ jobs:
run: |
xcodebuild -project mobile/ios/VoiceStudio/VoiceStudio.xcodeproj \
-scheme VoiceStudio -destination "id=$SIM_UDID" \
+ -resultBundlePath "$RUNNER_TEMP/ui.xcresult" \
CODE_SIGNING_ALLOWED=NO test-without-building
+ # ScreenshotTour keeps a screenshot of every screen; export them for review.
+ - name: Export UI screenshots
+ if: always()
+ run: |
+ [ -d "$RUNNER_TEMP/ui.xcresult" ] || exit 0
+ mkdir -p "$RUNNER_TEMP/shots"
+ xcrun xcresulttool export attachments --path "$RUNNER_TEMP/ui.xcresult" --output-path "$RUNNER_TEMP/shots"
+
+ - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
+ if: always()
+ with:
+ name: ios-screenshots
+ path: ${{ runner.temp }}/shots
+ if-no-files-found: ignore
+ retention-days: 7
+
# Unsigned device build for maintainers to sideload onto their own iPhone
# (it is signed on install with their Apple ID; see docs/mobile.md). Not a
# release artifact.
diff --git a/mobile/android/app/src/test/kotlin/com/voicestudio/mobile/HostSwitchRegressionTest.kt b/mobile/android/app/src/test/kotlin/com/voicestudio/mobile/HostSwitchRegressionTest.kt
index da31f850d..86de75a86 100644
--- a/mobile/android/app/src/test/kotlin/com/voicestudio/mobile/HostSwitchRegressionTest.kt
+++ b/mobile/android/app/src/test/kotlin/com/voicestudio/mobile/HostSwitchRegressionTest.kt
@@ -183,7 +183,12 @@ class HostSwitchRegressionTest {
}
}
}
- compose.waitUntil(5000) {compose.onAllNodesWithText(copy).fetchSemanticsNodes().isNotEmpty()}
+ // The receipt reaches the screen through a main-looper observer; drive the looper
+ // while waiting so a slow CI runner can't time out on an idle queue.
+ compose.waitUntil(20000) {
+ shadowOf(Looper.getMainLooper()).idle()
+ compose.onAllNodesWithText(copy).fetchSemanticsNodes().isNotEmpty()
+ }
compose.onNodeWithText(copy).assertExists()
compose.runOnIdle {shown=false};compose.waitForIdle()
// Recreate the view model/store as on a new launch; receipts must be durable.
diff --git a/mobile/ios/README.md b/mobile/ios/README.md
index be050d892..da105e956 100644
--- a/mobile/ios/README.md
+++ b/mobile/ios/README.md
@@ -46,12 +46,12 @@ Choose an installed simulator name (`xcrun simctl list devices available`). Run
- `VoiceStudio/App/`: app lifecycle, Observation model, token-based native theme, consent and navigation.
- `VoiceStudio/Features/`: Connect, Speak, Voices/clone, Dub, Dictate, Settings/Privacy/About/licenses.
- `VoiceStudio/Platform/`: AVFoundation recording, PCM streaming, AVPlayer authenticated range loading and waveform extraction, AVCaptureSession QR, deterministic UI-smoke transport.
-- `VoiceStudioUITests/`: launch → consent → mocked pairing → generate a valid WAV → play; search empty states, compact history actions, and immediate tab content during delayed host inventory. `--ui-smoke` selects a transport that opens no sockets.
+- `VoiceStudioUITests/`: launch → consent → mocked pairing → generate a valid WAV → play; consent choices/swipe dismissal, editor labeling, search sizing/empty states, shared Dub copy, one Dictate control, palette choices, compact history actions, and immediate tab content during delayed host inventory. ScreenshotTour captures the screens and picker sheets for visual review. `--ui-smoke` selects a transport that opens no sockets.
- `scripts/prepare_resources.py`: build-phase resource and version generation.
-Speak includes backend engine/language and profile choices, playback, waveform/seeking, system share/save, history star/delete. Voices includes search, previews, consent-gated microphone/file cloning, rename/delete. Dub supports device media or host URL ingest, multiple target tracks, an explicit engine-preset or saved-profile voice choice, persisted job/event polling, abort/history/download/share. The picked file's original name is used in the source row, staged multipart filename, pending upload and job title. Remove deselects a picked source and its accessibility label names the file; it does not delete it. Dub history groups compact title/metadata rows with icon actions for Save to Files and system sharing. Picker labels keep their intrinsic width; current values fill the remaining width, align right and truncate to one line. At accessibility text sizes the value moves below its label. Every searchable list shows a localized no-match message. Pages render their forms immediately and show inline loading feedback while host data arrives.
+Consent is a dismissible sheet with the desktop consent title/body and the same local-only explanation as Android. Its title is a heading; Yes and No have the same style and width. Swiping, Escape, and the accessibility escape action record No. Speak shows the shared “Type what you want to hear…” placeholder only while its editor is empty, and uses that copy as the editor's accessibility label. It includes backend engine/language and profile choices, playback, waveform/seeking, system share/save, history star/delete. Voices includes search, previews, consent-gated microphone/file cloning, rename/delete. Dub supports device media or host URL ingest, multiple target tracks, an explicit engine-preset or saved-profile voice choice, persisted job/event polling, abort/history/download/share. The picked file's original name is used in the source row, staged multipart filename, pending upload and job title. Remove deselects a picked source and its accessibility label names the file; it does not delete it. The target-language row shows Choose until a language is selected. Dub history uses the shared mobile.dub.history_meta template with language and a minute:second duration, without a date, in compact rows with icon actions for Save to Files and system sharing. Missing language uses the same completed-stage fallback as Android; missing duration is 0:00. Picker labels keep their intrinsic width; current values fill the remaining width, align right and truncate to one line. At accessibility text sizes the value moves below its label. Every searchable list uses one token-styled search container around an icon and a plain text field, and shows a localized no-match message. Pages render their forms immediately and show inline loading feedback while host data arrives.
-Translation uses the host-selected ready engine explicitly; online engines and remote or undiscoverable LLM destinations require equal-weight Allow/Decline consent scoped to that host, job and provider. Verified host-loopback LLM endpoints do not require cloud consent. Dictate sends mono PCM16 at 16 kHz with single-use WebSocket tickets and EOF finalization. Utterance finals keep recording; the session summary replaces the live transcript. Stream termination is scoped to its own socket. Settings includes saved hosts, mode and independent light/dark palettes, system/desktop language choices, local notification permission, privacy, app/font licenses and a link to the paired host for model licenses.
+Translation uses the host-selected ready engine explicitly; online engines and remote or undiscoverable LLM destinations require equal-weight Allow/Decline consent scoped to that host, job and provider. Verified host-loopback LLM endpoints do not require cloud consent. Dictate has one primary control: tap to start/stop, or hold and release to finish; Hold to talk is its accessibility hint. It sends mono PCM16 at 16 kHz with single-use WebSocket tickets and EOF finalization. Utterance finals keep recording; the session summary replaces the live transcript. Stream termination is scoped to its own socket. Settings includes saved hosts, mode and independent light/dark palette rows with their desktop names and compact live color swatches, system/desktop language choices, local notification permission, privacy, app/font licenses and a link to the paired host for model licenses.
Permissions are requested at first use. InfoPlist localization uses the mobile permission keys. No Bonjour, APNs, FCM, analytics SDK or crash reporter is linked. Disconnect revokes an existing bearer session and clears local credentials even if the host is unavailable. PIN-only connections disconnect locally. Reconnecting preserves a saved server name unless a replacement name is entered; rejected pairing attempts leave the active server connected. Unreadable saved preferences use defaults, and unreadable credentials allow fresh pairing. Session/PIN secrets use Keychain with `AfterFirstUnlockThisDeviceOnly`; host metadata and job checkpoints stay in local preferences. Requests reject redirects and public cleartext; TLS uses system certificate validation. Reduced transparency uses opaque token surfaces throughout, and there are no custom motion effects. Inter uses Dynamic Type scaling; controls have at least 44-point targets and content scrolls at large sizes.
@@ -74,9 +74,9 @@ InterVariable.ttf is from the official [Inter 4.1 release](https://github.com/rs
## Verification and remaining device checks
-Verified here: macOS Swift package build and 74 Swift Testing tests (several parameterized), strict-concurrency package compilation including the production upload coordinator, macOS type-checking of the media-loader and smoke-transport wrappers, all palette/role values against the contract JSON, interpolation/plural/fallback/key coverage, Chinese script/region mapping, QR/manual IPv4/IPv6 parsing, private/public cleartext boundaries, health fingerprint, PIN/session exchange/revoke/401 handling, corrupt-store recovery, reconnect labels, candidate-host failure isolation, upload refusal/cancellation classification, receipt consumption through relaunch, stale dictation termination, multipart TTS and dub upload, job progress, persisted multi-language dub pipeline, host-only redirect rejection, XcodeGen generation, resource/version generation and app-source syntax parsing. A real loopback server exercises the upload start/staging/delegate path with a file-backed foreground session: original filename reaches the host, successful completion is consumed once, and 401/500 responses produce actionable failure receipts. Package tests cover remote/loopback/undiscoverable LLM routing, per-job allow/decline and changed-endpoint reapproval, filename persistence, partial-file cleanup and history metadata.
+Verified here: macOS Swift package build and 78 Swift Testing tests (several parameterized), strict-concurrency package compilation including the production upload coordinator, macOS type-checking of the media-loader and smoke-transport wrappers, all palette/role values against the contract JSON, interpolation/plural/fallback/key coverage, Chinese script/region mapping, QR/manual IPv4/IPv6 parsing, private/public cleartext boundaries, health fingerprint, PIN/session exchange/revoke/401 handling, corrupt-store recovery, reconnect labels, candidate-host failure isolation, upload refusal/cancellation classification, receipt consumption through relaunch, stale dictation termination, multipart TTS and dub upload, job progress, persisted multi-language dub pipeline, host-only redirect rejection, XcodeGen generation, resource/version generation and app-source syntax parsing. A real loopback server exercises the upload start/staging/delegate path with a file-backed foreground session: original filename reaches the host, successful completion is consumed once, and 401/500 responses produce actionable failure receipts. Package tests cover remote/loopback/undiscoverable LLM routing, per-job allow/decline and changed-endpoint reapproval, filename persistence, partial-file cleanup, localized history metadata, missing metadata and duration formatting.
-This machine has Command Line Tools only. The SwiftUI app and XCTest UI smoke have **not been compiled or run with an iOS SDK**. Full Xcode build, simulator smoke, real-device QR/microphone/local-network permission prompts, VoiceOver/largest Dynamic Type, Inter rendering, authenticated media playback, background upload/relaunch, task scheduling, notification delivery, and live-host end-to-end TTS/clone/dub/dictation remain unverified. Simulator/device testing is a release gate, not implied by syntax parsing.
+This machine has Command Line Tools only. The SwiftUI app and XCTest UI smoke have **not been compiled or run with an iOS SDK**. Consent swipe/Escape, placeholder rendering/hiding, search appearance, Dictate tap/hold cancellation and palette swatches still require Xcode UI verification. Full Xcode build, simulator smoke, real-device QR/microphone/local-network permission prompts, VoiceOver/largest Dynamic Type, Inter rendering, authenticated media playback, background upload/relaunch, task scheduling, notification delivery, and live-host end-to-end TTS/clone/dub/dictation remain unverified. Simulator/device testing is a release gate, not implied by syntax parsing.
## Contract interpretations and platform limits
@@ -87,6 +87,6 @@ This machine has Command Line Tools only. The SwiftUI app and XCTest UI smoke ha
- There is no single “start dub” endpoint. The app follows upload/ingest → persisted prep-job events → transcribe → translate → generate per target → persisted render-job events. The polling key is the returned **task ID**, distinct from the dub media job ID. Acknowledged transitions and event sequence cursors are saved. The backend has no client idempotency key for render; termination between host acceptance and checkpoint persistence can require host-side inspection before retrying.
- iOS background URLSession continues file upload and persists completion receipts through relaunch. If the OS refuses the background session, the staged file and pending job survive while the app retries using a foreground URLSession. That fallback needs app runtime and does not promise upload continuation after suspension or termination. Cancelling an upload clears its pending state without a failure receipt. Receipts are consumed once for their paired host, so a failure is not redisplayed after foregrounding or relaunch. Host generation runs independently. BGProcessing submission refusal leaves the host job intact and foreground monitoring available. BGProcessing is opportunistic: iOS does not promise continuous polling or an immediate completion notification while suspended/force-quit. Monitoring and local completion notifications resume at the next granted runtime/foreground launch. There is no push relay.
- The translation inventory has a loose OpenAPI response. Its `active`, `engines`, `category`, `installed`, `ready`, `display_name`, and `configured_via` fields follow `backend/api/routers/engines.py` and `backend/services/translation_engines.py`. Missing readiness never implies permission to translate. For category `llm`, the app reads `/api/settings/llm-skills` and `/api/settings/llm-providers` to resolve the `dub_translation` override and effective base URL; an inventory identifying the legacy env fallback uses `/api/settings/llm-endpoint`. These read-only endpoints are in OpenAPI; their loose response fields follow `settings.py`, `llm_skills.py` and `llm_providers.py`. A provider's `local` label alone is insufficient because its endpoint can be overridden. Only HTTP(S) loopback endpoints on an OpenAI-compatible transport are treated as local. Private LAN/Tailnet destinations still require consent. If desktop admin restrictions, missing fields or discovery errors hide the destination, the app asks for per-job consent using the available provider/engine name. Cancellation and 401 retain their normal handling. LLM approval also covers a hash of the resolved provider and endpoint, so an observed route change asks again; raw endpoint credentials are not persisted. Existing checkpoints without matching approval require confirmation. Host settings can change after discovery; these endpoints do not provide an atomic route-and-translate operation.
-- `/dub/history` is a loose schema returning database rows from `dub_core.py`. Title and metadata use `filename`, `language`/`language_code`, `duration` (seconds) and `created_at` (Unix seconds), as written by `dub_pipeline.py`. Older rows lacking metadata remain readable.
+- `/dub/history` is a loose schema returning database rows from `dub_core.py`. The model decodes `filename`, `language`/`language_code`, `duration` (seconds) and `created_at` (Unix seconds), as written by `dub_pipeline.py`. Presentation matches Android: filename (or ID), the shared history template using `language` and duration, and no date. Older rows lacking metadata remain readable.
- The synchronous `/dub/transcribe/{job_id}` path does not prepare source-speaker references. An empty profile selects the engine preset; a saved profile sends its ID. Source-voice cloning is not offered by this flow.
- Model-license navigation opens the paired host interface; M1 does not accept licenses or install models from the phone.
diff --git a/mobile/ios/VoiceStudio/App/SelectionControls.swift b/mobile/ios/VoiceStudio/App/SelectionControls.swift
index 3db663299..b0952d1fe 100644
--- a/mobile/ios/VoiceStudio/App/SelectionControls.swift
+++ b/mobile/ios/VoiceStudio/App/SelectionControls.swift
@@ -125,8 +125,11 @@ struct SearchField: View {
HStack(spacing: VSTokens.spacingGap) {
Image(systemName: "magnifyingglass").foregroundStyle(theme.color("textMuted")).accessibilityHidden(true)
TextField(prompt, text: $text)
+ .textFieldStyle(.plain)
+ .frame(minHeight: 44)
.textInputAutocapitalization(.never).autocorrectionDisabled()
.submitLabel(.search)
+ .accessibilityLabel(prompt)
.accessibilityIdentifier("search.field")
if !text.isEmpty {
Button { text = "" } label: { Image(systemName: "xmark.circle.fill") }
diff --git a/mobile/ios/VoiceStudio/App/ThemeUI.swift b/mobile/ios/VoiceStudio/App/ThemeUI.swift
index f74c141c7..c994c66a5 100644
--- a/mobile/ios/VoiceStudio/App/ThemeUI.swift
+++ b/mobile/ios/VoiceStudio/App/ThemeUI.swift
@@ -76,23 +76,30 @@ struct RootView: View {
var body: some View {
let theme = Theme(palette: model.theme.palette(system: scheme == .dark ? .dark : .light), appearance: model.theme.appearance(system: scheme == .dark ? .dark : .light))
Group {
- if !model.consentAnswered { ConsentView() }
- else {
- TabView {
- if model.connection.client == nil {
- NavigationStack { ConnectView() }.tabItem { Label(model.t("mobile.tabs.connect"), systemImage: "link") }
- } else {
- NavigationStack { SpeakView() }.tabItem { Label(model.t("mobile.tabs.speak"), systemImage: "waveform") }
- NavigationStack { VoicesView() }.tabItem { Label(model.t("mobile.tabs.voices"), systemImage: "person.wave.2") }
- NavigationStack { DubView() }.tabItem { Label(model.t("mobile.tabs.dub"), systemImage: "film") }
- NavigationStack { DictateView() }.tabItem { Label(model.t("mobile.tabs.dictate"), systemImage: "mic") }
- }
- NavigationStack { SettingsView() }.tabItem { Label(model.t("mobile.tabs.settings"), systemImage: "gearshape") }
+ TabView {
+ if model.connection.client == nil {
+ NavigationStack { ConnectView() }.tabItem { Label(model.t("mobile.tabs.connect"), systemImage: "link") }
+ } else {
+ NavigationStack { SpeakView() }.tabItem { Label(model.t("mobile.tabs.speak"), systemImage: "waveform") }
+ NavigationStack { VoicesView() }.tabItem { Label(model.t("mobile.tabs.voices"), systemImage: "person.wave.2") }
+ NavigationStack { DubView() }.tabItem { Label(model.t("mobile.tabs.dub"), systemImage: "film") }
+ NavigationStack { DictateView() }.tabItem { Label(model.t("mobile.tabs.dictate"), systemImage: "mic") }
}
- .id(model.hostState.scopeID)
- .toolbarBackground(theme.color("chrome"), for: .tabBar)
- .toolbarBackground(.visible, for: .tabBar)
+ NavigationStack { SettingsView() }.tabItem { Label(model.t("mobile.tabs.settings"), systemImage: "gearshape") }
}
+ .id(model.hostState.scopeID)
+ .toolbarBackground(theme.color("chrome"), for: .tabBar)
+ .toolbarBackground(.visible, for: .tabBar)
+ }
+ .sheet(isPresented: Binding(get: { !model.consentAnswered }, set: { presented in
+ if !presented && !model.consentAnswered { model.chooseConsent(false) }
+ }), onDismiss: {
+ if !model.consentAnswered { model.chooseConsent(false) }
+ }) {
+ ConsentView()
+ .presentationBackground(theme.color("surfaceOverlay"))
+ .presentationCornerRadius(VSTokens.radiusLg)
+ .presentationDragIndicator(.visible)
}
.onAppear { NativeTheme.apply(theme) }
.onChange(of: model.theme) { _, _ in NativeTheme.apply(theme) }
@@ -122,19 +129,26 @@ struct RootView: View {
struct ConsentView: View {
@Environment(AppModel.self) private var model
var body: some View {
- Page {
- Text(model.t("privacy.analytics_title")).font(.custom("InterVariable", size: VSTokens.textEditor.size, relativeTo: .title))
- Text(model.t("privacy.analytics_subtitle"))
- Text(model.t("mobile.ios.privacy_local"))
+ Page(backgroundRole: "surfaceOverlay") {
+ Text(model.t("consent.title"))
+ .font(.custom("InterVariable", size: Theme.titleTypeSize, relativeTo: .title).weight(.semibold))
+ .accessibilityAddTraits(.isHeader).accessibilityIdentifier("consent.title")
+ Text(model.t("consent.body"))
+ Text(model.t("mobile.android.analytics_local"))
ViewThatFits(in: .horizontal) {
HStack(spacing: VSTokens.spacingGap) { choice(true); choice(false) }
VStack(spacing: VSTokens.spacingGap) { choice(true); choice(false) }
}
- Button(model.t("common.dismiss")) { model.chooseConsent(false) }.accessibilityIdentifier("consent.dismiss")
- }.interactiveDismissDisabled()
+ }
+ .accessibilityAction(.escape) { model.chooseConsent(false) }
}
- func choice(_ value: Bool) -> some View {
- Button(model.t(value ? "common.yes" : "common.no")) { model.chooseConsent(value) }
- .buttonStyle(VSButtonStyle(kind: .secondary)).frame(maxWidth: .infinity).accessibilityIdentifier(value ? "consent.yes" : "consent.no")
+ @ViewBuilder func choice(_ value: Bool) -> some View {
+ let button = Button { model.chooseConsent(value) } label: {
+ Text(model.t(value ? "consent.yes" : "consent.no"))
+ .multilineTextAlignment(.center).fixedSize(horizontal: false, vertical: true)
+ .frame(maxWidth: .infinity)
+ }.buttonStyle(VSButtonStyle(kind: .secondary)).accessibilityIdentifier(value ? "consent.yes" : "consent.no")
+ if value { button }
+ else { button.keyboardShortcut(.cancelAction) }
}
}
diff --git a/mobile/ios/VoiceStudio/Features/DictateView.swift b/mobile/ios/VoiceStudio/Features/DictateView.swift
index 2d25f861c..3cf439f3f 100644
--- a/mobile/ios/VoiceStudio/Features/DictateView.swift
+++ b/mobile/ios/VoiceStudio/Features/DictateView.swift
@@ -15,21 +15,32 @@ struct DictateView: View {
@State private var receiving: Task<Void, Never>?
@State private var audio = DictationAudio()
@State private var stream = DictationStream()
+ @GestureState private var holding = false
var body: some View {
Page {
if checking { ProgressView(model.t("common.loading")) }
else if !ready { Text(model.t("mobile.dictate.not_ready", ["reason": reason])) }
Button(model.t(listening ? "common.stop" : "mobile.dictate.tap_to_start"), systemImage: listening ? "stop.fill" : "mic.fill") {
if listening { stop() } else { start() }
- }.buttonStyle(VSButtonStyle(kind: .primary)).disabled(!ready || finalizing).accessibilityHint(model.t("mobile.dictate.hold_to_talk")).accessibilityIdentifier("dictate.record")
- // The separate hold surface supports release-to-finish without competing with tap semantics.
- Text(model.t("mobile.dictate.hold_to_talk")).frame(minHeight: 44).frame(maxWidth: .infinity)
- .contentShape(Rectangle())
- .onLongPressGesture(minimumDuration: 0.2, pressing: { pressed in
- if pressed && ready && !listening { start() }
- else if !pressed && listening { stop() }
- }, perform: {})
- .accessibilityAddTraits(.isButton).accessibilityAction { if listening { stop() } else { start() } }
+ }.buttonStyle(VSButtonStyle(kind: .primary)).disabled(!ready || finalizing)
+ .accessibilityHint(model.t("mobile.dictate.hold_to_talk")).accessibilityIdentifier("dictate.record")
+ // One surface: the exclusive gesture prevents a hold's release
+ // from also toggling the button. Native accessibility activates its action.
+ .highPriorityGesture(
+ LongPressGesture(minimumDuration: 0.2)
+ .sequenced(before: DragGesture(minimumDistance: 0))
+ .exclusively(before: TapGesture())
+ .updating($holding) { value, state, _ in
+ if case .first(.second(true, _)) = value { state = true }
+ }
+ .onEnded { value in
+ if case .second = value { if listening { stop() } else { start() } }
+ }
+ )
+ .onChange(of: holding) { _, pressed in
+ if pressed { start() }
+ else if listening { stop() }
+ }
if listening { Text(model.t("mobile.dictate.listening")) }
Text(text).frame(maxWidth: .infinity, alignment: .leading)
.textSelection(.enabled).accessibilityLabel(model.t("mobile.ios.transcript"))
diff --git a/mobile/ios/VoiceStudio/Features/DubView.swift b/mobile/ios/VoiceStudio/Features/DubView.swift
index 2029d6a07..e0b10f041 100644
--- a/mobile/ios/VoiceStudio/Features/DubView.swift
+++ b/mobile/ios/VoiceStudio/Features/DubView.swift
@@ -25,7 +25,8 @@ struct DubView: View {
if let selectedFile { SelectedFileRow(name: selectedFile.name) { self.selectedFile = nil } }
TextField(model.t("mobile.dub.paste_url"), text: $sourceURL).keyboardType(.URL).textInputAutocapitalization(.never).autocorrectionDisabled().accessibilityIdentifier("dub.source_url")
Button { selectingLanguages = true } label: {
- SelectionRow(label: model.t("mobile.dub.target_languages"), value: ListFormatter.localizedString(byJoining: languages.filter { selected.contains($0.code) }.map(\.name)))
+ let names = languages.filter { selected.contains($0.code) }.map(\.name)
+ SelectionRow(label: model.t("mobile.dub.target_languages"), value: names.isEmpty ? model.t("mobile.android.choose") : ListFormatter.localizedString(byJoining: names))
}.buttonStyle(VSButtonStyle(kind: .tertiary)).accessibilityIdentifier("dub.languages")
ScrollView(.horizontal) {
HStack(spacing: VSTokens.spacingGap) {
@@ -163,7 +164,7 @@ struct DubView: View {
private func historyTitle(_ item: DubHistoryItem) -> some View {
VStack(alignment: .leading, spacing: VSTokens.spacingGap) {
Text(item.title).lineLimit(1).truncationMode(.middle)
- Text(item.metadata(locale: Locale(identifier: model.l10n.locale)))
+ Text(item.metadata(l10n: model.l10n)).accessibilityIdentifier("dub.metadata." + item.id)
.font(.custom("InterVariable", size: VSTokens.textLabel.size, relativeTo: .caption))
.foregroundStyle(theme.color("textMuted")).lineLimit(1).truncationMode(.tail)
}.frame(maxWidth: .infinity, alignment: .leading)
diff --git a/mobile/ios/VoiceStudio/Features/SettingsView.swift b/mobile/ios/VoiceStudio/Features/SettingsView.swift
index 5fae30338..1597dae21 100644
--- a/mobile/ios/VoiceStudio/Features/SettingsView.swift
+++ b/mobile/ios/VoiceStudio/Features/SettingsView.swift
@@ -16,14 +16,8 @@ struct SettingsView: View {
Card {
Text(model.t("mobile.settings.appearance"))
ChoicePicker(label: model.t("mobile.settings.mode"), selection: Binding(get: { model.theme.mode.rawValue }, set: { model.theme.mode = ThemeMode(rawValue: $0) ?? .dark }), options: ThemeMode.allCases.map { SelectionOption(id: $0.rawValue, title: model.t("mobile.settings.mode_" + $0.rawValue)) })
- palette(key: "mobile.settings.light_palette", selection: $model.theme.lightPalette)
- palette(key: "mobile.settings.dark_palette", selection: $model.theme.darkPalette)
- ForEach(Appearance.allCases, id: \.self) { appearance in
- let preview = Theme(palette: appearance == .light ? model.theme.lightPalette : model.theme.darkPalette, appearance: appearance)
- Label(model.t(appearance == .light ? "mobile.settings.light_palette" : "mobile.settings.dark_palette"), systemImage: "waveform").padding(Theme.compactInset)
- .background(preview.color("messageAction"), in: RoundedRectangle(cornerRadius: VSTokens.radiusControl))
- .foregroundStyle(preview.color("messageActionForeground"))
- }
+ palette(key: "mobile.settings.light_palette", selection: $model.theme.lightPalette, appearance: .light)
+ palette(key: "mobile.settings.dark_palette", selection: $model.theme.darkPalette, appearance: .dark)
}
Card {
ChoicePicker(label: model.t("mobile.settings.language"), selection: $model.language, options:
@@ -35,8 +29,8 @@ struct SettingsView: View {
Card {
Text(model.t("mobile.settings.privacy"))
Text(model.t("mobile.settings.privacy_help"))
- Toggle(model.t("privacy.analytics_title"), isOn: $model.analytics).frame(minHeight: 44)
- Text(model.t("mobile.ios.privacy_local"))
+ Toggle(model.t("consent.title"), isOn: $model.analytics).frame(minHeight: 44).accessibilityIdentifier("settings.analytics")
+ Text(model.t("mobile.android.analytics_local"))
}
Card {
Text(model.t("mobile.settings.about"))
@@ -49,8 +43,20 @@ struct SettingsView: View {
}
}.navigationTitle(model.t("mobile.tabs.settings")).navigationBarTitleDisplayMode(.large)
}
- private func palette(key: String, selection: Binding<String>) -> some View {
- ChoicePicker(label: model.t(key), selection: selection, options: VSTokens.palettes.map { SelectionOption(id: $0.id, title: Theme.paletteLabel($0, l10n: model.l10n)) })
+ private func palette(key: String, selection: Binding<String>, appearance: Appearance) -> some View {
+ let preview = Theme(palette: selection.wrappedValue, appearance: appearance)
+ return HStack(spacing: VSTokens.spacingGap) {
+ ChoicePicker(label: model.t(key), selection: selection, options: VSTokens.palettes.map { SelectionOption(id: $0.id, title: Theme.paletteLabel($0, l10n: model.l10n)) })
+ .accessibilityIdentifier("settings.palette." + appearance.rawValue)
+ HStack(spacing: 0) {
+ ForEach(["canvas", "surface", "text", "messageAction"], id: \.self) { role in
+ Rectangle().fill(preview.color(role))
+ }
+ }
+ .frame(width: VSTokens.spacingInset * 2, height: VSTokens.spacingGap * 2)
+ .clipShape(RoundedRectangle(cornerRadius: VSTokens.radiusControl))
+ .accessibilityHidden(true).allowsHitTesting(false)
+ }
}
}
struct LicensesView: View {
diff --git a/mobile/ios/VoiceStudio/Features/SpeakView.swift b/mobile/ios/VoiceStudio/Features/SpeakView.swift
index 4da52bf70..280265812 100644
--- a/mobile/ios/VoiceStudio/Features/SpeakView.swift
+++ b/mobile/ios/VoiceStudio/Features/SpeakView.swift
@@ -31,7 +31,17 @@ struct SpeakView: View {
var body: some View {
Page {
TextEditor(text: $text).frame(minHeight: VSTokens.textEditor.lineHeight * 6)
- .scrollContentBackground(.hidden).padding(Theme.compactInset)
+ .scrollContentBackground(.hidden)
+ .overlay(alignment: .topLeading) {
+ if text.isEmpty {
+ Text(model.t("mobile.speak.placeholder"))
+ .foregroundStyle(theme.color("placeholder"))
+ .padding(.horizontal, VSTokens.spacingGap / 3)
+ .padding(.vertical, VSTokens.spacingGap / 2)
+ .allowsHitTesting(false).accessibilityHidden(true)
+ }
+ }
+ .padding(Theme.compactInset)
.background(theme.color("input"), in: RoundedRectangle(cornerRadius: VSTokens.radiusControl))
.accessibilityLabel(model.t("mobile.speak.placeholder")).accessibilityIdentifier("speak.text")
Card {
diff --git a/mobile/ios/VoiceStudioKit/Sources/VoiceStudioKit/Models/Models.swift b/mobile/ios/VoiceStudioKit/Sources/VoiceStudioKit/Models/Models.swift
index 07bffeeca..8d72c447b 100644
--- a/mobile/ios/VoiceStudioKit/Sources/VoiceStudioKit/Models/Models.swift
+++ b/mobile/ios/VoiceStudioKit/Sources/VoiceStudioKit/Models/Models.swift
@@ -92,14 +92,11 @@ public struct DubHistoryItem: Codable, Identifiable, Sendable {
public let duration: Double?
public let created_at: Double?
public var title: String { filename?.nilIfBlank ?? id }
- public func metadata(locale: Locale) -> String {
- var parts = [String]()
- if let language = language?.nilIfBlank ?? language_code?.nilIfBlank { parts.append(language) }
- if let duration, duration.isFinite, duration > 0 { parts.append(PlaybackTime.format(duration)) }
- if let created_at, created_at.isFinite {
- parts.append(Date(timeIntervalSince1970: created_at).formatted(.dateTime.day().month(.abbreviated).year().locale(locale)))
- }
- return parts.isEmpty ? id : parts.joined(separator: " · ")
+ public func metadata(l10n: L10n) -> String {
+ l10n.t("mobile.dub.history_meta", [
+ "language": language?.nilIfBlank ?? l10n.t("mobile.android.stage_done"),
+ "duration": PlaybackTime.format(duration ?? 0)
+ ])
}
}
public struct Readiness: Decodable, Sendable {
diff --git a/mobile/ios/VoiceStudioKit/Tests/VoiceStudioKitTests/ContractTests.swift b/mobile/ios/VoiceStudioKit/Tests/VoiceStudioKitTests/ContractTests.swift
index 498f6f277..4710cef71 100644
--- a/mobile/ios/VoiceStudioKit/Tests/VoiceStudioKitTests/ContractTests.swift
+++ b/mobile/ios/VoiceStudioKit/Tests/VoiceStudioKitTests/ContractTests.swift
@@ -61,7 +61,7 @@ func catalogs() throws -> [String: Data] {
let l10n = try L10n(catalogs: catalogs())
let root = repository.appendingPathComponent("mobile/ios")
let paths = FileManager.default.enumerator(at: root, includingPropertiesForKeys: nil)!
- let pattern = #""((?:mobile|common|privacy|player|themeAppearance)\.[a-zA-Z0-9_.]+)""#
+ let pattern = #""((?:mobile|common|consent|privacy|player|themeAppearance)\.[a-zA-Z0-9_.]+)""#
let regex = try NSRegularExpression(pattern: pattern)
let dynamic: [String: [String]] = [
"mobile.settings.mode_": ThemeMode.allCases.map(\.rawValue),
diff --git a/mobile/ios/VoiceStudioKit/Tests/VoiceStudioKitTests/DeviceRegressionTests.swift b/mobile/ios/VoiceStudioKit/Tests/VoiceStudioKitTests/DeviceRegressionTests.swift
index a5bac0a61..56cf0d2f1 100644
--- a/mobile/ios/VoiceStudioKit/Tests/VoiceStudioKitTests/DeviceRegressionTests.swift
+++ b/mobile/ios/VoiceStudioKit/Tests/VoiceStudioKitTests/DeviceRegressionTests.swift
@@ -118,13 +118,12 @@ func unprovenLLMEndpoints(_ url: String) { #expect(!TranslationEngine.isLoopback
@Test func dubHistoryMetadataUsesActualHostFieldsAndToleratesOlderRows() throws {
let item = try JSONDecoder().decode(DubHistoryItem.self, from: data(#"{"id":"dub","filename":"vs-dub-test.wav","language":"Spanish","language_code":"es","duration":125,"created_at":1700000000}"#))
#expect(item.title == "vs-dub-test.wav")
- let metadata = item.metadata(locale: Locale(identifier: "en"))
- #expect(metadata.contains("Spanish"))
- #expect(metadata.contains("2:05"))
- #expect(metadata.contains("2023"))
+ let l10n = try L10n(locale: "en", catalogs: catalogs())
+ let metadata = item.metadata(l10n: l10n)
+ #expect(metadata == "Spanish dub, 2:05 long")
let old = try JSONDecoder().decode(DubHistoryItem.self, from: data(#"{"id":"old"}"#))
#expect(old.title == "old")
- #expect(old.metadata(locale: Locale(identifier: "en")) == "old")
+ #expect(old.metadata(l10n: l10n) == "Dub finished dub, 0:00 long")
}
@Test func searchEmptyAndRemoveCopyAreLocalized() throws {
diff --git a/mobile/ios/VoiceStudioKit/Tests/VoiceStudioKitTests/VisualParityTests.swift b/mobile/ios/VoiceStudioKit/Tests/VoiceStudioKitTests/VisualParityTests.swift
new file mode 100644
index 000000000..73a89f52c
--- /dev/null
+++ b/mobile/ios/VoiceStudioKit/Tests/VoiceStudioKitTests/VisualParityTests.swift
@@ -0,0 +1,25 @@
+import Foundation
+import Testing
+@testable import VoiceStudioKit
+
+@Test func dubMetadataInterpolatesTheSelectedCatalogWithoutAddingADate() throws {
+ let l10n = try L10n(locale: "fr", catalogs: [
+ "fr": data(#"{"mobile":{"dub":{"history_meta":"{{duration}} / {{language}}"},"android":{"stage_done":"Done"}}}"#)
+ ])
+ let item = try JSONDecoder().decode(DubHistoryItem.self, from: data(
+ #"{"id":"job","language":"Spanish","duration":125,"created_at":1700000000}"#))
+ #expect(item.metadata(l10n: l10n) == "2:05 / Spanish")
+ // Android uses language, not language_code, with its completed-stage fallback.
+ let legacy = try JSONDecoder().decode(DubHistoryItem.self, from: data(
+ #"{"id":"old","language":" ","language_code":"es","duration":null}"#))
+ #expect(legacy.metadata(l10n: l10n) == "0:00 / Done")
+}
+
+@Test(arguments: [0.0, -5.0, 59.9, 60.0, 125.9])
+func dubMetadataUsesTheSameMinuteSecondDurationAsAndroid(_ duration: Double) throws {
+ let l10n = try L10n(locale: "en", catalogs: catalogs())
+ let item = try JSONDecoder().decode(DubHistoryItem.self, from: data(
+ "{\"id\":\"job\",\"language\":\"Spanish\",\"duration\":\(duration)}"))
+ let expected = [0.0: "0:00", -5.0: "0:00", 59.9: "0:59", 60.0: "1:00", 125.9: "2:05"][duration]!
+ #expect(item.metadata(l10n: l10n) == "Spanish dub, \(expected) long")
+}
diff --git a/mobile/ios/VoiceStudioUITests/ScreenshotTour.swift b/mobile/ios/VoiceStudioUITests/ScreenshotTour.swift
new file mode 100644
index 000000000..73c9a7fe8
--- /dev/null
+++ b/mobile/ios/VoiceStudioUITests/ScreenshotTour.swift
@@ -0,0 +1,72 @@
+import XCTest
+
+/// Walks every screen against the mocked host and keeps a screenshot of each, so
+/// the iOS app can be reviewed visually from CI (the mobile workflow exports
+/// these as the `ios-screenshots` artifact). Asserts only that each screen loads.
+final class ScreenshotTour: XCTestCase {
+ @MainActor func testScreenshotTour() throws {
+ let app = XCUIApplication()
+ app.launchArguments = ["--ui-smoke", "-AppleLanguages", "(en)"]
+ app.launch()
+
+ XCTAssertTrue(app.buttons["consent.no"].waitForExistence(timeout: 10))
+ XCTAssertTrue(app.staticTexts["consent.title"].exists)
+ XCTAssertTrue(app.buttons["consent.yes"].exists)
+ XCTAssertFalse(app.buttons["consent.dismiss"].exists)
+ shot(app, "01-consent")
+ app.buttons["consent.no"].tap()
+
+ let address = app.textFields["connect.url"]
+ XCTAssertTrue(address.waitForExistence(timeout: 5))
+ shot(app, "02-connect")
+ address.tap(); address.typeText("http://127.0.0.1:3900")
+ shot(app, "03-connect-keyboard")
+ if app.buttons["keyboard.done"].waitForExistence(timeout: 3) { app.buttons["keyboard.done"].tap() }
+ app.swipeUp()
+ app.buttons["connect.submit"].tap()
+
+ let editor = app.textViews["speak.text"]
+ XCTAssertTrue(editor.waitForExistence(timeout: 10))
+ XCTAssertEqual(editor.label, "Type what you want to hear…")
+ shot(app, "04-speak")
+ editor.tap(); editor.typeText("Hello from the VoiceStudio iPhone app.")
+ shot(app, "05-speak-keyboard")
+ if app.buttons["keyboard.done"].waitForExistence(timeout: 3) { app.buttons["keyboard.done"].tap() }
+ let engine = app.buttons["speak.engine"]
+ XCTAssertTrue(engine.waitForExistence(timeout: 5))
+ engine.tap()
+ shot(app, "06-engine-picker")
+ XCTAssertTrue(app.buttons["Close"].waitForExistence(timeout: 3))
+ app.buttons["Close"].tap()
+ app.swipeUp()
+ let generate = app.buttons["speak.generate"]
+ XCTAssertTrue(generate.waitForExistence(timeout: 5))
+ generate.tap()
+ XCTAssertTrue(app.buttons["audio.play"].waitForExistence(timeout: 10))
+ shot(app, "07-speak-generated")
+
+ for (tab, name) in [("Voices", "08-voices"), ("Dub", "09-dub"), ("Dictate", "10-dictate"), ("Settings", "11-settings")] {
+ app.tabBars.buttons[tab].tap()
+ sleep(1)
+ if tab == "Dub" {
+ XCTAssertEqual(app.buttons["dub.languages"].value as? String, "Choose")
+ XCTAssertEqual(app.staticTexts["dub.metadata.smoke-dub"].label, "Spanish dub, 2:05 long")
+ }
+ if tab == "Dictate" { XCTAssertFalse(app.staticTexts["Hold to talk"].exists) }
+ shot(app, name)
+ }
+ app.buttons["settings.palette.light"].tap()
+ shot(app, "11a-palette-picker")
+ app.buttons["Close"].tap()
+ app.swipeUp()
+ shot(app, "12-settings-more")
+
+ }
+
+ @MainActor private func shot(_ app: XCUIApplication, _ name: String) {
+ let attachment = XCTAttachment(screenshot: app.screenshot())
+ attachment.name = name
+ attachment.lifetime = .keepAlways
+ add(attachment)
+ }
+}
diff --git a/mobile/ios/VoiceStudioUITests/SmokeTests.swift b/mobile/ios/VoiceStudioUITests/SmokeTests.swift
index 2c1d938d8..4f1463c48 100644
--- a/mobile/ios/VoiceStudioUITests/SmokeTests.swift
+++ b/mobile/ios/VoiceStudioUITests/SmokeTests.swift
@@ -1,6 +1,62 @@
import XCTest
final class SmokeTests: XCTestCase {
+ @MainActor func testConsentCopyEqualChoicesAndSwipeDefaultsToNo() throws {
+ let app = XCUIApplication()
+ app.launchArguments = ["--ui-smoke", "-AppleLanguages", "(en)"]
+ app.launch()
+ let no = app.buttons["consent.no"]
+ XCTAssertTrue(no.waitForExistence(timeout: 10))
+ // SwiftUI sheets aren't XCUIElement.sheets; identify the two choices directly.
+ XCTAssertTrue(app.buttons["consent.yes"].exists)
+ XCTAssertEqual(app.staticTexts["consent.title"].label, "Help improve VoiceStudio?")
+ let yes = app.buttons["consent.yes"]
+ XCTAssertEqual(yes.label, "Yes, share anonymous stats")
+ XCTAssertEqual(no.label, "No thanks")
+ XCTAssertEqual(yes.frame.width, no.frame.width, accuracy: 1)
+ XCTAssertFalse(app.buttons["consent.dismiss"].exists)
+ XCTAssertTrue(app.staticTexts["This companion app records your choice on this phone. It sends no analytics."].exists)
+ // First opt in, then prove passive dismissal replaces a prior Yes with No.
+ yes.tap()
+ XCTAssertTrue(app.tabBars.buttons["Settings"].waitForExistence(timeout: 5))
+ app.tabBars.buttons["Settings"].tap()
+ XCTAssertEqual(app.switches["settings.analytics"].value as? String, "1")
+ app.terminate(); app.launch()
+ XCTAssertTrue(app.buttons["consent.no"].waitForExistence(timeout: 10))
+ // Swipe the sheet down, as a person would.
+ app.staticTexts["consent.title"].swipeDown(velocity: .fast)
+ XCTAssertTrue(app.textFields["connect.url"].waitForExistence(timeout: 5))
+ XCTAssertFalse(app.buttons["consent.no"].exists)
+ app.tabBars.buttons["Settings"].tap()
+ XCTAssertEqual(app.switches["settings.analytics"].value as? String, "0")
+ }
+
+ @MainActor func testDictationHasOneControlAndPalettesHaveNoExtraActions() throws {
+ let app = XCUIApplication()
+ app.launchArguments = ["--ui-smoke", "-AppleLanguages", "(en)"]
+ app.launch()
+ connect(app)
+ XCTAssertTrue(app.textViews["speak.text"].waitForExistence(timeout: 5))
+ app.tabBars.buttons["Dictate"].tap()
+ let record = app.buttons["dictate.record"]
+ XCTAssertTrue(record.waitForExistence(timeout: 5))
+ XCTAssertEqual(record.label, "Tap to start")
+ XCTAssertFalse(app.staticTexts["Hold to talk"].exists)
+ XCTAssertEqual(app.buttons.matching(identifier: "dictate.record").count, 1)
+ app.tabBars.buttons["Settings"].tap()
+ let light = app.buttons["settings.palette.light"]
+ XCTAssertTrue(light.waitForExistence(timeout: 5))
+ XCTAssertTrue(app.buttons["settings.palette.dark"].exists)
+ XCTAssertEqual(app.buttons.matching(NSPredicate(format: "label == %@", "Light palette")).count, 1)
+ XCTAssertEqual(app.buttons.matching(NSPredicate(format: "label == %@", "Dark palette")).count, 1)
+ light.tap()
+ app.buttons["choice.option.default"].tap()
+ XCTAssertEqual(light.value as? String, "Studio")
+ light.tap()
+ app.buttons["choice.option.signal"].tap()
+ XCTAssertEqual(light.value as? String, "VoiceStudio Original")
+ }
+
@MainActor func testEveryTabRendersWhileHostInventoryIsLoading() throws {
let app = XCUIApplication()
app.launchArguments = ["--ui-smoke", "--ui-delayed-inventory", "-AppleLanguages", "(en)"]
@@ -33,12 +89,15 @@ final class SmokeTests: XCTestCase {
dismissUsingDone(app)
app.tabBars.buttons["Speak"].tap()
app.buttons["speak.engine"].tap()
+ XCTAssertTrue(search.waitForExistence(timeout: 5))
search.tap(); search.typeText("unmatched-engine")
XCTAssertTrue(app.staticTexts["search.empty"].exists)
dismissUsingDone(app)
app.buttons["Close"].tap()
app.tabBars.buttons["Dub"].tap()
+ XCTAssertEqual(app.buttons["dub.languages"].value as? String, "Choose")
app.buttons["dub.languages"].tap()
+ XCTAssertTrue(search.waitForExistence(timeout: 5))
search.tap(); search.typeText("unmatched-language")
XCTAssertTrue(app.staticTexts["search.empty"].exists)
dismissUsingDone(app)
@@ -50,7 +109,7 @@ final class SmokeTests: XCTestCase {
XCTAssertEqual(download.label, "Download: vs-dub-test.wav")
XCTAssertLessThanOrEqual(download.frame.width, download.frame.height * 1.5)
XCTAssertTrue(app.staticTexts["vs-dub-test.wav"].exists)
- XCTAssertTrue(app.staticTexts.containing(NSPredicate(format: "label CONTAINS %@", "2:05")).firstMatch.exists)
+ XCTAssertEqual(app.staticTexts["dub.metadata.smoke-dub"].label, "Spanish dub, 2:05 long")
}
@MainActor private func connect(_ app: XCUIApplication) {
@@ -79,8 +138,9 @@ final class SmokeTests: XCTestCase {
app.buttons["connect.submit"].tap()
let editor = app.textViews["speak.text"]
XCTAssertTrue(editor.waitForExistence(timeout: 10))
+ XCTAssertEqual(editor.label, "Type what you want to hear…")
+ XCTAssertTrue((editor.value as? String ?? "").isEmpty)
XCTAssertEqual(app.alerts.count, 0)
- XCTAssertEqual(app.sheets.count, 0)
let engine = app.buttons["speak.engine"]
XCTAssertTrue(engine.waitForExistence(timeout: 5))
engine.tap()
@@ -105,6 +165,7 @@ final class SmokeTests: XCTestCase {
XCTAssertTrue(app.buttons["choice.option.spanish"].exists)
app.buttons["Close"].tap()
editor.tap(); editor.typeText("VoiceStudio smoke test")
+ XCTAssertEqual(editor.value as? String, "VoiceStudio smoke test")
dismissUsingDone(app)
app.swipeUp()
app.buttons["speak.generate"].tap()