Skip to content

Run a virtual iPhone on an Apple Silicon Mac.

Swift

Polish Launchpad: multi-select machines, sheet flow, and New Machine

Lakr4e8d7bd7ced6
diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadApp.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadApp.swift
index 024e36fa..9b5189dd 100644
--- a/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadApp.swift
+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadApp.swift
@@ -17,8 +17,8 @@ struct VPhoneLaunchpadApp: App {
.commands {
CommandGroup(replacing: .newItem) {}
CommandGroup(after: .appSettings) {
- Button("Host Setup…") { model.panel = .hostSetup }
- Button("Core Bundle…") { model.panel = .coreBundle }
+ Button("Host Setup…") { model.present(.hostSetup) }
+ Button("Core Bundle…") { model.present(.coreBundle) }
}
}
diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadModel.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadModel.swift
index 08d13b73..afb3a2b7 100644
--- a/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadModel.swift
+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadModel.swift
@@ -32,6 +32,8 @@ final class VPhoneLaunchpadModel {
let machines: VPhoneLaunchpadMachineLibrary
var panel: Panel?
+ /// The panel to open once the sheet on screen has closed.
+ private var queuedPanel: Panel?
private(set) var isStarted = false
init() {
@@ -41,6 +43,28 @@ final class VPhoneLaunchpadModel {
machines = VPhoneLaunchpadMachineLibrary(bundles: bundles, helper: helper)
}
+ // MARK: - Panels
+
+ /// Opens `next`. Another panel on screen closes first, so `next` arrives
+ /// as a sheet of its own instead of replacing that sheet's content.
+ func present(_ next: Panel) {
+ guard let current = panel, current != next else {
+ panel = next
+ return
+ }
+ queuedPanel = next
+ self.panel = nil
+ }
+
+ /// Called when a panel's sheet has closed.
+ func panelDidDismiss() {
+ guard let next = queuedPanel else {
+ return
+ }
+ queuedPanel = nil
+ panel = next
+ }
+
// MARK: - Attention
var hostNeedsAttention: Bool {
diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadPreview.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadPreview.swift
index 4309544f..9aa6805b 100644
--- a/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadPreview.swift
+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadPreview.swift
@@ -66,7 +66,7 @@
await panel(model, .hostSetup, "04-host-setup-passed", suffix)
- model.machines.selection = path("research-01")
+ model.machines.selection = [path("research-01")]
await shot("05-machines", suffix)
model.showsInspector = false
await shot("05a-machines-no-inspector", suffix)
@@ -78,7 +78,7 @@
}
}
- model.machines.selection = path("ios27-rc")
+ model.machines.selection = [path("ios27-rc")]
await shot("06-machines-creating", suffix)
await sheet(.newMachine, "07-new-machine", suffix)
@@ -101,7 +101,7 @@
await standalone("08c-creation-log", suffix, size: NSSize(width: 960, height: 700)) {
VPhoneLaunchpadConsoleView(title: "ios27-rc Creation Log", url: creation.logFile)
}
- model.machines.selection = labMachine
+ model.machines.selection = [labMachine]
if let machine = model.machines.selected {
await sheet(.settings(machine), "09-machine-settings", suffix)
}
diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadRootView.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadRootView.swift
index 098abcbf..fd21d8ba 100644
--- a/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadRootView.swift
+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadRootView.swift
@@ -17,7 +17,7 @@ struct VPhoneLaunchpadRootView: View {
}
.navigationTitle("Machines")
.task { await model.start() }
- .sheet(item: $model.panel) { panel in
+ .sheet(item: $model.panel, onDismiss: model.panelDidDismiss) { panel in
Group {
switch panel {
case .hostSetup:
@@ -36,7 +36,7 @@ struct VPhoneLaunchpadRootView: View {
private func panelButton(_ panel: VPhoneLaunchpadModel.Panel, systemImage: String, needsAttention: Bool) -> some View {
Button {
- model.panel = panel
+ model.present(panel)
} label: {
Label {
Text(panel.title)
diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Command/VPhoneLaunchpadCommandHistoryView.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Command/VPhoneLaunchpadCommandHistoryView.swift
new file mode 100644
index 00000000..ffa04e5d
--- /dev/null
+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Command/VPhoneLaunchpadCommandHistoryView.swift
@@ -0,0 +1,67 @@
+import AppKit
+import SwiftUI
+
+/// The commands Launchpad ran, newest first, in a sheet.
+struct VPhoneLaunchpadCommandHistoryView: View {
+ @Environment(VPhoneLaunchpadModel.self) private var model
+ @Environment(\.dismiss) private var dismiss
+ @State private var selection: Set<UUID> = []
+
+ private var entries: [VPhoneLaunchpadCommandHistory.Entry] {
+ model.history.entries.reversed()
+ }
+
+ var body: some View {
+ VPhoneLaunchpadSheet(Text("Recent Commands")) {
+ if entries.isEmpty {
+ ContentUnavailableView("Commands that Launchpad runs appear here.", systemImage: "terminal")
+ } else {
+ table
+ }
+ } actions: {
+ Button("Done") { dismiss() }
+ .keyboardShortcut(.defaultAction)
+ }
+ .frame(width: 760, height: 460)
+ }
+
+ private var table: some View {
+ Table(entries, selection: $selection) {
+ TableColumn("") { entry in
+ VPhoneLaunchpadStatusIcon(status: entry.status.map { $0 == 0 ? .passed : .failed } ?? .running)
+ .help(entry.status.map { String(localized: "Exit status \($0)") } ?? "")
+ }
+ .width(20)
+ TableColumn("Started") { entry in
+ Text(entry.date.formatted(date: .omitted, time: .standard))
+ .monospacedDigit()
+ }
+ .width(min: 70, ideal: 80)
+ TableColumn("Command") { entry in
+ Text(verbatim: entry.text)
+ .font(.system(.body, design: .monospaced))
+ .lineLimit(1)
+ .truncationMode(.middle)
+ .help(entry.text)
+ }
+ }
+ .contextMenu(forSelectionType: UUID.self) { ids in
+ Button("Copy Command") { copy(ids) }
+ .disabled(ids.isEmpty)
+ }
+ .onCopyCommand {
+ let text = commands(selection)
+ return text.isEmpty ? [] : [NSItemProvider(object: text as NSString)]
+ }
+ }
+
+ /// The selected commands, one per line, in the order the table shows them.
+ private func commands(_ ids: Set<UUID>) -> String {
+ entries.filter { ids.contains($0.id) }.map(\.text).joined(separator: "\n")
+ }
+
+ private func copy(_ ids: Set<UUID>) {
+ NSPasteboard.general.clearContents()
+ NSPasteboard.general.setString(commands(ids), forType: .string)
+ }
+}
diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/CoreBundle/VPhoneLaunchpadCoreBundleView.swift b/VPhoneLaunchpad/VPhoneLaunchpad/CoreBundle/VPhoneLaunchpadCoreBundleView.swift
index fd68ecdb..23c60634 100644
--- a/VPhoneLaunchpad/VPhoneLaunchpad/CoreBundle/VPhoneLaunchpadCoreBundleView.swift
+++ b/VPhoneLaunchpad/VPhoneLaunchpad/CoreBundle/VPhoneLaunchpadCoreBundleView.swift
@@ -144,7 +144,7 @@ struct VPhoneLaunchpadCoreBundleView: View {
Button("Remove…", role: .destructive) { removal = bundle.version }
.disabled(bundles.isInstalling)
} label: {
- Image(systemName: "ellipsis.circle")
+ Image(systemName: "ellipsis")
}
.menuStyle(.borderlessButton)
.menuIndicator(.hidden)
diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/HostSetup/VPhoneLaunchpadHostSetupView.swift b/VPhoneLaunchpad/VPhoneLaunchpad/HostSetup/VPhoneLaunchpadHostSetupView.swift
index 4f06abce..b2672692 100644
--- a/VPhoneLaunchpad/VPhoneLaunchpad/HostSetup/VPhoneLaunchpadHostSetupView.swift
+++ b/VPhoneLaunchpad/VPhoneLaunchpad/HostSetup/VPhoneLaunchpadHostSetupView.swift
@@ -22,7 +22,7 @@ struct VPhoneLaunchpadHostSetupView: View {
} actions: {
// Straight on to the next stage while it is not ready.
if host.requiredPassed, !model.bundles.isReady {
- Button("Continue") { model.panel = .coreBundle }
+ Button("Continue") { model.present(.coreBundle) }
.keyboardShortcut(.defaultAction)
} else {
Button("Done") { dismiss() }
diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Localizable.xcstrings b/VPhoneLaunchpad/VPhoneLaunchpad/Localizable.xcstrings
index e13581f2..21f35b50 100644
--- a/VPhoneLaunchpad/VPhoneLaunchpad/Localizable.xcstrings
+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Localizable.xcstrings
@@ -1,40 +1,6 @@
{
"sourceLanguage" : "en",
"strings" : {
- "%@ already exists. Enter another name." : {
- "localizations" : {
- "en" : {
- "stringUnit" : {
- "state" : "translated",
- "value" : "%@ already exists. Enter another name."
- }
- },
- "ja" : {
- "stringUnit" : {
- "state" : "translated",
- "value" : "%@ は既に存在します。別の名前を入力してください。"
- }
- },
- "ko" : {
- "stringUnit" : {
- "state" : "translated",
- "value" : "%@이(가) 이미 있습니다. 다른 이름을 입력하십시오."
- }
- },
- "vi" : {
- "stringUnit" : {
- "state" : "translated",
- "value" : "%@ đã tồn tại. Hãy nhập tên khác."
- }
- },
- "zh-Hans" : {
- "stringUnit" : {
- "state" : "translated",
- "value" : "%@ 已存在。请输入其他名称。"
- }
- }
- }
- },
"%@ Console" : {
"localizations" : {
"en" : {
@@ -829,104 +795,104 @@
}
}
},
- "%lld of %lld passed" : {
+ "%lld Machines Selected" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
- "value" : "%lld of %lld passed"
+ "value" : "%lld Machines Selected"
}
},
"ja" : {
"stringUnit" : {
"state" : "translated",
- "value" : "%2$lld 項目中 %1$lld 項目に合格"
+ "value" : "%lld 台のマシンを選択中"
}
},
"ko" : {
"stringUnit" : {
"state" : "translated",
- "value" : "%2$lld개 중 %1$lld개 통과"
+ "value" : "머신 %lld대 선택됨"
}
},
"vi" : {
"stringUnit" : {
"state" : "translated",
- "value" : "Đạt %1$lld / %2$lld"
+ "value" : "Đã chọn %lld máy"
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
- "value" : "已通过 %1$lld 项,共 %2$lld 项"
+ "value" : "已选择 %lld 台虚拟机"
}
}
}
},
- "A Core Bundle can be installed once every required check passes." : {
+ "%lld of %lld passed" : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
- "value" : "A Core Bundle can be installed once every required check passes."
+ "value" : "%lld of %lld passed"
}
},
"ja" : {
"stringUnit" : {
"state" : "translated",
- "value" : "必須項目がすべて合格すると、コアバンドルをインストールできます。"
+ "value" : "%2$lld 項目中 %1$lld 項目に合格"
}
},
"ko" : {
"stringUnit" : {
"state" : "translated",
- "value" : "모든 필수 검사를 통과하면 코어 번들을 설치할 수 있습니다."
+ "value" : "%2$lld개 중 %1$lld개 통과"
}
},
"vi" : {
"stringUnit" : {
"state" : "translated",
- "value" : "Có thể cài đặt Bundle lõi khi mọi mục kiểm tra bắt buộc đều đạt."
+ "value" : "Đạt %1$lld / %2$lld"
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
- "value" : "所有必需检查通过后,即可安装核心 Bundle。"
+ "value" : "已通过 %1$lld 项,共 %2$lld 项"
}
}
}
},
- "A folder named %@ already exists in this location. Enter another name." : {
+ "A Core Bundle can be installed once every required check passes." : {
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
- "value" : "A folder named %@ already exists in this location. Enter another name."
+ "value" : "A Core Bundle can be installed once every required check passes."
}
},
"ja" : {
"stringUnit" : {
"state" : "translated",
- "value" : "この場所には %@ という名前のフォルダが既に存在します。別の名前を入力してください。"
+ "value" : "必須項目がすべて合格すると、コアバンドルをインストールできます。"
}
},
"ko" : {
"stringUnit" : {
"state" : "translated",
- "value" : "이 위치에 %@(이)라는 이름의 폴더가 이미 있습니다. 다른 이름을 입력하십시오."
+ "value" : "모든 필수 검사를 통과하면 코어 번들을 설치할 수 있습니다."
}
},
"vi" : {
"stringUnit" : {
"state" : "translated",
- "value" : "Vị trí này đã có thư mục tên %@. Hãy nhập tên khác."
+ "value" : "Có thể cài đặt Bundle lõi khi mọi mục kiểm tra bắt buộc đều đạt."
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
- "value" : "此位置已存在名为 %@ 的文件夹。请输入其他名称。"
+ "value" : "所有必需检查通过后,即可安装核心 Bundle。"
}
}
}
@@ -2223,6 +2189,40 @@
}
}
},
+ "Clear" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Clear"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "消去"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "지우기"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Xóa"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "清除"
+ }
+ }
+ }
+ },
"Clone" : {
"localizations" : {
"en" : {
@@ -2597,6 +2597,40 @@
}
}
},
+ "Command" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Command"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "コマンド"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "명령"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Lệnh"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "命令"
+ }
+ }
+ }
+ },
"Commands that Launchpad runs appear here." : {
"localizations" : {
"en" : {
@@ -3459,6 +3493,40 @@
}
}
},
+ "Delete %lld Machines?" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Delete %lld Machines?"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "%lld 台のマシンを削除しますか?"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "머신 %lld대를 삭제하겠습니까?"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Xóa %lld máy?"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "删除 %lld 台虚拟机?"
+ }
+ }
+ }
+ },
"Delete %@?" : {
"localizations" : {
"en" : {
@@ -4071,6 +4139,40 @@
}
}
},
+ "Every patch this bundle declares, including the Frida Stalker relaxations and the hv_vmm_present concealment that a freshly restored 26.4 guest does not survive." : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Every patch this bundle declares, including the Frida Stalker relaxations and the hv_vmm_present concealment that a freshly restored 26.4 guest does not survive."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "このバンドルが宣言するすべてのパッチ。Frida Stalker 向けの制限緩和と、復元直後の 26.4 ゲストでは起動できなくなる hv_vmm_present の隠蔽を含みます。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "이 번들이 선언하는 모든 패치입니다. Frida Stalker용 제한 완화와, 새로 복원한 26.4 게스트가 부팅하지 못하는 hv_vmm_present 은폐를 포함합니다."
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Mọi bản vá mà gói này khai báo, bao gồm các nới lỏng cho Frida Stalker và phần che giấu hv_vmm_present mà khách 26.4 vừa khôi phục không khởi động được."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "此 Bundle 声明的全部补丁,包括针对 Frida Stalker 的限制放宽,以及刚恢复的 26.4 客户机无法承受的 hv_vmm_present 隐藏。"
+ }
+ }
+ }
+ },
"Every release is installed." : {
"localizations" : {
"en" : {
@@ -4309,6 +4411,41 @@
}
}
},
+ "Extended" : {
+ "comment" : "The built-in patch preset",
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Extended"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "拡張"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "확장"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Mở rộng"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "扩展"
+ }
+ }
+ }
+ },
"Firmware" : {
"localizations" : {
"en" : {
@@ -4989,74 +5126,6 @@
}
}
},
- "Import" : {
- "localizations" : {
- "en" : {
- "stringUnit" : {
- "state" : "translated",
- "value" : "Import"
- }
- },
- "ja" : {
- "stringUnit" : {
- "state" : "translated",
- "value" : "読み込む"
- }
- },
- "ko" : {
- "stringUnit" : {
- "state" : "translated",
- "value" : "가져오기"
- }
- },
- "vi" : {
- "stringUnit" : {
- "state" : "translated",
- "value" : "Nhập"
- }
- },
- "zh-Hans" : {
- "stringUnit" : {
- "state" : "translated",
- "value" : "导入"
- }
- }
- }
- },
- "Import an exported machine" : {
- "localizations" : {
- "en" : {
- "stringUnit" : {
- "state" : "translated",
- "value" : "Import an exported machine"
- }
- },
- "ja" : {
- "stringUnit" : {
- "state" : "translated",
- "value" : "書き出したマシンを読み込む"
- }
- },
- "ko" : {
- "stringUnit" : {
- "state" : "translated",
- "value" : "내보낸 머신 가져오기"
- }
- },
- "vi" : {
- "stringUnit" : {
- "state" : "translated",
- "value" : "Nhập máy ảo đã xuất"
- }
- },
- "zh-Hans" : {
- "stringUnit" : {
- "state" : "translated",
- "value" : "导入已导出的虚拟机"
- }
- }
- }
- },
"Import Machine" : {
"localizations" : {
"en" : {
@@ -9851,6 +9920,40 @@
}
}
},
+ "View Details" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "View Details"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "詳細を表示"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "세부 정보 보기"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Xem chi tiết"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "查看详情"
+ }
+ }
+ }
+ },
"Show Progress" : {
"localizations" : {
"en" : {
@@ -10089,6 +10192,41 @@
}
}
},
+ "Standard" : {
+ "comment" : "The built-in patch preset",
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Standard"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "標準"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "표준"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Tiêu chuẩn"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "标准"
+ }
+ }
+ }
+ },
"Start" : {
"localizations" : {
"en" : {
@@ -11415,6 +11553,40 @@
}
}
},
+ "The patches every vphone VM needs to boot, jailbroken, with a working display and camera." : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "The patches every vphone VM needs to boot, jailbroken, with a working display and camera."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "すべての vphone 仮想マシンが脱獄状態で起動し、画面とカメラを使うために必要なパッチ。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "모든 vphone 가상 머신이 탈옥 상태로 부팅하고 화면과 카메라를 사용하는 데 필요한 패치입니다."
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Các bản vá mà mọi máy ảo vphone cần để khởi động ở trạng thái jailbreak, với màn hình và camera hoạt động."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "每台 vphone 虚拟机以越狱状态启动、并正常使用屏幕和摄像头所需的补丁。"
+ }
+ }
+ }
+ },
"The path is too long. Use a shorter name, or a location with a shorter path." : {
"localizations" : {
"en" : {
@@ -11483,6 +11655,40 @@
}
}
},
+ "Their disks, firmware and settings are removed. This cannot be undone." : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Their disks, firmware and settings are removed. This cannot be undone."
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "各マシンのディスク、ファームウェア、設定が削除されます。この操作は取り消せません。"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "각 머신의 디스크, 펌웨어 및 설정이 제거됩니다. 이 작업은 실행 취소할 수 없습니다."
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Ổ đĩa, firmware và cài đặt của các máy này sẽ bị xóa. Không thể hoàn tác."
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "这些虚拟机的磁盘、固件和设置都会被移除。此操作无法撤销。"
+ }
+ }
+ }
+ },
"This build does not contain VPhone.bundle. Choose another build." : {
"localizations" : {
"en" : {
diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachineInspector.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachineInspector.swift
index af473faa..1aef0bc9 100644
--- a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachineInspector.swift
+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachineInspector.swift
@@ -31,6 +31,7 @@ struct VPhoneLaunchpadMachineInspector: View {
let onShowProgress: (VPhoneLaunchpadMachinePath) -> Void
let onOpenConsole: (VPhoneLaunchpadMachinePath) -> Void
@Environment(VPhoneLaunchpadModel.self) private var model
+ @State private var showsCommands = false
private var library: VPhoneLaunchpadMachineLibrary {
model.machines
@@ -85,18 +86,22 @@ struct VPhoneLaunchpadMachineInspector: View {
}
Section("Console") {
- Button {
- onOpenConsole(machine.path)
- } label: {
- Label("Open Console", systemImage: "arrow.up.right")
+ HStack {
+ Button {
+ onOpenConsole(machine.path)
+ } label: {
+ Label("Open Console", systemImage: "arrow.up.right")
+ }
+ Spacer()
+ Button("Recent Commands") { showsCommands = true }
}
}
-
- Section("Recent Commands") {
- commands
- }
}
.formStyle(.grouped)
+ .sheet(isPresented: $showsCommands) {
+ VPhoneLaunchpadCommandHistoryView()
+ .environment(model)
+ }
}
private func value(_ title: LocalizedStringKey, _ value: String) -> some View {
@@ -111,7 +116,9 @@ struct VPhoneLaunchpadMachineInspector: View {
private func creationSummary(_ creation: VPhoneLaunchpadCreationPipeline) -> some View {
LabeledContent {
- Button("Show Progress") { onShowProgress(creation.machine) }
+ Button(creation.isRunning ? LocalizedStringKey("Show Progress") : LocalizedStringKey("View Details")) {
+ onShowProgress(creation.machine)
+ }
} label: {
if creation.isRunning {
Label { Text("Creating: \(creation.current?.title ?? "")") } icon: { VPhoneLaunchpadStatusIcon(status: .running) }
@@ -122,31 +129,4 @@ struct VPhoneLaunchpadMachineInspector: View {
}
}
}
-
- @ViewBuilder
- private var commands: some View {
- let entries = Array(model.history.entries.suffix(12).reversed())
- if entries.isEmpty {
- Text("Commands that Launchpad runs appear here.")
- .foregroundStyle(.secondary)
- }
- ForEach(entries) { entry in
- Label {
- Text(entry.text)
- .font(.system(.callout, design: .monospaced))
- .lineLimit(1)
- .truncationMode(.middle)
- .textSelection(.enabled)
- .help(entry.text)
- } icon: {
- VPhoneLaunchpadStatusIcon(status: entry.status.map { $0 == 0 ? .passed : .failed } ?? .running)
- }
- .contextMenu {
- Button("Copy Command") {
- NSPasteboard.general.clearContents()
- NSPasteboard.general.setString(entry.text, forType: .string)
- }
- }
- }
- }
}
diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachineLibrary.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachineLibrary.swift
index 201110fa..009ae520 100644
--- a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachineLibrary.swift
+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachineLibrary.swift
@@ -32,7 +32,7 @@ final class VPhoneLaunchpadMachineLibrary {
/// Folders chosen in New Machine, in the order they were added. The
/// default library is not among them.
private(set) var addedRoots: [String]
- var selection: Path?
+ var selection: Set<Path> = []
var actionError: VPhoneLaunchpadError?
/// The default library, canonical. Import writes here.
@@ -66,8 +66,15 @@ final class VPhoneLaunchpadMachineLibrary {
[libraryRoot] + addedRoots
}
+ /// The selected machines, in list order.
+ var selectedMachines: [VPhoneLaunchpadMachine] {
+ machines.filter { selection.contains($0.id) }
+ }
+
+ /// The selected machine when exactly one is selected.
var selected: VPhoneLaunchpadMachine? {
- machines.first { $0.id == selection }
+ let selected = selectedMachines
+ return selected.count == 1 ? selected[0] : nil
}
var runningCount: Int {
@@ -188,8 +195,9 @@ final class VPhoneLaunchpadMachineLibrary {
listError = errors.first
hasListed = true
forgetEmptyLocations(listed: listed)
- if selection == nil || !machines.contains(where: { $0.id == selection }) {
- selection = machines.first?.id
+ selection.formIntersection(machines.map(\.id))
+ if selection.isEmpty, let first = machines.first {
+ selection = [first.id]
}
let paths = machines.map(\.path)
externallyRunning = await Task.detached { Self.machinesHoldingDisks(paths) }.value
@@ -333,13 +341,13 @@ final class VPhoneLaunchpadMachineLibrary {
func rename(_ machine: Path, to newName: String) async {
if await perform(String(localized: "Renaming…"), on: machine, ["vm", "rename", machine.name, newName] + machine.libraryArguments) {
- selection = Path(libraryRoot: machine.libraryRoot, name: newName)
+ selection = [Path(libraryRoot: machine.libraryRoot, name: newName)]
}
}
func clone(_ machine: Path, as newName: String) async {
if await perform(String(localized: "Cloning…"), on: machine, ["vm", "clone", machine.name, newName] + machine.libraryArguments) {
- selection = Path(libraryRoot: machine.libraryRoot, name: newName)
+ selection = [Path(libraryRoot: machine.libraryRoot, name: newName)]
}
}
@@ -426,7 +434,7 @@ final class VPhoneLaunchpadMachineLibrary {
externallyRunning = [VPhoneLaunchpadPreview.path("research-01")]
startedAt = [VPhoneLaunchpadPreview.path("research-01"): Date().addingTimeInterval(-6130)]
creations = [creation.machine: creation]
- selection = VPhoneLaunchpadPreview.path("research-01")
+ selection = [VPhoneLaunchpadPreview.path("research-01")]
}
}
#endif
diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachinesView.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachinesView.swift
index c2f5f6e8..8d01c699 100644
--- a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachinesView.swift
+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachinesView.swift
@@ -30,7 +30,8 @@ struct VPhoneLaunchpadMachinesView: View {
@Environment(VPhoneLaunchpadModel.self) private var model
@State private var sheet: Sheet?
- @State private var deletion: MachinePath?
+ /// The machines the delete confirmation is for; empty when it is closed.
+ @State private var deletion: [MachinePath] = []
private var library: VPhoneLaunchpadMachineLibrary {
model.machines
@@ -54,6 +55,8 @@ struct VPhoneLaunchpadMachinesView: View {
onShowProgress: { path in sheet = .creation(path) },
onOpenConsole: { path in sheet = .console(path) },
)
+ } else if library.selection.count > 1 {
+ ContentUnavailableView("\(library.selection.count) Machines Selected", systemImage: "iphone")
} else if model.bundles.progress != nil {
Form {
VPhoneLaunchpadInstallSection()
@@ -84,20 +87,27 @@ struct VPhoneLaunchpadMachinesView: View {
.environment(model)
}
.confirmationDialog(
- "Delete \(deletion?.name ?? "")?",
- isPresented: Binding(get: { deletion != nil }, set: {
+ deletion.count == 1 ? "Delete \(deletion[0].name)?" : "Delete \(deletion.count) Machines?",
+ isPresented: Binding(get: { !deletion.isEmpty }, set: {
if !$0 {
- deletion = nil
+ deletion = []
}
}),
) {
Button("Delete", role: .destructive) {
- if let machine = deletion {
- Task { await library.delete(machine) }
+ let machines = deletion
+ Task {
+ for machine in machines {
+ await library.delete(machine)
+ }
}
}
} message: {
- Text("The machine's disk, firmware and settings are removed. This cannot be undone.")
+ if deletion.count == 1 {
+ Text("The machine's disk, firmware and settings are removed. This cannot be undone.")
+ } else {
+ Text("Their disks, firmware and settings are removed. This cannot be undone.")
+ }
}
.alert(
library.actionError?.message ?? "",
@@ -118,48 +128,35 @@ struct VPhoneLaunchpadMachinesView: View {
@ToolbarContentBuilder
private var toolbar: some ToolbarContent {
- let selected = library.selected
- let state = selected.map { library.state(of: $0.path) }
+ let selected = library.selectedMachines
+ let stopped = selected.filter { library.state(of: $0.path) == .stopped }
+ let running = selected.filter { library.state(of: $0.path) == .running }
// Host Setup and Core Bundle hold the leading edge; the space pushes
- // everything here to the trailing edge, in two groups: the selected
- // machine and the library. The inspector toggle is in the inspector.
+ // everything here to the trailing edge: Start or Stop for the
+ // selection, then New Machine and the actions menu. The inspector
+ // toggle is in the inspector.
ToolbarItem(placement: .automatic) {
Spacer()
}
- ToolbarItemGroup(placement: .automatic) {
- if state == .running, let selected {
+ ToolbarItem(placement: .automatic) {
+ if stopped.isEmpty, !running.isEmpty {
Button {
- Task { await library.stop(selected.path) }
+ stop(running)
} label: {
Label("Stop", systemImage: "stop.fill")
}
- .help("Stop \(selected.name)")
+ .help("Stop \(running.map(\.name).joined(separator: ", "))")
} else {
Button {
- if let selected {
- library.start(selected.path)
- }
+ start(stopped)
} label: {
Label("Start", systemImage: "play.fill")
}
.help("Start the selected machine")
- .disabled(state != .stopped)
- }
- Menu {
- machineActions(selected)
- } label: {
- Label("Actions", systemImage: "ellipsis.circle")
+ .disabled(stopped.isEmpty)
}
- .disabled(selected == nil)
}
ToolbarItemGroup(placement: .automatic) {
- Button {
- chooseImport()
- } label: {
- Label("Import", systemImage: "square.and.arrow.down")
- }
- .help("Import an exported machine")
- .disabled(library.globalActivity != nil || model.bundles.activeVersion == nil)
Button {
sheet = .newMachine
} label: {
@@ -167,6 +164,32 @@ struct VPhoneLaunchpadMachinesView: View {
}
.help("Create a machine")
.disabled(model.bundles.activeVersion == nil)
+ Menu {
+ machineActions(selected)
+ if !selected.isEmpty {
+ Divider()
+ }
+ Button("Import…") { chooseImport() }
+ .disabled(library.globalActivity != nil || model.bundles.activeVersion == nil)
+ } label: {
+ Label("Actions", systemImage: "ellipsis")
+ }
+ }
+ }
+
+ private func start(_ machines: [VPhoneLaunchpadMachine], headless: Bool = false) {
+ for machine in machines {
+ library.start(machine.path, headless: headless)
+ }
+ }
+
+ private func stop(_ machines: [VPhoneLaunchpadMachine]) {
+ Task {
+ await withTaskGroup(of: Void.self) { group in
+ for machine in machines {
+ group.addTask { await library.stop(machine.path) }
+ }
+ }
}
}
@@ -180,9 +203,26 @@ struct VPhoneLaunchpadMachinesView: View {
}
/// The same actions in the toolbar menu and the table's context menu.
+ /// Several machines get the actions that apply to each of them.
@ViewBuilder
- private func machineActions(_ machine: VPhoneLaunchpadMachine?) -> some View {
- if let machine {
+ private func machineActions(_ machines: [VPhoneLaunchpadMachine]) -> some View {
+ if machines.count > 1 {
+ let stopped = machines.filter { library.state(of: $0.path) == .stopped }
+ let running = machines.filter { library.state(of: $0.path) == .running }
+ Button("Start") { start(stopped) }
+ .disabled(stopped.isEmpty)
+ Button("Start Headless") { start(stopped, headless: true) }
+ .disabled(stopped.isEmpty)
+ Button("Stop") { stop(running) }
+ .disabled(running.isEmpty)
+ Divider()
+ Button("Show in Finder") {
+ NSWorkspace.shared.activateFileViewerSelecting(machines.map(\.path.url))
+ }
+ Divider()
+ Button("Delete…", role: .destructive) { deletion = machines.map(\.path) }
+ .disabled(stopped.count != machines.count)
+ } else if let machine = machines.first {
let isStopped = library.state(of: machine.path) == .stopped
Button("Start Headless") { library.start(machine.path, headless: true) }
.disabled(!isStopped)
@@ -210,14 +250,14 @@ struct VPhoneLaunchpadMachinesView: View {
}
.disabled(!FileManager.default.fileExists(atPath: VPhoneLaunchpadMachineLibrary.consoleLog(machine.path, suffix: "-patch").path))
Divider()
- Button("Delete…", role: .destructive) { deletion = machine.path }
+ Button("Delete…", role: .destructive) { deletion = [machine.path] }
.disabled(!isStopped)
}
}
// MARK: - Table
- private func table(selection: Binding<MachinePath?>) -> some View {
+ private func table(selection: Binding<Set<MachinePath>>) -> some View {
Table(library.machines, selection: selection) {
TableColumn("Name", value: \.name)
.width(min: 90, ideal: 110)
@@ -252,11 +292,9 @@ struct VPhoneLaunchpadMachinesView: View {
.width(64)
}
.contextMenu(forSelectionType: MachinePath.self) { paths in
- machineActions(library.machines.first { paths.contains($0.path) })
+ machineActions(library.machines.filter { paths.contains($0.path) })
} primaryAction: { paths in
- if let path = paths.first, library.state(of: path) == .stopped {
- library.start(path)
- }
+ start(library.machines.filter { paths.contains($0.path) && library.state(of: $0.path) == .stopped })
}
}
@@ -268,7 +306,7 @@ struct VPhoneLaunchpadMachinesView: View {
} description: {
Text("Install a VPhone.bundle to create and run machines.")
} actions: {
- Button("Set Up…") { model.panel = model.host.requiredPassed ? .coreBundle : .hostSetup }
+ Button("Set Up…") { model.present(model.host.requiredPassed ? .coreBundle : .hostSetup) }
.buttonStyle(.borderedProminent)
}
} else if !library.hasListed {
diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadNewMachineAdvancedView.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadNewMachineAdvancedView.swift
index 0f09b8b7..0ff81f0c 100644
--- a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadNewMachineAdvancedView.swift
+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadNewMachineAdvancedView.swift
@@ -65,7 +65,7 @@ struct VPhoneLaunchpadNewMachineAdvancedView: View {
if let patchCatalog {
Picker("Preset", selection: presetBinding) {
ForEach(patchCatalog.presets) { preset in
- Text(verbatim: preset.title).tag(preset.identifier)
+ Text(verbatim: preset.displayTitle).tag(preset.identifier)
}
}
LabeledContent("Patches") {
@@ -92,7 +92,7 @@ struct VPhoneLaunchpadNewMachineAdvancedView: View {
private var patchNote: some View {
let essentialOff = patchCatalog.map { patches.bootEssentialOff(in: $0) } ?? []
VStack(alignment: .leading, spacing: 4) {
- if let summary = patchCatalog?.preset(patches.preset)?.summary, !summary.isEmpty {
+ if let summary = patchCatalog?.preset(patches.preset)?.displaySummary, !summary.isEmpty {
Text(verbatim: summary).foregroundStyle(.secondary)
}
if patches.hasOverrides {
diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadNewMachineView.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadNewMachineView.swift
index b5d18858..dc2ae330 100644
--- a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadNewMachineView.swift
+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadNewMachineView.swift
@@ -43,33 +43,36 @@ struct VPhoneLaunchpadNewMachineView: View {
return selectedPairing.map { ($0.ios.url, $0.recommendedCloudOS.url) }
}
- /// Used when the name field is left empty. It is refused only when a
- /// machine or folder of that name already exists.
- private static let defaultName = "research-01"
-
private var effectiveName: String {
- let name = name.trimmingCharacters(in: .whitespaces)
- return name.isEmpty ? Self.defaultName : name
+ name.trimmingCharacters(in: .whitespaces)
}
private var machine: VPhoneLaunchpadMachinePath {
VPhoneLaunchpadMachinePath(libraryRoot: location, name: effectiveName)
}
+ private func isTaken(_ machine: VPhoneLaunchpadMachinePath) -> Bool {
+ model.machines.machines.contains(where: { $0.path == machine })
+ || model.machines.creations[machine] != nil
+ || FileManager.default.fileExists(atPath: machine.url.path)
+ }
+
+ /// The first `pcc-research-NN` free in `root`, filled into the field when
+ /// the sheet opens.
+ private func suggestedName(in root: String) -> String {
+ let names = (1 ... 99).lazy.map { String(format: "pcc-research-%02d", $0) }
+ return names.first { !isTaken(VPhoneLaunchpadMachinePath(libraryRoot: root, name: $0)) } ?? "pcc-research"
+ }
+
private var nameProblem: String? {
- let isDefault = name.trimmingCharacters(in: .whitespaces).isEmpty
if !VPhoneLaunchpadNames.isValidMachineName(effectiveName) {
return String(localized: "Use letters, numbers, periods, hyphens, and underscores.")
}
if model.machines.machines.contains(where: { $0.path == machine }) || model.machines.creations[machine]?.isRunning == true {
- return isDefault
- ? String(localized: "\(Self.defaultName) already exists. Enter another name.")
- : String(localized: "A machine with this name already exists.")
+ return String(localized: "A machine with this name already exists.")
}
if FileManager.default.fileExists(atPath: machine.url.path) {
- return isDefault
- ? String(localized: "A folder named \(Self.defaultName) already exists in this location. Enter another name.")
- : String(localized: "A folder with this name already exists in this location.")
+ return String(localized: "A folder with this name already exists in this location.")
}
if !VPhoneLaunchpadMachineLocations.socketPathFits(root: location, name: effectiveName) {
return String(localized: "The path is too long. Use a shorter name, or a location with a shorter path.")
@@ -89,7 +92,7 @@ struct VPhoneLaunchpadNewMachineView: View {
VPhoneLaunchpadSheet(Text("New Machine")) {
Form {
Section {
- TextField("Name", text: $name, prompt: Text(verbatim: Self.defaultName))
+ TextField("Name", text: $name)
locationPicker
} footer: {
if let problem = nameProblem ?? locationProblem {
@@ -135,7 +138,11 @@ struct VPhoneLaunchpadNewMachineView: View {
}
.task { await loadCatalog() }
.task { await loadPatchCatalog() }
- .onAppear { location = model.machines.preferredRoot }
+ .onAppear {
+ let root = model.machines.preferredRoot
+ location = root
+ name = suggestedName(in: root)
+ }
}
// MARK: - Advanced
@@ -168,7 +175,7 @@ struct VPhoneLaunchpadNewMachineView: View {
/// The network mode and the patch preset, the two choices most likely to matter.
private var advancedSummary: String {
let network = VPhoneLaunchpadNewMachineAdvancedView.networkTitle(network)
- guard let preset = patchCatalog?.preset(patches.preset)?.title else {
+ guard let preset = patchCatalog?.preset(patches.preset)?.displayTitle else {
return network
}
return "\(network) · \(preset)"
@@ -276,11 +283,34 @@ struct VPhoneLaunchpadNewMachineView: View {
}
}
+ private static func isIPSWFile(_ path: String) -> Bool {
+ var isDirectory: ObjCBool = false
+ return path.hasPrefix("/") && path.lowercased().hasSuffix(".ipsw")
+ && FileManager.default.fileExists(atPath: path, isDirectory: &isDirectory) && !isDirectory.boolValue
+ }
+
private func sourceField(_ title: LocalizedStringKey, _ text: Binding<String>) -> some View {
LabeledContent(title) {
HStack {
- TextField(title, text: text, prompt: Text("URL or path"))
- .labelsHidden()
+ // A chosen file shows only its name; a URL or a path still
+ // being typed stays editable.
+ if Self.isIPSWFile(text.wrappedValue) {
+ Text(verbatim: URL(fileURLWithPath: text.wrappedValue).lastPathComponent)
+ .lineLimit(1)
+ .truncationMode(.middle)
+ .help(text.wrappedValue)
+ Button {
+ text.wrappedValue = ""
+ } label: {
+ Image(systemName: "xmark.circle.fill")
+ }
+ .buttonStyle(.borderless)
+ .foregroundStyle(.secondary)
+ .help("Clear")
+ } else {
+ TextField(title, text: text, prompt: Text("URL or path"))
+ .labelsHidden()
+ }
Button("Choose…") {
let panel = NSOpenPanel()
panel.canChooseDirectories = false
@@ -366,7 +396,7 @@ struct VPhoneLaunchpadNewMachineView: View {
keepArtifacts: keepArtifacts,
)
let pipeline = model.machines.create(options)
- model.machines.selection = pipeline.machine
+ model.machines.selection = [pipeline.machine]
onCreate(pipeline.machine)
}
}
diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadPatchCatalog.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadPatchCatalog.swift
index fb3de5ea..8b9ba4b1 100644
--- a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadPatchCatalog.swift
+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadPatchCatalog.swift
@@ -16,6 +16,24 @@ nonisolated struct VPhoneLaunchpadPatchCatalog: Decodable, Sendable {
var id: String {
identifier
}
+
+ /// The bundle writes its built-in presets in English. Launchpad
+ /// translates those two; any other preset shows its own text.
+ var displayTitle: String {
+ switch identifier {
+ case "standard": String(localized: "Standard", comment: "The built-in patch preset")
+ case "extended": String(localized: "Extended", comment: "The built-in patch preset")
+ default: title
+ }
+ }
+
+ var displaySummary: String {
+ switch identifier {
+ case "standard": String(localized: "The patches every vphone VM needs to boot, jailbroken, with a working display and camera.")
+ case "extended": String(localized: "Every patch this bundle declares, including the Frida Stalker relaxations and the hv_vmm_present concealment that a freshly restored 26.4 guest does not survive.")
+ default: summary
+ }
+ }
}
struct Patch: Decodable, Hashable, Identifiable, Sendable {
diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadPatchSettingsView.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadPatchSettingsView.swift
index cb87c0a5..f6896514 100644
--- a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadPatchSettingsView.swift
+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadPatchSettingsView.swift
@@ -91,7 +91,7 @@ struct VPhoneLaunchpadPatchSettingsView: View {
HStack(spacing: 12) {
Picker("Preset", selection: presetBinding) {
ForEach(catalog?.presets ?? []) { preset in
- Text(verbatim: preset.title).tag(preset.identifier)
+ Text(verbatim: preset.displayTitle).tag(preset.identifier)
}
}
.disabled(catalog == nil || isLoading)
@@ -104,7 +104,7 @@ struct VPhoneLaunchpadPatchSettingsView: View {
.textFieldStyle(.roundedBorder)
.frame(width: 200)
}
- if let summary = catalog?.preset(selection.preset)?.summary, !summary.isEmpty {
+ if let summary = catalog?.preset(selection.preset)?.displaySummary, !summary.isEmpty {
Text(verbatim: summary)
.font(.callout)
.foregroundStyle(.secondary)