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.

Merge main into feat/mobile-on-device

debpalashf7bf50b20783
diff --cc .github/workflows/mobile.yml
index 86396caaf,1ca821e80..5fac4ba1e
--- a/.github/workflows/mobile.yml
+++ b/.github/workflows/mobile.yml
@@@ -130,14 -103,24 +130,30 @@@ 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
+ - name: Native video export regression
+ run: |
+ xcodebuild -project mobile/ios/VoiceStudio/VoiceStudio.xcodeproj \
+ -scheme VoiceStudioNative -destination "id=$SIM_UDID" \
+ '-only-testing:VoiceStudioKitTests/phoneVideoMuxPreservesOrientationAndMarksPlayableAudio()' \
+ -parallel-testing-enabled NO CODE_SIGNING_ALLOWED=NO test
+ # 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
diff --cc mobile/ios/VoiceStudio/App/ThemeUI.swift
index a6ab2282e,c994c66a5..ab1f3aedb
--- a/mobile/ios/VoiceStudio/App/ThemeUI.swift
+++ b/mobile/ios/VoiceStudio/App/ThemeUI.swift
@@@ -118,24 -73,34 +118,28 @@@ struct Card<Content: View>: View
struct RootView: View {
@Environment(AppModel.self) private var model
@Environment(\.colorScheme) private var scheme
+ @State private var recovery: String?
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 {
- NavigationStack { HomeView() }.tabItem { StudioTabIcon(title: model.t("nav.home"), systemImage: "house") }
- NavigationStack { VoicesView() }.tabItem { StudioTabIcon(title: model.t("mobile.tabs.voices"), systemImage: "person.wave.2") }
- NavigationStack { DubView() }.tabItem { StudioTabIcon(title: model.t("mobile.tabs.dub"), systemImage: "film") }
- NavigationStack { DictateView() }.tabItem { StudioTabIcon(title: model.t("mobile.tabs.dictate"), systemImage: "mic") }
- NavigationStack { SettingsView() }.tabItem { StudioTabIcon(title: 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)
- .modifier(StudioTabBehavior())
- 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)
++ TabView {
++ NavigationStack { HomeView() }.tabItem { StudioTabIcon(title: model.t("nav.home"), systemImage: "house") }
++ NavigationStack { VoicesView() }.tabItem { StudioTabIcon(title: model.t("mobile.tabs.voices"), systemImage: "person.wave.2") }
++ NavigationStack { DubView() }.tabItem { StudioTabIcon(title: model.t("mobile.tabs.dub"), systemImage: "film") }
++ NavigationStack { DictateView() }.tabItem { StudioTabIcon(title: model.t("mobile.tabs.dictate"), systemImage: "mic") }
++ NavigationStack { SettingsView() }.tabItem { StudioTabIcon(title: model.t("mobile.tabs.settings"), systemImage: "gearshape") }
+ }
++ .id(model.hostState.scopeID)
++ .modifier(StudioTabBehavior())
+ .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)
}
+ .task { await model.phone.refresh() }
.onAppear { NativeTheme.apply(theme) }
.onChange(of: model.theme) { _, _ in NativeTheme.apply(theme) }
.onChange(of: scheme) { _, _ in NativeTheme.apply(theme) }
@@@ -192,48 -128,27 +196,52 @@@ struct ErrorNotice: View
}
struct ConsentView: View {
@Environment(AppModel.self) private var model
+ @Environment(\.vsTheme) private var theme
var body: some View {
- 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"))
+ Page {
+ VStack(alignment: .leading, spacing: VSTokens.spacingGap * 2) {
+ Image(systemName: "waveform").font(.system(size: 52, weight: .medium)).foregroundStyle(theme.color("messageAction")).accessibilityHidden(true)
- Text(model.t("privacy.analytics_title")).font(.largeTitle.bold()).fixedSize(horizontal: false, vertical: true)
- Text(model.t("mobile.consent.phone_note")).font(.title3).foregroundStyle(theme.color("textMuted"))
- Text(model.t("privacy.analytics_subtitle")).foregroundStyle(theme.color("textMuted"))
++ Text(model.t("consent.title")).font(.largeTitle.bold()).fixedSize(horizontal: false, vertical: true)
++ .accessibilityAddTraits(.isHeader).accessibilityIdentifier("consent.title")
++ Text(model.t("consent.body")).font(.title3).foregroundStyle(theme.color("textMuted"))
++ Text(model.t("mobile.android.analytics_local")).foregroundStyle(theme.color("textMuted"))
+ }.padding(.vertical, VSTokens.spacingGap * 2)
+ }.safeAreaInset(edge: .bottom) {
- VStack(spacing: VSTokens.spacingGap) {
- 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")
++ // Exactly two equal choices; dismissing, swiping or Escape records No.
+ ViewThatFits(in: .horizontal) {
+ HStack(spacing: VSTokens.spacingGap) { choice(true); choice(false) }
+ VStack(spacing: VSTokens.spacingGap) { choice(true); choice(false) }
}
+ .padding(Theme.compactInset).background(.bar)
- }.interactiveDismissDisabled()
+ }
+ .accessibilityAction(.escape) { model.chooseConsent(false) }
}
- func choice(_ value: Bool) -> some View {
- Button(model.t(value ? "common.yes" : "common.no")) { model.chooseConsent(value) }
- .studioButton(.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) }
++ }.studioButton(.secondary).accessibilityIdentifier(value ? "consent.yes" : "consent.no")
++ if value { button } else { button.keyboardShortcut(.cancelAction) }
+ }
+}
+
+private struct StudioTabBehavior: ViewModifier {
+ @ViewBuilder func body(content: Content) -> some View {
+ #if compiler(>=6.2)
+ if #available(iOS 26.0, *) { content.tabBarMinimizeBehavior(.onScrollDown) }
+ else { content }
+ #else
+ content
+ #endif
+ }
+}
+
+/// Icon-only tab: a compact dock. The title stays as the accessibility label.
+private struct StudioTabIcon: View {
+ let title: String
+ let systemImage: String
+ var body: some View {
+ Image(systemName: systemImage).accessibilityLabel(title)
}
}
diff --cc mobile/ios/VoiceStudio/Features/DictateView.swift
index ba1055e2c,3cf439f3f..80c5c9995
--- a/mobile/ios/VoiceStudio/Features/DictateView.swift
+++ b/mobile/ios/VoiceStudio/Features/DictateView.swift
@@@ -68,37 -51,12 +68,37 @@@ struct DictateView: View
.refreshable { await readiness() }
.onDisappear { capturing?.cancel(); receiving?.cancel(); audio.stop(); listening = false; finalizing = false; Task { await stream.close() } }
}
+ private var recordControl: some View {
+ Button {
+ guard !suppressTap else { return }
+ if listening { stop() } else { start() }
+ } label: {
+ Image(systemName: listening ? "stop.fill" : "mic.fill")
+ .font(.largeTitle).symbolEffect(.pulse, isActive: listening && !reduceMotion).frame(width: 88, height: 88)
+ .foregroundStyle(theme.color("messageActionForeground"))
+ .background(theme.color("messageAction"), in: Circle())
+ }.buttonStyle(.plain).frame(maxWidth: .infinity, minHeight: 104)
+ .disabled(!ready || finalizing || model.phone.activeDub != nil)
- .accessibilityLabel(model.t(listening ? "common.stop" : "mobile.simple.microphone"))
++ .accessibilityLabel(model.t(listening ? "common.stop" : "mobile.dictate.tap_to_start")).accessibilityHint(model.t("mobile.dictate.hold_to_talk"))
+ .accessibilityIdentifier("dictate.record")
+ .onLongPressGesture(minimumDuration: 0.2, pressing: { pressed in
+ if !pressed && holding {
+ holding = false; if listening { stop() }
+ Task { try? await Task.sleep(for: .milliseconds(150)); suppressTap = false }
+ }
+ }, perform: { holding = true; suppressTap = true; if !listening && ready { start() } })
+ }
private func readiness() async {
let scope = model.hostState.scopeID
+ let selectedRoute = route
checking = true; defer { checking = false }
+ if route != .computer {
+ ready = route == .phone; reason = ready ? "" : model.t("mobile.local.model_required")
+ return
+ }
do {
let status = try await model.api().readiness()
- guard scope == model.hostState.scopeID else { return }
+ guard scope == model.hostState.scopeID, selectedRoute == route else { return }
ready = status.ready; reason = status.reason(l10n: model.l10n)
}
catch is CancellationError {}
diff --cc mobile/ios/VoiceStudio/Features/DubView.swift
index 95612a66f,e0b10f041..dc4641c89
--- a/mobile/ios/VoiceStudio/Features/DubView.swift
+++ b/mobile/ios/VoiceStudio/Features/DubView.swift
@@@ -33,24 -15,39 +33,24 @@@ struct ComputerDubView: View
@State private var shared: SharedFile?
@State private var saved: SharedFile?
var languages: [DubLanguage] { model.languages.dubOptions }
- private var filteredLanguages: [MobileLanguage] { model.languages.search(languageQuery, includeAuto: false) }
var body: some View {
Page {
- Text(model.t("mobile.dub.runs_on_host"))
- Card {
- Button(model.t("mobile.dub.pick_media"), systemImage: "doc.badge.plus") { importing = true }
- if let selectedFile { SelectedFileRow(name: selectedFile.name) { self.selectedFile = nil } }
+ if model.connection.client == nil { NavigationLink(model.t("mobile.settings.connection")) { ConnectView() } }
+ if let selectedFile { DubFileCard(name: selectedFile.name) { self.selectedFile = nil } }
+ else { DubSourceButton { importing = true } }
+ HStack(spacing: VSTokens.spacingGap) {
+ Image(systemName: "link").foregroundStyle(theme.color("iconMuted")).accessibilityHidden(true)
TextField(model.t("mobile.dub.paste_url"), text: $sourceURL).keyboardType(.URL).textInputAutocapitalization(.never).autocorrectionDisabled().accessibilityIdentifier("dub.source_url")
+ }
+ DubTiles {
Button { selectingLanguages = true } label: {
- TileLabel(icon: "globe", 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) {
- ForEach(languages.filter { selected.contains($0.code) }) { language in
- Button { selected.remove(language.code) } label: {
- HStack(spacing: VSTokens.spacingGap) { Text(language.name); Image(systemName: "xmark") }
- }.accessibilityLabel(model.t("mobile.dub.remove_language", ["language": language.name]))
- }
- }
- }
- VoicePicker(selection: $profile, dubbing: true)
- Button(model.t("mobile.dub.start")) { Task { await start() } }
- .buttonStyle(VSButtonStyle(kind: .primary)).disabled(profile == DubVoiceChoice.unselected || model.busy || upload.pending != nil || selected.isEmpty || (selectedFile == nil && sourceURL.isEmpty) || model.dub.monitoring)
++ TileLabel(icon: "globe", label: model.t("mobile.dub.target_languages"), value: {let names = languages.filter { selected.contains($0.code) }.map(\.name); return names.isEmpty ? model.t("mobile.android.choose") : ListFormatter.localizedString(byJoining: names)}())
+ }.studioButton(.tertiary).accessibilityIdentifier("dub.languages")
+ VoicePicker(selection: $profile, dubbing: true, tile: true)
}
if let pending = upload.pending {
- Card {
- if let name = pending.filename { Text(name).lineLimit(1).truncationMode(.middle) }
- Text(model.t("mobile.dub.uploading", ["percent": String(Int(upload.fraction * 100))]))
- ProgressView(value: upload.fraction).accessibilityLabel(model.t("mobile.ios.progress"))
- Text(model.t("mobile.ios.upload_pending"))
- Button(model.t("mobile.ios.upload_cancel"), role: .destructive) { Task { await upload.cancel() } }
+ DubJobCard(title: pending.filename ?? model.t("mobile.tabs.dub"), stage: model.t("mobile.dub.uploading", ["percent": String(Int(upload.fraction * 100))]), fraction: upload.fraction) {
+ Button(model.t("mobile.ios.upload_cancel"), systemImage: "xmark", role: .destructive) { Task { await upload.cancel() } }
}
}
if let engine = model.dub.pendingTranslation {
@@@ -140,8 -164,8 +140,8 @@@
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))
+ .font(.caption)
.foregroundStyle(theme.color("textMuted")).lineLimit(1).truncationMode(.tail)
}.frame(maxWidth: .infinity, alignment: .leading)
}
diff --cc mobile/ios/VoiceStudio/Features/PhoneDubView.swift
index 1b4173a65,000000000..4ac455f54
mode 100644,000000..100644
--- a/mobile/ios/VoiceStudio/Features/PhoneDubView.swift
+++ b/mobile/ios/VoiceStudio/Features/PhoneDubView.swift
@@@ -1,142 -1,0 +1,142 @@@
+import SwiftUI
+import VoiceStudioKit
+import UniformTypeIdentifiers
+import AVKit
+
+struct PhoneDubView: View {
+ var projectID: UUID? = nil
+ var libraryOnly = false
+ private var records: [PhoneDubRecord] { model.phone.dubs.filter { projectID == nil || $0.id == projectID } }
+ @Environment(AppModel.self) private var model
+ @Environment(\.vsTheme) private var theme
+ var connect = false
+ @State private var source: SelectedMedia?
+ @State private var importing = false
+ @State private var targets = Set<String>()
+ @State private var languages = false
+ @State private var voice = ""
+ @State private var consent = false
+ @State private var audioOnly = false
+ @State private var shared: SharedFile?
+ @State private var saved: SharedFile?
+ @State private var playing: SharedFile?
+ @State private var creating: Task<Void,Never>?
+ @State private var copying = false
+ private var choices: [DubLanguage] { model.languages.dubOptions }
+ private var ready: Bool { model.phone.dubReady && !connect }
+ var body: some View {
+ Page {
+ if projectID == nil && !libraryOnly {
+ if connect { NavigationLink(model.t("mobile.simple.reconnect")) { ConnectView() } }
+ Group {
+ if let source { DubFileCard(name: source.name) { self.source = nil } }
+ else { DubSourceButton { importing = true } }
+ }.disabled(copying)
+ DubTiles {
+ Button { languages = true } label: {
- TileLabel(icon: "globe", label: model.t("mobile.dub.target_languages"), value: ListFormatter.localizedString(byJoining: choices.filter { targets.contains($0.code) }.map(\.name)))
++ TileLabel(icon: "globe", label: model.t("mobile.dub.target_languages"), value: {let names = choices.filter { targets.contains($0.code) }.map(\.name); return names.isEmpty ? model.t("mobile.android.choose") : ListFormatter.localizedString(byJoining: names)}())
+ }.studioButton(.tertiary).accessibilityIdentifier("dub.languages")
+ ChoicePicker(label: model.t("mobile.speak.voice"), selection: $voice, options: [SelectionOption(id: "", title: model.t("mobile.simple.reference"))] + model.phone.voices.map { SelectionOption(id: $0.id.uuidString, title: $0.name) }, icon: "person.wave.2", tile: true)
+ }
+ DubConsentRow(isOn: $consent)
+ DisclosureGroup {
+ Toggle(model.t("mobile.simple.audio_only"), isOn: $audioOnly).frame(minHeight: 44)
+ phoneModel("dub-asr", .asr)
+ phoneModel("dub-translate", .translate)
+ phoneModel("dub", .clone)
+ } label: { Label(model.t("mobile.simple.more"), systemImage: "slider.horizontal.3") }
+ .padding(.horizontal, Theme.compactInset)
+ .disabled(copying || model.phone.activeDub != nil)
+ if !ready { LocalDownloadPrompt(items: model.phone.dubModels, feature: "mobile.tabs.dub", compact: true) }
+ if copying { ProgressView().accessibilityLabel(model.t("mobile.ios.progress")) }
+ }
+ if !records.isEmpty || libraryOnly || projectID != nil {
+ Text(model.t("mobile.dub.history")).font(.headline)
+ Group {
+ ForEach(records.filter { !$0.checkpoint.done }) { record in
+ let progress = model.phone.activeDub == record.id ? model.phone.dubProgress : nil
+ let percent = progress?.percent ?? record.checkpoint.percent
+ DubJobCard(title: record.request.title, stage: model.t(progress?.stage ?? record.checkpoint.stage), fraction: Double(percent) / 100, running: model.phone.activeDub == record.id) {
+ if model.phone.activeDub == record.id {
+ Button(model.t("common.cancel"), systemImage: "xmark") { model.phone.cancelDub() }
+ } else {
+ Button(model.t("mobile.simple.resume"), systemImage: "play.fill") { model.phone.startDub(record.id) }.disabled(model.phone.activeDub != nil || model.busy)
+ Button(model.t("mobile.simple.remove_job"), systemImage: "trash", role: .destructive) { remove(record) }.labelStyle(.iconOnly)
+ }
+ }
+ }
+ if records.isEmpty { EmptyState(key: "mobile.simple.empty_dubs",icon: "film") }
+ ForEach(records) { record in
+ ForEach(record.checkpoint.outputs) { output in
+ HStack {
+ Image(systemName: "film").foregroundStyle(theme.color("messageAction")).frame(width: 32).accessibilityHidden(true)
+ VStack(alignment: .leading) { Text(record.request.title).lineLimit(1); Text(output.name).font(.caption).foregroundStyle(theme.color("textMuted")) }.frame(maxWidth: .infinity,alignment: .leading)
+ Button(model.t("common.play"),systemImage: "play.fill") { open(record,output,action: .play) }
+ Button(model.t("mobile.speak.share"),systemImage: "square.and.arrow.up") { open(record,output,action: .share) }
+ Button(model.t("common.save"),systemImage: "arrow.down.to.line") { open(record,output,action: .save) }
+ if record.checkpoint.done { Button(model.t("mobile.simple.remove_job"),systemImage: "trash",role: .destructive) { remove(record) } }
+ }.labelStyle(.iconOnly).studioButton(.tertiary)
+ }
+ }
+ }
+ }
+ }
+ .navigationTitle(projectID != nil ? (records.first?.request.title ?? model.t("projects.title")) : model.t(libraryOnly ? "projects.title" : "mobile.tabs.dub")).navigationBarTitleDisplayMode(.inline)
+ .safeAreaInset(edge: .bottom, spacing: 0) {
+ if projectID == nil && !libraryOnly {
+ DubStartButton(busy: copying || model.phone.activeDub != nil, action: start)
+ .disabled(!ready || !consent || source == nil || targets.isEmpty || model.busy || copying || model.phone.activeDub != nil)
+ }
+ }
+ .fileImporter(isPresented: $importing,allowedContentTypes: [.movie,.audio]) { result in
+ switch result { case .success(let url): source = SelectedMedia(url: url); case .failure: model.error = ClientError("mobile.simple.media_failed") }
+ }
+ .sheet(isPresented: $languages) {
+ LanguageSelectionSheet(selection: targets, includesUnavailable: false) { targets = $0 }
+ }
+ .sheet(item: $shared) { file in ShareSheet(items: [file.url]) }
+ .sheet(item: $saved) { file in SaveFileSheet(url: file.url) }
+ .sheet(item: $playing) { file in PhoneDubPlayback(url: file.url) }
+ .onChange(of: model.phone.voices) { _, voices in if !voices.contains(where: { $0.id.uuidString == voice }) { voice = "" } }
+ .refreshable { await model.phone.refresh() }
+ .onDisappear { creating?.cancel() }
+ }
+ private func phoneModel(_ task: String,_ capability: ModelCapability) -> some View {
+ ChoicePicker(label: model.t("mobile.simple."+capability.rawValue),selection: Binding(get: { model.phone.selectedModel(task,capability)?.id ?? "" },set: { model.phone.chooseModel(task,$0) }),options: model.phone.candidates(capability).map { SelectionOption(id: $0.id,title: $0.name,subtitle: model.t("mobile.simple." + $0.capability.rawValue),enabled: $0.fits()) })
+ }
+ private func start() {
+ guard let source else { return }
+ let selectedModels = model.phone.dubModels, selectedTargets = choices.filter { targets.contains($0.code) }.map { PhoneDubTarget(code: $0.code,name: $0.name) }
+ let chosenVoice = model.phone.voices.first { $0.id.uuidString == voice }, exportAudio = audioOnly
+ copying = true
+ creating = Task {
+ defer { copying = false }
+ await model.performPhone {
+ guard let store = model.phone.dubStore else { throw ClientError("mobile.simple.checkpoint_failed") }
+ let reference: PCMChunk?
+ if let chosenVoice { reference = try await model.phone.voiceStore?.reference(chosenVoice) } else { reference = nil }
+ let request = try await store.create(source: source.url,title: source.name,targets: selectedTargets,models: selectedModels,consent: consent,reference: reference,referenceText: chosenVoice?.transcript,audioOnly: exportAudio)
+ self.source = nil; consent = false; await model.phone.refresh(); model.phone.startDub(request.id)
+ }
+ }
+ }
+ private enum OutputAction { case play,share,save }
+ private func open(_ record: PhoneDubRecord,_ output: PhoneDubOutput,action: OutputAction) {
+ Task { await model.performPhone {
+ guard let store = model.phone.dubStore else { throw ClientError("mobile.simple.media_failed") }
+ let url = try await store.verifiedOutput(record.id,output)
+ let file = SharedFile(url: url)
+ switch action { case .play: playing = file; case .share: shared = file; case .save: saved = file }
+ } }
+ }
+ private func remove(_ record: PhoneDubRecord) {
+ Task { await model.performPhone { try await model.phone.dubStore?.delete(record.id); await model.phone.refresh() } }
+ }
+}
+private struct PhoneDubPlayback: View {
+ let url: URL
+ @State private var player: AVPlayer?
+ var body: some View {
+ VideoPlayer(player: player).onAppear { player = AVPlayer(url: url); player?.play() }.onDisappear { player?.pause(); player = nil }
+ }
+}
diff --cc mobile/ios/VoiceStudio/Features/SettingsView.swift
index b2e885019,1597dae21..833f11fea
--- a/mobile/ios/VoiceStudio/Features/SettingsView.swift
+++ b/mobile/ios/VoiceStudio/Features/SettingsView.swift
@@@ -3,51 -3,60 +3,51 @@@ import VoiceStudioKi
struct SettingsView: View {
@Environment(AppModel.self) private var model
+ @Environment(\.vsTheme) private var theme
var body: some View {
@Bindable var model = model
- Page {
+ Form {
+ Section {
+ NavigationLink { ConnectView() } label: {
+ LabeledContent {
+ Text(model.connection.active?.label ?? "").foregroundStyle(theme.color("textMuted"))
+ } label: { Label(model.t("mobile.settings.connection"), systemImage: "link") }
+ }.accessibilityIdentifier("settings.connect")
+ NavigationLink { ModelsView() } label: { Label(model.t("mobile.local.models"),systemImage: "arrow.down.circle") }
+ }
if model.connection.client != nil {
- Card {
- Text(model.t("mobile.settings.connection"))
- if let host = model.connection.active { Text(model.t("mobile.connect.connected_to", ["host": host.label])) }
- NavigationLink(model.t("mobile.connect.saved_hosts")) { ConnectView() }.disabled(model.busy || BackgroundUpload.shared.pending != nil)
- Button(model.t("mobile.connect.disconnect"), role: .destructive) { Task { await model.perform(connectionChange: true) { model.pauseMonitor(); await BackgroundUpload.shared.cancel(); try await model.connection.disconnect(); model.profiles = []; model.history = []; model.dubHistory = []; model.inventory = nil } } }.disabled(model.busy)
+ Section {
+ NavigationLink { ConnectView() } label: { Label(model.t("mobile.connect.saved_hosts"),systemImage: "desktopcomputer") }.disabled(model.busy || BackgroundUpload.shared.pending != nil)
+ Button(model.t("mobile.connect.disconnect"), systemImage: "personalhotspot.slash", role: .destructive) { Task { await model.perform(connectionChange: true) { model.pauseMonitor(); await BackgroundUpload.shared.cancel(); try await model.connection.disconnect(); model.profiles = []; model.history = []; model.dubHistory = []; model.inventory = nil } } }.disabled(model.busy)
}
- 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, appearance: .light)
- palette(key: "mobile.settings.dark_palette", selection: $model.theme.darkPalette, appearance: .dark)
+ }
+ Section {
+ 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)) }, icon: "circle.lefthalf.filled")
+ palette(key: "mobile.settings.light_palette", selection: $model.theme.lightPalette)
+ palette(key: "mobile.settings.dark_palette", selection: $model.theme.darkPalette)
+
}
- Card {
+ Section {
ChoicePicker(label: model.t("mobile.settings.language"), selection: $model.language, options:
- [SelectionOption(id: "", title: model.t("mobile.ios.language_system"))] + L10n.languages.map { SelectionOption(id: $0, title: Locale(identifier: $0).localizedString(forIdentifier: $0) ?? $0) }).accessibilityIdentifier("settings.language")
- Toggle(model.t("mobile.settings.notifications"), isOn: Binding(get: { model.notifications }, set: { value in Task { await model.enableNotifications(value) } })).frame(minHeight: 44)
- Text(model.t("mobile.settings.notifications_help"))
+ [SelectionOption(id: "", title: model.t("mobile.ios.language_system"))] + L10n.languages.map { SelectionOption(id: $0, title: Locale(identifier: $0).localizedString(forIdentifier: $0) ?? $0) }, icon: "globe").accessibilityIdentifier("settings.language")
+ Toggle(isOn: Binding(get: { model.notifications }, set: { value in Task { await model.enableNotifications(value) } })) { Label(model.t("mobile.settings.notifications"),systemImage: "bell") }.frame(minHeight: 44)
}
+ Section {
+ InfoButton(title: model.t("mobile.simple.privacy"), detail: model.t("mobile.local.privacy"), row: true, icon: "shield")
- Toggle(isOn: $model.analytics) { Label(model.t("mobile.simple.analytics"),systemImage: "chart.bar") }.frame(minHeight: 44)
++ Toggle(isOn: $model.analytics) { Label(model.t("mobile.simple.analytics"),systemImage: "chart.bar") }.frame(minHeight: 44).accessibilityIdentifier("settings.analytics")
}
- Card {
- Text(model.t("mobile.settings.privacy"))
- Text(model.t("mobile.settings.privacy_help"))
- 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"))
- Text(model.t("mobile.settings.version", ["version": Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? model.t("common.unknown")]))
- NavigationLink(model.t("mobile.settings.licenses")) { LicensesView() }
+ Section {
+ HStack { Label(model.t("mobile.ios.app_name"),systemImage: "info.circle"); Spacer(); Text(Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? model.t("common.unknown")) }
+ NavigationLink { LicensesView() } label: { Label(model.t("mobile.settings.licenses"),systemImage: "doc.text") }
if let host = model.connection.active {
- Link(model.t("mobile.ios.model_licenses"), destination: host.url)
- Text(model.t("mobile.ios.licenses_host"))
+ Link(destination: host.url) { Label(model.t("mobile.ios.model_licenses"),systemImage: "doc.badge.gearshape") }
}
}
- }.navigationTitle(model.t("mobile.tabs.settings")).navigationBarTitleDisplayMode(.large)
+ }.scrollContentBackground(.hidden).background(theme.color("canvas").ignoresSafeArea())
+ .studioNavigationTitle(model.t("mobile.tabs.settings"))
}
- 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)
- }
+ 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), swatch: Theme(palette: $0.id, appearance: key == "mobile.settings.light_palette" ? .light : .dark)) }, icon: "paintpalette").accessibilityIdentifier(key)
++ ChoicePicker(label: model.t(key), selection: selection, options: VSTokens.palettes.map { SelectionOption(id: $0.id, title: Theme.paletteLabel($0, l10n: model.l10n), swatch: Theme(palette: $0.id, appearance: key == "mobile.settings.light_palette" ? .light : .dark)) }, icon: "paintpalette").accessibilityIdentifier("settings.palette." + (key == "mobile.settings.light_palette" ? "light" : "dark"))
}
}
struct LicensesView: View {
diff --cc mobile/ios/VoiceStudioKit/Tests/VoiceStudioKitTests/ContractTests.swift
index 5af6107f9,4710cef71..ec91795cc
--- a/mobile/ios/VoiceStudioKit/Tests/VoiceStudioKitTests/ContractTests.swift
+++ b/mobile/ios/VoiceStudioKit/Tests/VoiceStudioKitTests/ContractTests.swift
@@@ -61,13 -61,9 +61,13 @@@ 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|sidebarTools)\.[a-zA-Z0-9_.-]+)""#
- let pattern = #""((?:mobile|common|consent|privacy|player|themeAppearance)\.[a-zA-Z0-9_.]+)""#
++ let pattern = #""((?:mobile|common|consent|privacy|player|themeAppearance|sidebarTools)\.[a-zA-Z0-9_.-]+)""#
let regex = try NSRegularExpression(pattern: pattern)
let dynamic: [String: [String]] = [
+ "mobile.simple.": ["tts", "asr", "asr-stream", "clone", "translate"],
+ "mobile.local.": [],
+ "mobile.local.category.": ["commercial-ok", "conditional", "non-commercial", "unidentified"],
+ "mobile.local.right_": ["commercial", "outputs", "redistribution", "voice", "unknown", "restricted"],
"mobile.settings.mode_": ThemeMode.allCases.map(\.rawValue),
"mobile.ios.dub_stages.": ["preparing", "transcribing", "translating", "rendering", "done", "failed", "cancelled"]
]
diff --cc mobile/ios/VoiceStudioUITests/PhoneScreens.swift
index c98a9a942,000000000..35319e9a6
mode 100644,000000..100644
--- a/mobile/ios/VoiceStudioUITests/PhoneScreens.swift
+++ b/mobile/ios/VoiceStudioUITests/PhoneScreens.swift
@@@ -1,153 -1,0 +1,153 @@@
+import XCTest
+
+final class PhoneScreens: XCTestCase {
+ @MainActor private func launch(extra: [String] = []) -> XCUIApplication {
+ let app = XCUIApplication(); app.launchArguments = ["--ui-smoke","-AppleLanguages","(en)"] + extra
+ app.launch(); XCTAssertTrue(app.buttons["consent.no"].waitForExistence(timeout: 10)); app.buttons["consent.no"].tap()
+ app.openSpeak()
+ return app
+ }
+ @MainActor func testRememberedComputerChoiceFallsBackWhileUnpaired() {
+ let app = launch(extra: ["-run-on.speak","computer","-run-on.clone","computer","-run-on.dub","computer"])
+ XCTAssertTrue(app.buttons["models.get"].exists)
+ app.tabButton("Voices").tap(); app.buttons["voices.create"].tap()
+ XCTAssertTrue(app.buttons["models.get"].waitForExistence(timeout: 5)); app.buttons["Cancel"].tap()
+ app.tabButton("Dub").tap()
+ XCTAssertTrue(app.buttons["Choose video or audio"].waitForExistence(timeout: 5))
+ XCTAssertFalse(app.textFields["dub.source_url"].exists)
+ }
+ @MainActor func testChangingSpeechModelResetsUnavailablePreset() {
+ let app = launch()
+ app.buttons["Models"].tap(); app.buttons["choice.option.kokoro-multi-int8"].tap()
+ app.buttons["Voice"].tap()
+ let search = app.textFields.firstMatch
+ XCTAssertTrue(search.waitForExistence(timeout: 5)); search.tap(); search.typeText("Voice 103")
+ app.buttons["choice.option.102"].tap()
+ XCTAssertEqual(app.buttons["Voice"].value as? String,"Voice 103")
+ app.buttons["Models"].tap(); app.buttons["choice.option.kitten-mini-en-fp16"].tap()
+ app.buttons["Voice"].tap()
+ XCTAssertEqual(app.buttons["choice.option.0"].value as? String,"Selected")
+ XCTAssertFalse(app.buttons["choice.option.102"].exists)
+ }
+ @MainActor func testUnpairedCloneShowsModelGateAndConsent() {
+ let app = launch(); app.tabButton("Voices").tap(); app.buttons["voices.create"].tap()
+ XCTAssertTrue(app.textFields["voices.clone.name"].waitForExistence(timeout: 5))
+ XCTAssertTrue(app.buttons["models.get"].exists)
+ XCTAssertTrue(app.switches["I have permission"].exists)
+ XCTAssertFalse(app.buttons["Create clone"].isEnabled)
+ XCTAssertFalse(app.staticTexts["This task currently runs on your paired computer."].exists)
+ }
+ @MainActor func testUnpairedDubKeepsSetupVisibleAndRequiresInput() {
+ let app = launch(); app.tabButton("Dub").tap()
+ XCTAssertTrue(app.buttons["Choose video or audio"].waitForExistence(timeout: 5))
+ for label in ["Choose video or audio", "dub.languages", "Voice", "models.get"] {
+ XCTAssertTrue(app.buttons[label].isHittable, label)
+ }
+ XCTAssertTrue(app.switches["I have permission"].isHittable)
+ XCTAssertGreaterThanOrEqual(app.buttons["models.get"].frame.height, 44)
+ XCTAssertFalse(app.buttons["dub.start"].isEnabled)
+ XCTAssertLessThan(app.buttons["dub.start"].frame.height, 72)
+ XCTAssertFalse(app.textFields["dub.source_url"].exists)
+ }
+ @MainActor func testModelsTermsRequireExplicitUncheckedConsent() {
+ let app = launch(); app.tabButton("Settings").tap(); app.buttons["Models"].tap()
+ let licence = app.buttons["model.licence.kitten-mini-en-fp16"]
+ XCTAssertTrue(licence.waitForExistence(timeout: 5)); licence.tap()
+ let accept = app.buttons["models.accept"]
+ XCTAssertTrue(accept.waitForExistence(timeout: 5))
+ XCTAssertTrue(accept.isHittable)
+ let consent = app.switches["models.consent"]
+ for _ in 0..<15 { if consent.isHittable { break }; app.swipeUp() }
+ XCTAssertTrue(accept.exists); XCTAssertFalse(accept.isEnabled)
+ XCTAssertTrue(consent.exists)
+ // A long native toggle label spans the row; activate the switch thumb.
+ consent.coordinate(withNormalizedOffset: CGVector(dx: 0.92, dy: 0.5)).tap()
+ let image = XCTAttachment(screenshot: app.screenshot()); image.name = "Licence-confirmation"; image.lifetime = .keepAlways; add(image)
+ XCTAssertTrue(accept.wait(for: \.isEnabled, toEqual: true, timeout: 3))
+ for _ in 0..<15 { if app.buttons["Close"].isHittable { break }; app.swipeDown() }
+ app.buttons["Close"].tap()
+ licence.tap()
+ XCTAssertTrue(accept.waitForExistence(timeout: 5)); XCTAssertFalse(accept.isEnabled)
+ app.buttons["Close"].tap()
+ }
+ @MainActor func testCompactDownloadsUseProductNamesAndOneDubAction() {
+ let app = launch()
+ XCTAssertEqual(app.buttons.matching(identifier: "models.get").count, 1)
+ XCTAssertFalse(app.staticTexts["kitten-mini-en-fp16"].exists)
+ XCTAssertTrue(app.buttons["models.open"].label.contains("Kitten"))
+ app.buttons["models.get"].tap()
+ XCTAssertTrue(app.buttons["models.accept"].waitForExistence(timeout: 5))
+ XCTAssertFalse(app.buttons["models.accept"].isEnabled)
+ app.buttons["Close"].tap()
+ app.tabButton("Dub").tap()
+ XCTAssertEqual(app.buttons.matching(identifier: "models.get").count, 1)
+ XCTAssertTrue(app.buttons["models.open"].label.contains("3 downloads"))
+ XCTAssertFalse(app.staticTexts["NOASSERTION"].exists)
+ XCTAssertFalse(app.navigationBars.buttons["Settings"].exists)
+ }
+ @MainActor func testPaletteSelectionAndDictationActionsClearTheTabBar() {
+ let app = launch(); app.tabButton("Dictate").tap()
+ let navigation = ["Home", "Voices", "Dub", "Dictate", "Settings"].map { app.tabButton($0) }
+ for identifier in ["dictate.copy", "dictate.share"] {
+ let action = app.buttons[identifier]
+ XCTAssertTrue(action.exists)
+ for tab in navigation {
+ XCTAssertTrue(tab.exists)
+ XCTAssertFalse(action.frame.intersects(tab.frame), "Dictation action overlaps navigation")
+ }
+ }
+ app.tabButton("Settings").tap()
- app.buttons["mobile.settings.light_palette"].tap()
++ app.buttons["settings.palette.light"].tap()
+ let studio = app.buttons["choice.option.default"]
+ XCTAssertTrue(studio.waitForExistence(timeout: 5)); XCTAssertEqual(studio.value as? String, "Selected")
+ app.buttons["choice.option.canopy"].tap()
- app.buttons["mobile.settings.light_palette"].tap()
++ app.buttons["settings.palette.light"].tap()
+ XCTAssertEqual(app.buttons["choice.option.canopy"].value as? String, "Selected")
+ }
+ @MainActor func testConnectAndPrivacyKeepDetailsCollapsed() {
+ let app = launch(); app.tabButton("Settings").tap()
+ XCTAssertFalse(app.staticTexts.containing(NSPredicate(format: "label BEGINSWITH %@","On-device tasks send nothing")).firstMatch.exists)
+ app.buttons["settings.connect"].tap()
+ XCTAssertTrue(app.buttons["Scan QR code"].exists)
+ XCTAssertFalse(app.textFields["connect.url"].exists)
+ app.buttons["Enter address"].tap(); XCTAssertTrue(app.textFields["connect.url"].exists)
+ XCTAssertFalse(app.secureTextFields.firstMatch.exists)
+ app.buttons["More"].tap(); XCTAssertTrue(app.secureTextFields.firstMatch.exists)
+ }
+}
+
+/// Xcode test attachments are the reviewable screen tour; no screenshots are fabricated by CLT checks.
- final class ScreenshotTour: XCTestCase {
++final class PhoneScreenshotTour: XCTestCase {
+ @MainActor private func capture(_ name: String,_ app: XCUIApplication) {
+ let attachment = XCTAttachment(screenshot: app.screenshot()); attachment.name = name; attachment.lifetime = .keepAlways; add(attachment)
+ }
+ @MainActor func testPhoneFirstScreens() {
+ let app = XCUIApplication(); app.launchArguments = ["--ui-smoke","-AppleLanguages","(en)"]
- app.launch(); XCTAssertTrue(app.buttons["consent.no"].waitForExistence(timeout: 10)); XCTAssertTrue(app.staticTexts["Saved on this phone. Nothing is sent."].exists); capture("Consent",app); app.buttons["consent.no"].tap(); capture("Home",app); app.openSpeak()
++ app.launch(); XCTAssertTrue(app.buttons["consent.no"].waitForExistence(timeout: 10)); XCTAssertTrue(app.staticTexts["This companion app records your choice on this phone. It sends no analytics."].exists); capture("Consent",app); app.buttons["consent.no"].tap(); capture("Home",app); app.openSpeak()
+ XCTAssertTrue(app.textViews["speak.text"].waitForExistence(timeout: 5)); capture("Speak-phone",app)
+ app.tabButton("Voices").tap(); capture("Voices-phone",app)
+ app.buttons["voices.create"].tap(); XCTAssertTrue(app.textFields["voices.clone.name"].waitForExistence(timeout: 5)); capture("Clone-phone",app); app.buttons["Cancel"].tap()
+ app.tabButton("Dub").tap(); XCTAssertEqual(app.buttons.matching(identifier: "models.get").count, 1); capture("Dub-phone",app)
+ app.tabButton("Dictate").tap(); capture("Dictate-phone",app)
+ app.tabButton("Settings").tap(); capture("Settings",app)
- app.buttons["mobile.settings.light_palette"].tap()
++ app.buttons["settings.palette.light"].tap()
+ XCTAssertTrue(app.buttons["choice.option.default"].waitForExistence(timeout: 5)); capture("Palette-picker",app); app.buttons["Close"].tap()
+ app.buttons["Language"].tap(); capture("Language-picker",app); app.buttons["Close"].tap()
+ app.buttons["Models"].tap(); capture("Models",app)
+ app.buttons["model.licence.kitten-mini-en-fp16"].tap(); capture("Model-terms",app); app.buttons["Close"].tap()
+ let adaptiveBack = app.buttons["BackButton"]
+ if adaptiveBack.exists { adaptiveBack.tap() } else { app.navigationBars.buttons.firstMatch.tap() }
+ XCTAssertTrue(app.buttons["settings.connect"].waitForExistence(timeout: 5))
+ app.buttons["settings.connect"].tap(); capture("Connect",app)
+ app.buttons["Enter address"].tap(); capture("Connect-address",app)
+ }
+ @MainActor func testPairedComputerScreens() {
+ let app = XCUIApplication(); app.launchArguments = ["--ui-smoke","-AppleLanguages","(en)"]
+ app.launch(); XCTAssertTrue(app.buttons["consent.no"].waitForExistence(timeout: 10)); app.buttons["consent.no"].tap()
+ app.tabButton("Settings").tap(); app.buttons["settings.connect"].tap(); app.buttons["Enter address"].tap()
+ let address = app.textFields["connect.url"]; address.tap(); address.typeText("http://127.0.0.1:3900")
+ app.buttons["keyboard.done"].tap(); app.buttons["connect.submit"].tap(); app.openSpeak()
+ XCTAssertTrue(app.textViews["speak.text"].waitForExistence(timeout: 10)); capture("Speak-computer",app)
+ for tab in ["Voices","Dub","Dictate"] { app.tabButton(tab).tap(); capture(tab+"-computer",app) }
+ }
+}
diff --cc mobile/ios/VoiceStudioUITests/ScreenshotTour.swift
index 000000000,73c9a7fe8..f03a99fc6
mode 000000,100644..100644
--- a/mobile/ios/VoiceStudioUITests/ScreenshotTour.swift
+++ b/mobile/ios/VoiceStudioUITests/ScreenshotTour.swift
@@@ -1,0 -1,72 +1,78 @@@
+ 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()
+
++ XCTAssertTrue(app.navigationBars["Home"].waitForExistence(timeout: 5))
++ shot(app, "02-home")
++ app.tabBars.buttons["Settings"].tap()
++ app.buttons["settings.connect"].tap()
++ app.buttons["Enter address"].tap()
+ let address = app.textFields["connect.url"]
+ XCTAssertTrue(address.waitForExistence(timeout: 5))
- shot(app, "02-connect")
++ shot(app, "03-connect")
+ address.tap(); address.typeText("http://127.0.0.1:3900")
- shot(app, "03-connect-keyboard")
++ shot(app, "03a-connect-keyboard")
+ if app.buttons["keyboard.done"].waitForExistence(timeout: 3) { app.buttons["keyboard.done"].tap() }
+ app.swipeUp()
+ app.buttons["connect.submit"].tap()
++ app.openSpeak()
+
+ 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 --cc mobile/ios/VoiceStudioUITests/SmokeTests.swift
index 58335a4f9,4f1463c48..014e6e692
--- a/mobile/ios/VoiceStudioUITests/SmokeTests.swift
+++ b/mobile/ios/VoiceStudioUITests/SmokeTests.swift
@@@ -1,89 -1,62 +1,146 @@@
import XCTest
+extension XCUIApplication {
+ /// Native TabView can expose either a bottom tab bar or an adaptive side rail.
+ @MainActor func tabButton(_ label: String) -> XCUIElement {
+ let tab = tabBars.buttons[label]
+ if tab.exists { return tab }
+ // iOS 26+ collapses the bar after scrolling. Its selected tab expands it.
+ let selected = tabBars.buttons.firstMatch
+ if selected.exists, (selected.value as? String)?.contains("Collapsed") == true {
+ selected.tap()
+ if tab.waitForExistence(timeout: 3) { return tab }
+ }
+ let symbols = ["Home": "house", "Voices": "person.wave.2", "Dub": "film", "Dictate": "mic", "Settings": "gearshape"]
+ return buttons.matching(NSPredicate(format: "label == %@ AND identifier == %@", label, symbols[label] ?? label)).firstMatch
+ }
+ @MainActor func openSpeak() {
+ tabButton("Home").tap()
+ if textViews["speak.text"].exists { return }
+ for _ in 0..<5 {
+ if buttons["home.speak"].exists { break }
+ if buttons["BackButton"].exists { buttons["BackButton"].tap() }
+ else { navigationBars.buttons.element(boundBy: 0).tap() }
+ }
+ for _ in 0..<8 { if buttons["home.speak"].isHittable { break }; swipeUp() }
+ buttons["home.speak"].tap()
+ }
+
+}
+
final class SmokeTests: XCTestCase {
+ @MainActor func testCloneRemembersItsRunLocationAfterDismissal() {
+ let app = XCUIApplication()
+ app.launchArguments = ["--ui-smoke", "-AppleLanguages", "(en)"]
+ app.launch(); connect(app)
+ app.tabButton("Voices").tap(); app.buttons["voices.create"].tap()
+ let phone = app.segmentedControls.buttons["This phone"]
+ XCTAssertTrue(phone.waitForExistence(timeout: 5)); phone.tap()
+ app.buttons["Cancel"].tap()
+ app.buttons["voices.create"].tap()
+ XCTAssertTrue(phone.waitForExistence(timeout: 5))
+ XCTAssertTrue(phone.isSelected)
+ app.buttons["Cancel"].tap()
+ }
+
+ @MainActor func testDestructivePhoneHistoryAction() {
+ let app = XCUIApplication()
+ app.launchArguments = ["--ui-smoke", "--ui-phone-history", "-AppleLanguages", "(en)"]
+ app.launch()
+ XCTAssertTrue(app.buttons["consent.no"].waitForExistence(timeout: 10))
+ app.buttons["consent.no"].tap()
+ app.openSpeak()
+ let saved = app.staticTexts["Saved audio for deletion review"]
+ XCTAssertTrue(saved.waitForExistence(timeout: 5))
+ let delete = app.buttons["Delete"]
+ for _ in 0..<8 {
+ if delete.isHittable && delete.frame.maxY < app.buttons["speak.generate"].frame.minY { break }
+ app.swipeUp()
+ }
+ XCTAssertTrue(delete.isHittable)
+ XCTAssertGreaterThanOrEqual(delete.frame.height, 44)
+ let image = XCTAttachment(screenshot: app.screenshot())
+ image.name = "Destructive-history-action"; image.lifetime = .keepAlways; add(image)
+ delete.tap()
+ XCTAssertTrue(saved.wait(for: \.exists, toEqual: false, timeout: 5))
+ }
+
+ @MainActor func testUnpairedTabsAndModelDownloadPrompt() throws {
+ let app = XCUIApplication()
+ app.launchArguments = ["--ui-smoke", "-AppleLanguages", "(en)"]
+ app.launch()
+ XCTAssertTrue(app.buttons["consent.no"].waitForExistence(timeout: 10))
+ app.buttons["consent.no"].tap()
+ app.openSpeak()
+ XCTAssertTrue(app.textViews["speak.text"].waitForExistence(timeout: 5))
+ XCTAssertTrue(app.buttons["models.open"].exists)
+ for tab in ["Voices", "Dub", "Dictate", "Settings"] {
+ app.tabButton(tab).tap()
+ XCTAssertTrue(app.navigationBars[tab].waitForExistence(timeout: 2))
+ let title = app.descendants(matching: .any)["navigation.title"].firstMatch
+ XCTAssertEqual(title.label, tab)
+ XCTAssertLessThan(title.frame.midX, app.frame.width / 2)
+ }
+ XCTAssertTrue(app.buttons["settings.connect"].exists)
+ }
+
+ @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)
++ // The phone works on its own, so dismissing the sheet lands on Home (which sits behind the sheet).
++ XCTAssertTrue(app.buttons["consent.no"].waitForNonExistence(timeout: 8))
++ XCTAssertTrue(app.navigationBars["Home"].waitForExistence(timeout: 5))
+ 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)"]
@@@ -114,14 -87,17 +171,17 @@@
XCTAssertTrue(app.staticTexts["search.empty"].exists)
XCTAssertEqual(app.staticTexts["search.empty"].label, "No matches for \"unmatched-voice\".")
dismissUsingDone(app)
- app.tabBars.buttons["Speak"].tap()
+ app.openSpeak()
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()
+ app.tabButton("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)
@@@ -167,11 -136,11 +227,12 @@@
dismissUsingDone(app)
app.swipeUp()
app.buttons["connect.submit"].tap()
+ app.openSpeak()
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()