Skip to content

Run a virtual iPhone on an Apple Silicon Mac.

Swift

Apply the formatter to the daemon, the VM, the IPSW cache and the host policy

Lakrb21910e01b5b
diff --git a/VPhoneDaemon/Daemon/GuestAPI+Environment.swift b/VPhoneDaemon/Daemon/GuestAPI+Environment.swift
index 399c4609..487ed5be 100644
--- a/VPhoneDaemon/Daemon/GuestAPI+Environment.swift
+++ b/VPhoneDaemon/Daemon/GuestAPI+Environment.swift
@@ -134,7 +134,9 @@ extension GuestAPI {
var buffer = [UInt8](repeating: 0, count: 1024)
while errorText.count < 4096 {
let count = read(errorPipe[0], &buffer, min(buffer.count, 4096 - errorText.count))
- if count <= 0 { break }
+ if count <= 0 {
+ break
+ }
errorText.append(contentsOf: buffer.prefix(count))
}
close(errorPipe[0])
diff --git a/VPhoneDaemon/Daemon/GuestIrisinInstaller.swift b/VPhoneDaemon/Daemon/GuestIrisinInstaller.swift
index 79d9a41a..09d5ab55 100644
--- a/VPhoneDaemon/Daemon/GuestIrisinInstaller.swift
+++ b/VPhoneDaemon/Daemon/GuestIrisinInstaller.swift
@@ -699,8 +699,12 @@ enum GuestIrisinInstaller {
var buffer = [UInt8](repeating: 0, count: 1024)
while true {
let count = read(outputPipe[0], &buffer, buffer.count)
- if count < 0, errno == EINTR { continue }
- if count <= 0 { break }
+ if count < 0, errno == EINTR {
+ continue
+ }
+ if count <= 0 {
+ break
+ }
if output.count < 4096 {
output.append(contentsOf: buffer.prefix(min(count, 4096 - output.count)))
}
diff --git a/VPhoneDaemon/Daemon/GuestLocationSimulation.swift b/VPhoneDaemon/Daemon/GuestLocationSimulation.swift
index fdf40c2a..76ba9e40 100644
--- a/VPhoneDaemon/Daemon/GuestLocationSimulation.swift
+++ b/VPhoneDaemon/Daemon/GuestLocationSimulation.swift
@@ -72,7 +72,9 @@ enum GuestLocationSimulation {
}
var openFD = fd
defer {
- if openFD >= 0 { close(openFD) }
+ if openFD >= 0 {
+ close(openFD)
+ }
unlink(temporary)
}
try data.withUnsafeBytes { buffer in
diff --git a/VPhoneExecutable/VPhoneVirtualization/UI/VirtualMachine/VPhoneVirtualMachine.swift b/VPhoneExecutable/VPhoneVirtualization/UI/VirtualMachine/VPhoneVirtualMachine.swift
index 92c842b5..22d19dd4 100644
--- a/VPhoneExecutable/VPhoneVirtualization/UI/VirtualMachine/VPhoneVirtualMachine.swift
+++ b/VPhoneExecutable/VPhoneVirtualization/UI/VirtualMachine/VPhoneVirtualMachine.swift
@@ -101,11 +101,10 @@ class VPhoneVirtualMachine: NSObject, VZVirtualMachineDelegate {
print("[vphone] Warning: failed to resolve ECID from machineIdentifier")
}
- let auxStorage: VZMacAuxiliaryStorage
- if try VPhoneVirtualMachineManifest.requireRegularFileIfPresent(at: options.nvramURL) {
- auxStorage = VZMacAuxiliaryStorage(url: options.nvramURL)
+ let auxStorage: VZMacAuxiliaryStorage = if try VPhoneVirtualMachineManifest.requireRegularFileIfPresent(at: options.nvramURL) {
+ VZMacAuxiliaryStorage(url: options.nvramURL)
} else {
- auxStorage = try VZMacAuxiliaryStorage(
+ try VZMacAuxiliaryStorage(
creatingStorageAt: options.nvramURL,
hardwareModel: hwModel,
options: [],
diff --git a/VPhoneKit/VPhoneArchiveKit/Transfer/VPhoneIPSWCache.swift b/VPhoneKit/VPhoneArchiveKit/Transfer/VPhoneIPSWCache.swift
index 9d4f74c5..9d958503 100644
--- a/VPhoneKit/VPhoneArchiveKit/Transfer/VPhoneIPSWCache.swift
+++ b/VPhoneKit/VPhoneArchiveKit/Transfer/VPhoneIPSWCache.swift
@@ -127,7 +127,7 @@ public enum VPhoneIPSWCache {
}
/// The cached archive when it is readable; an unreadable one is removed.
- private static func reuse(_ cache: URL, in cacheDirectory: URL) throws -> Archive? {
+ private static func reuse(_ cache: URL, in _: URL) throws -> Archive? {
guard FileManager.default.fileExists(atPath: cache.path) else { return nil }
guard let valid = try? inspect(cache) else {
try FileManager.default.removeItem(at: cache)
diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadPreview.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadPreview.swift
index 0d490b8c..4309544f 100644
--- a/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadPreview.swift
+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadPreview.swift
@@ -82,6 +82,18 @@
await shot("06-machines-creating", suffix)
await sheet(.newMachine, "07-new-machine", suffix)
+ await standalone("07b-new-machine-advanced", suffix, size: NSSize(width: 520, height: 560)) {
+ VPhoneLaunchpadNewMachineAdvancedView(
+ network: .constant("nat"),
+ patches: .constant(VPhoneLaunchpadPatchSelection()),
+ forceMaxSlide: .constant(false),
+ keepArtifacts: .constant(false),
+ patchCatalog: nil,
+ patchCatalogError: nil,
+ reloadPatches: {},
+ )
+ .environment(model)
+ }
await sheet(.creation(path("ios27-rc")), "08-creation-progress", suffix)
creation.applyPreview(failed: true)
await sheet(.creation(path("ios27-rc")), "08b-creation-failed", suffix)
diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadSheet.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadSheet.swift
new file mode 100644
index 00000000..043121e7
--- /dev/null
+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadSheet.swift
@@ -0,0 +1,64 @@
+import SwiftUI
+
+/// The frame every sheet shares, after the console: a title over a divider,
+/// the content, and a divider over the buttons. A sheet's toolbar only lays its
+/// buttons along the bottom and shows no title, so the sheet had no head.
+struct VPhoneLaunchpadSheet<Content: View, Accessory: View, Actions: View>: View {
+ let title: Text
+ @ViewBuilder let content: Content
+ /// Secondary buttons or status, on the leading side of the footer.
+ @ViewBuilder let accessory: Accessory
+ /// Cancel and confirm, on the trailing side of the footer.
+ @ViewBuilder let actions: Actions
+
+ init(
+ _ title: Text,
+ @ViewBuilder content: () -> Content,
+ @ViewBuilder accessory: () -> Accessory,
+ @ViewBuilder actions: () -> Actions,
+ ) {
+ self.title = title
+ self.content = content()
+ self.accessory = accessory()
+ self.actions = actions()
+ }
+
+ var body: some View {
+ VStack(spacing: 0) {
+ HStack {
+ title
+ .font(.headline)
+ .lineLimit(1)
+ .truncationMode(.middle)
+ Spacer()
+ }
+ .padding(.horizontal, 16)
+ .padding(.vertical, 12)
+
+ Divider()
+
+ content
+ .frame(maxWidth: .infinity, maxHeight: .infinity)
+
+ Divider()
+
+ HStack(spacing: 8) {
+ accessory
+ Spacer(minLength: 16)
+ actions
+ }
+ .padding(.horizontal, 16)
+ .padding(.vertical, 12)
+ }
+ }
+}
+
+extension VPhoneLaunchpadSheet where Accessory == EmptyView {
+ init(
+ _ title: Text,
+ @ViewBuilder content: () -> Content,
+ @ViewBuilder actions: () -> Actions,
+ ) {
+ self.init(title, content: content, accessory: { EmptyView() }, actions: actions)
+ }
+}
diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadStatus.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadStatus.swift
index 76254451..825d2a7a 100644
--- a/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadStatus.swift
+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Application/VPhoneLaunchpadStatus.swift
@@ -26,8 +26,7 @@ struct VPhoneLaunchpadStatusIcon: View {
private var symbol: some View {
switch status {
case .running:
- ProgressView()
- .controlSize(.mini)
+ VPhoneLaunchpadSpinner()
case .passed:
Image(systemName: "checkmark.circle.fill").foregroundStyle(.green)
case .warning:
@@ -39,3 +38,20 @@ struct VPhoneLaunchpadStatusIcon: View {
}
}
}
+
+/// A spinner drawn by SwiftUI on every frame. The system one wraps an
+/// NSProgressIndicator, which stops turning when a Form or Table row is
+/// redrawn around it, so a long step looked stuck.
+struct VPhoneLaunchpadSpinner: View {
+ var body: some View {
+ TimelineView(.animation) { context in
+ let turn = context.date.timeIntervalSinceReferenceDate.truncatingRemainder(dividingBy: 1)
+ Circle()
+ .trim(from: 0, to: 0.7)
+ .stroke(.secondary, style: StrokeStyle(lineWidth: 2, lineCap: .round))
+ .rotationEffect(.degrees(turn * 360))
+ .padding(2)
+ }
+ .accessibilityLabel(Text("In progress"))
+ }
+}
diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Command/VPhoneLaunchpadCommandInfoButton.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Command/VPhoneLaunchpadCommandInfoButton.swift
new file mode 100644
index 00000000..0cd7ed95
--- /dev/null
+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Command/VPhoneLaunchpadCommandInfoButton.swift
@@ -0,0 +1,35 @@
+import AppKit
+import SwiftUI
+
+/// An (i) button that keeps a command out of the row and shows it, with a
+/// copy button, in a popover.
+struct VPhoneLaunchpadCommandInfoButton: View {
+ let command: String
+ @State private var isShown = false
+
+ var body: some View {
+ Button {
+ isShown.toggle()
+ } label: {
+ Image(systemName: "info.circle")
+ .foregroundStyle(.secondary)
+ }
+ .buttonStyle(.borderless)
+ .help("Show the command")
+ .accessibilityLabel(Text("Show the command"))
+ .popover(isPresented: $isShown, arrowEdge: .trailing) {
+ HStack(alignment: .firstTextBaseline, spacing: 8) {
+ Text(verbatim: command)
+ .font(.system(.callout, design: .monospaced))
+ .textSelection(.enabled)
+ .fixedSize(horizontal: false, vertical: true)
+ .frame(maxWidth: 480, alignment: .leading)
+ Button("Copy Command") {
+ NSPasteboard.general.clearContents()
+ NSPasteboard.general.setString(command, forType: .string)
+ }
+ }
+ .padding(12)
+ }
+ }
+}
diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/CoreBundle/VPhoneLaunchpadCoreBundleView.swift b/VPhoneLaunchpad/VPhoneLaunchpad/CoreBundle/VPhoneLaunchpadCoreBundleView.swift
index 67fc6714..fd68ecdb 100644
--- a/VPhoneLaunchpad/VPhoneLaunchpad/CoreBundle/VPhoneLaunchpadCoreBundleView.swift
+++ b/VPhoneLaunchpad/VPhoneLaunchpad/CoreBundle/VPhoneLaunchpadCoreBundleView.swift
@@ -23,50 +23,39 @@ struct VPhoneLaunchpadCoreBundleView: View {
var body: some View {
@Bindable var bundles = bundles
- Form {
- if bundles.isInstalling {
- Section {
- Text("An install is in progress. Follow it in the inspector.")
- .foregroundStyle(.secondary)
- }
- }
- if !bundles.installed.isEmpty {
- installedSection
- }
- availableSection
- }
- .formStyle(.grouped)
- .navigationTitle("Core Bundle")
- .frame(width: 640, height: 480)
- .errorAlert($bundles.actionError)
- #if DEBUG
- .onAppear {
- if VPhoneLaunchpadPreview.isActive {
- source = VPhoneLaunchpadPreview.coreBundleSource
+ VPhoneLaunchpadSheet(Text("Core Bundle")) {
+ Form {
+ if bundles.isInstalling {
+ Section {
+ Text("An install is in progress. Follow it in the inspector.")
+ .foregroundStyle(.secondary)
+ }
}
- }
- #endif
- .toolbar {
- ToolbarItem(placement: .automatic) {
- Button("Install Local Build…") {
- chooseLocalBuild()
+ if !bundles.installed.isEmpty {
+ installedSection
}
- .help(model.canInstallBundles
- ? "Install a VPhone.bundle folder or .zip built on this Mac."
- : "Installing needs the privileged helper and Developer Tools access.")
- .disabled(!model.canInstallBundles)
+ availableSection
}
- ToolbarItem(placement: .automatic) {
- Button("Check for Updates") {
- Task { await bundles.refresh() }
- }
- .help("Reload releases and builds, and run host preflight again.")
- .disabled(bundles.isInstalling)
+ .formStyle(.grouped)
+ } accessory: {
+ Button("Install Local Build…") {
+ chooseLocalBuild()
}
- ToolbarItem(placement: .confirmationAction) {
- Button("Done") { dismiss() }
+ .help(model.canInstallBundles
+ ? "Install a VPhone.bundle folder or .zip built on this Mac."
+ : "Installing needs the privileged helper and Developer Tools access.")
+ .disabled(!model.canInstallBundles)
+ Button("Check for Updates") {
+ Task { await bundles.refresh() }
}
+ .help("Reload releases and builds, and run host preflight again.")
+ .disabled(bundles.isInstalling)
+ } actions: {
+ Button("Done") { dismiss() }
+ .keyboardShortcut(.defaultAction)
}
+ .frame(width: 640, height: 520)
+ .errorAlert($bundles.actionError)
.confirmationDialog(
"Remove VPhone.bundle \(removal ?? "")?",
isPresented: Binding(get: { removal != nil }, set: {
@@ -83,6 +72,13 @@ struct VPhoneLaunchpadCoreBundleView: View {
} message: {
Text("Machines are not affected. You can install this version again later.")
}
+ #if DEBUG
+ .onAppear {
+ if VPhoneLaunchpadPreview.isActive {
+ source = VPhoneLaunchpadPreview.coreBundleSource
+ }
+ }
+ #endif
}
// MARK: - Installed
diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/CoreBundle/VPhoneLaunchpadInstallSection.swift b/VPhoneLaunchpad/VPhoneLaunchpad/CoreBundle/VPhoneLaunchpadInstallSection.swift
index ae1e30bb..5eb6f9d4 100644
--- a/VPhoneLaunchpad/VPhoneLaunchpad/CoreBundle/VPhoneLaunchpadInstallSection.swift
+++ b/VPhoneLaunchpad/VPhoneLaunchpad/CoreBundle/VPhoneLaunchpadInstallSection.swift
@@ -14,6 +14,11 @@ struct VPhoneLaunchpadInstallSection: View {
if let progress = bundles.progress {
Section {
summary(progress)
+ // Under the summary, so the download moves while collapsed too.
+ if progress.status(.download) == .running {
+ ProgressView(value: Double(progress.received), total: Double(max(progress.size, 1)))
+ .labelsHidden()
+ }
if model.isInstallExpanded {
details(progress)
}
@@ -84,10 +89,6 @@ struct VPhoneLaunchpadInstallSection: View {
}
}
}
- if progress.status(.download) == .running {
- ProgressView(value: Double(progress.received), total: Double(max(progress.size, 1)))
- .labelsHidden()
- }
if let error = progress.error {
VStack(alignment: .leading, spacing: 4) {
Text(error.message)
diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/HostSetup/VPhoneLaunchpadHostSetupView.swift b/VPhoneLaunchpad/VPhoneLaunchpad/HostSetup/VPhoneLaunchpadHostSetupView.swift
index b8f6cbec..4f06abce 100644
--- a/VPhoneLaunchpad/VPhoneLaunchpad/HostSetup/VPhoneLaunchpadHostSetupView.swift
+++ b/VPhoneLaunchpad/VPhoneLaunchpad/HostSetup/VPhoneLaunchpadHostSetupView.swift
@@ -11,6 +11,32 @@ struct VPhoneLaunchpadHostSetupView: View {
var body: some View {
@Bindable var host = host
+ VPhoneLaunchpadSheet(Text("Host Setup")) {
+ form
+ } accessory: {
+ Button("Check Again") {
+ Task { await model.refreshHost() }
+ }
+ .help("Run every check again")
+ .disabled(host.isChecking)
+ } actions: {
+ // Straight on to the next stage while it is not ready.
+ if host.requiredPassed, !model.bundles.isReady {
+ Button("Continue") { model.panel = .coreBundle }
+ .keyboardShortcut(.defaultAction)
+ } else {
+ Button("Done") { dismiss() }
+ .keyboardShortcut(.defaultAction)
+ }
+ }
+ .frame(width: 600, height: 600)
+ .onReceive(NotificationCenter.default.publisher(for: NSApplication.didBecomeActiveNotification)) { _ in
+ host.refreshDeveloperTools()
+ }
+ .errorAlert($host.actionError)
+ }
+
+ private var form: some View {
Form {
Section {
ForEach(host.required) { check in
@@ -54,29 +80,6 @@ struct VPhoneLaunchpadHostSetupView: View {
}
}
.formStyle(.grouped)
- .navigationTitle("Host Setup")
- .frame(width: 600, height: 560)
- .onReceive(NotificationCenter.default.publisher(for: NSApplication.didBecomeActiveNotification)) { _ in
- host.refreshDeveloperTools()
- }
- .errorAlert($host.actionError)
- .toolbar {
- ToolbarItem(placement: .automatic) {
- Button("Check Again") {
- Task { await model.refreshHost() }
- }
- .help("Run every check again")
- .disabled(host.isChecking)
- }
- ToolbarItem(placement: .confirmationAction) {
- // Straight on to the next stage while it is not ready.
- if host.requiredPassed, !model.bundles.isReady {
- Button("Continue") { model.panel = .coreBundle }
- } else {
- Button("Done") { dismiss() }
- }
- }
- }
}
/// Icon, title, then detail and any action pinned to the trailing edge.
diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Localizable.xcstrings b/VPhoneLaunchpad/VPhoneLaunchpad/Localizable.xcstrings
index 2a1c97e3..312f41d6 100644
--- a/VPhoneLaunchpad/VPhoneLaunchpad/Localizable.xcstrings
+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Localizable.xcstrings
@@ -1101,6 +1101,74 @@
}
}
},
+ "Advanced" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Advanced"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "詳細"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "고급"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Nâng cao"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "高级"
+ }
+ }
+ }
+ },
+ "Advanced Options" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Advanced Options"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "詳細オプション"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "고급 옵션"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Tùy chọn nâng cao"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "高级选项"
+ }
+ }
+ }
+ },
"Advisory" : {
"localizations" : {
"en" : {
@@ -3969,6 +4037,40 @@
}
}
},
+ "Edit…" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Edit…"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "編集…"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "편집…"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Sửa…"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "编辑…"
+ }
+ }
+ }
+ },
"Every release is installed." : {
"localizations" : {
"en" : {
@@ -5057,6 +5159,40 @@
}
}
},
+ "In progress" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "In progress"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "処理中"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "진행 중"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Đang thực hiện"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "进行中"
+ }
+ }
+ }
+ },
"In use" : {
"localizations" : {
"en" : {
@@ -7743,6 +7879,74 @@
}
}
},
+ "Patch Settings…" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Patch Settings…"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "パッチ設定…"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "패치 설정…"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Cài đặt bản vá…"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "补丁设置…"
+ }
+ }
+ }
+ },
+ "Patches" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Patches"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "パッチ"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "패치"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Bản vá"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "补丁"
+ }
+ }
+ }
+ },
"Pre-release" : {
"localizations" : {
"en" : {
@@ -7947,6 +8151,40 @@
}
}
},
+ "Preset" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Preset"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "プリセット"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "프리셋"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Cấu hình sẵn"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "预设"
+ }
+ }
+ }
+ },
"Privileged helper" : {
"localizations" : {
"en" : {
@@ -8117,6 +8355,40 @@
}
}
},
+ "Reading the bundle's patches…" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Reading the bundle's patches…"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "バンドルのパッチを読み込んでいます…"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "번들의 패치를 읽는 중…"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Đang đọc các bản vá của bundle…"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "正在读取包中的补丁…"
+ }
+ }
+ }
+ },
"Recent Commands" : {
"localizations" : {
"en" : {
@@ -9511,6 +9783,40 @@
}
}
},
+ "Show the command" : {
+ "localizations" : {
+ "en" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Show the command"
+ }
+ },
+ "ja" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "コマンドを表示"
+ }
+ },
+ "ko" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "명령 보기"
+ }
+ },
+ "vi" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "Hiển thị lệnh"
+ }
+ },
+ "zh-Hans" : {
+ "stringUnit" : {
+ "state" : "translated",
+ "value" : "显示命令"
+ }
+ }
+ }
+ },
"Show Progress" : {
"localizations" : {
"en" : {
diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadConsoleView.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadConsoleView.swift
index 793b063b..d97fe12f 100644
--- a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadConsoleView.swift
+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadConsoleView.swift
@@ -5,30 +5,16 @@ struct VPhoneLaunchpadConsoleView: View {
let title: LocalizedStringKey
let url: URL
@Environment(\.dismiss) private var dismiss
- private let padding: CGFloat = 16
var body: some View {
- VStack(spacing: 12) {
- HStack {
- Text(title)
- .font(.headline)
- Spacer()
- }
-
- Divider()
- .padding(.horizontal, -padding)
-
+ VPhoneLaunchpadSheet(Text(title)) {
VPhoneLaunchpadLogTerminal(url: url)
.frame(minWidth: 900, maxWidth: .infinity, minHeight: 560, maxHeight: .infinity)
-
- Divider()
- .padding(.horizontal, -padding)
-
- HStack {
- Spacer()
- Button("Close") { dismiss() }
- }
+ .padding(.horizontal, 16)
+ .padding(.vertical, 12)
+ } actions: {
+ Button("Close") { dismiss() }
+ .keyboardShortcut(.cancelAction)
}
- .padding(padding)
}
}
diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachineSheets.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachineSheets.swift
index 914e46a2..9febcff9 100644
--- a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachineSheets.swift
+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachineSheets.swift
@@ -17,36 +17,34 @@ struct VPhoneLaunchpadMachineSettingsView: View {
}
var body: some View {
- Form {
- Section {
- Stepper("CPU: \(cpu) cores", value: $cpu, in: 1 ... ProcessInfo.processInfo.activeProcessorCount)
- Stepper("Memory: \(memoryMB) MB", value: $memoryMB, in: 2048 ... 65536, step: 1024)
- } header: {
- Text("Hardware")
- }
- Section("Network") {
- Picker("Mode", selection: $network) {
- Text("NAT").tag("nat")
- Text("Bridged").tag("bridged")
- Text("None").tag("none")
+ VPhoneLaunchpadSheet(Text("\(machine.name) Settings")) {
+ Form {
+ Section {
+ Stepper("CPU: \(cpu) cores", value: $cpu, in: 1 ... ProcessInfo.processInfo.activeProcessorCount)
+ Stepper("Memory: \(memoryMB) MB", value: $memoryMB, in: 2048 ... 65536, step: 1024)
+ } header: {
+ Text("Hardware")
}
- if network == "bridged" {
- TextField("Interface", text: $bridgeInterface, prompt: Text("First available"))
+ Section("Network") {
+ Picker("Mode", selection: $network) {
+ Text("NAT").tag("nat")
+ Text("Bridged").tag("bridged")
+ Text("None").tag("none")
+ }
+ if network == "bridged" {
+ TextField("Interface", text: $bridgeInterface, prompt: Text("First available"))
+ }
}
}
+ .formStyle(.grouped)
+ } actions: {
+ Button("Cancel") { dismiss() }
+ .keyboardShortcut(.cancelAction)
+ Button("Save") { save() }
+ .keyboardShortcut(.defaultAction)
}
- .formStyle(.grouped)
- .navigationTitle("\(machine.name) Settings")
.frame(width: 440)
.fixedSize(horizontal: false, vertical: true)
- .toolbar {
- ToolbarItem(placement: .cancellationAction) {
- Button("Cancel") { dismiss() }
- }
- ToolbarItem(placement: .confirmationAction) {
- Button("Save") { save() }
- }
- }
.onAppear {
cpu = machine.cpuCount
memoryMB = machine.memoryMB
@@ -91,35 +89,33 @@ struct VPhoneLaunchpadNameSheet: View {
}
var body: some View {
- Form {
- Section {
- TextField("Name", text: $name)
- } footer: {
- if fitsLocation {
- Text("Use letters, numbers, periods, hyphens, and underscores.")
- .foregroundStyle(.secondary)
- } else {
- Text("The path is too long. Use a shorter name, or a location with a shorter path.")
- .foregroundStyle(.red)
+ VPhoneLaunchpadSheet(Text(title)) {
+ Form {
+ Section {
+ TextField("Name", text: $name)
+ } footer: {
+ if fitsLocation {
+ Text("Use letters, numbers, periods, hyphens, and underscores.")
+ .foregroundStyle(.secondary)
+ } else {
+ Text("The path is too long. Use a shorter name, or a location with a shorter path.")
+ .foregroundStyle(.red)
+ }
}
}
+ .formStyle(.grouped)
+ } actions: {
+ Button("Cancel") { dismiss() }
+ .keyboardShortcut(.cancelAction)
+ Button(action) {
+ onConfirm(name)
+ dismiss()
+ }
+ .keyboardShortcut(.defaultAction)
+ .disabled(!isValid)
}
- .formStyle(.grouped)
- .navigationTitle(title)
.frame(width: 420)
.fixedSize(horizontal: false, vertical: true)
- .toolbar {
- ToolbarItem(placement: .cancellationAction) {
- Button("Cancel") { dismiss() }
- }
- ToolbarItem(placement: .confirmationAction) {
- Button(action) {
- onConfirm(name)
- dismiss()
- }
- .disabled(!isValid)
- }
- }
.onAppear { name = initial }
}
}
@@ -138,29 +134,27 @@ struct VPhoneLaunchpadExportView: View {
}
var body: some View {
- Form {
- Section {
- Toggle("Maximum compression", isOn: $densest)
- Toggle("Include the restore IPSW directory", isOn: $includeIPSW)
- } footer: {
- Text(densest
- ? "Creates a smaller .txz archive. Export takes much longer."
- : "Creates a .tzst archive.")
- .foregroundStyle(.secondary)
+ VPhoneLaunchpadSheet(Text("Export \(name)")) {
+ Form {
+ Section {
+ Toggle("Maximum compression", isOn: $densest)
+ Toggle("Include the restore IPSW directory", isOn: $includeIPSW)
+ } footer: {
+ Text(densest
+ ? "Creates a smaller .txz archive. Export takes much longer."
+ : "Creates a .tzst archive.")
+ .foregroundStyle(.secondary)
+ }
}
+ .formStyle(.grouped)
+ } actions: {
+ Button("Cancel") { dismiss() }
+ .keyboardShortcut(.cancelAction)
+ Button("Choose Location…") { choose() }
+ .keyboardShortcut(.defaultAction)
}
- .formStyle(.grouped)
- .navigationTitle("Export \(name)")
.frame(width: 420)
.fixedSize(horizontal: false, vertical: true)
- .toolbar {
- ToolbarItem(placement: .cancellationAction) {
- Button("Cancel") { dismiss() }
- }
- ToolbarItem(placement: .confirmationAction) {
- Button("Choose Location…") { choose() }
- }
- }
}
private func choose() {
diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachinesView.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachinesView.swift
index a1d5a824..51dfdfcf 100644
--- a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachinesView.swift
+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachinesView.swift
@@ -64,6 +64,14 @@ struct VPhoneLaunchpadMachinesView: View {
}
}
.inspectorColumnWidth(min: 300, ideal: 360, max: 520)
+ // The toggle belongs to the inspector's own toolbar section. Put in
+ // the content's toolbar, the section and its background were set up
+ // at launch but not again after the inspector was hidden and shown.
+ .toolbar {
+ ToolbarItem(placement: .automatic) {
+ inspectorToggle
+ }
+ }
}
.toolbar { toolbar }
#if DEBUG
@@ -113,8 +121,8 @@ struct VPhoneLaunchpadMachinesView: View {
let selected = library.selected
let state = selected.map { library.state(of: $0.path) }
// Host Setup and Core Bundle hold the leading edge; the space pushes
- // everything here to the trailing edge, in three groups: the selected
- // machine, the library, and the inspector toggle above the inspector.
+ // everything here to the trailing edge, in two groups: the selected
+ // machine and the library. The inspector toggle is in the inspector.
ToolbarItem(placement: .automatic) {
Spacer()
}
@@ -160,13 +168,6 @@ struct VPhoneLaunchpadMachinesView: View {
.help("Create a machine")
.disabled(model.bundles.activeVersion == nil)
}
- // Adjacent items share one background on macOS 26.
- if #available(macOS 26.0, *) {
- ToolbarSpacer(.fixed)
- }
- ToolbarItem(placement: .automatic) {
- inspectorToggle
- }
}
private var inspectorToggle: some View {
diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadNewMachineAdvancedView.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadNewMachineAdvancedView.swift
new file mode 100644
index 00000000..0f09b8b7
--- /dev/null
+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadNewMachineAdvancedView.swift
@@ -0,0 +1,127 @@
+import SwiftUI
+
+/// New Machine's second page: network, patches and restore options. It edits
+/// New Machine's own state, so Done only closes it.
+struct VPhoneLaunchpadNewMachineAdvancedView: View {
+ @Binding var network: String
+ @Binding var patches: VPhoneLaunchpadPatchSelection
+ @Binding var forceMaxSlide: Bool
+ @Binding var keepArtifacts: Bool
+ let patchCatalog: VPhoneLaunchpadPatchCatalog?
+ let patchCatalogError: String?
+ /// New Machine owns the catalog, which is read again for each preset.
+ let reloadPatches: () -> Void
+
+ @Environment(VPhoneLaunchpadModel.self) private var model
+ @Environment(\.dismiss) private var dismiss
+ @State private var showsPatchSettings = false
+
+ static func networkTitle(_ mode: String) -> String {
+ switch mode {
+ case "bridged": String(localized: "Bridged")
+ case "none": String(localized: "None")
+ default: String(localized: "NAT")
+ }
+ }
+
+ var body: some View {
+ VPhoneLaunchpadSheet(Text("Advanced Options")) {
+ Form {
+ Section("Network") {
+ Picker("Mode", selection: $network) {
+ Text("NAT").tag("nat")
+ Text("Bridged").tag("bridged")
+ Text("None").tag("none")
+ }
+ }
+
+ patchSection
+
+ Section("Options") {
+ Toggle("Disable dyld shared cache randomization", isOn: $forceMaxSlide)
+ Toggle("Keep prepared restore files", isOn: $keepArtifacts)
+ }
+ }
+ .formStyle(.grouped)
+ } actions: {
+ Button("Done") { dismiss() }
+ .keyboardShortcut(.defaultAction)
+ }
+ .frame(width: 520)
+ .fixedSize(horizontal: false, vertical: true)
+ .sheet(isPresented: $showsPatchSettings) {
+ VPhoneLaunchpadPatchSettingsView(machine: nil, initial: patches) { selection in
+ patches = selection
+ reloadPatches()
+ }
+ .environment(model)
+ }
+ }
+
+ // MARK: - Patches
+
+ private var patchSection: some View {
+ Section {
+ if let patchCatalog {
+ Picker("Preset", selection: presetBinding) {
+ ForEach(patchCatalog.presets) { preset in
+ Text(verbatim: preset.title).tag(preset.identifier)
+ }
+ }
+ LabeledContent("Patches") {
+ Button("Patch Settings…") { showsPatchSettings = true }
+ }
+ } else if let patchCatalogError {
+ Label(patchCatalogError, systemImage: "exclamationmark.triangle")
+ .foregroundStyle(.secondary)
+ .textSelection(.enabled)
+ } else {
+ HStack {
+ ProgressView().controlSize(.small)
+ Text("Reading the bundle's patches…").foregroundStyle(.secondary)
+ }
+ }
+ } header: {
+ Text("Patches")
+ } footer: {
+ patchNote
+ }
+ }
+
+ @ViewBuilder
+ 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 {
+ Text(verbatim: summary).foregroundStyle(.secondary)
+ }
+ if patches.hasOverrides {
+ Text("Differs from the preset: \(patches.blocked.count) off, \(patches.allowed.count) on.")
+ .foregroundStyle(.secondary)
+ }
+ if !essentialOff.isEmpty {
+ Label {
+ Text("^[\(essentialOff.count) boot-essential patch](inflect: true) off: \(essentialOff.map(\.identifier).joined(separator: ", "))")
+ } icon: {
+ Image(systemName: "exclamationmark.triangle.fill")
+ }
+ .foregroundStyle(.orange)
+ }
+ }
+ }
+
+ /// Switching preset here re-bases the overrides for the same reason the editor
+ /// does: they are read as a difference from whichever preset is active.
+ private var presetBinding: Binding<String> {
+ Binding(
+ get: { patches.preset },
+ set: { identifier in
+ guard identifier != patches.preset else {
+ return
+ }
+ patches = VPhoneLaunchpadPatchSelection(preset: identifier)
+ reloadPatches()
+ },
+ )
+ }
+}
diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadNewMachineView.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadNewMachineView.swift
index 0d1affa0..b5d18858 100644
--- a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadNewMachineView.swift
+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadNewMachineView.swift
@@ -26,7 +26,7 @@ struct VPhoneLaunchpadNewMachineView: View {
@State private var patches = VPhoneLaunchpadPatchSelection()
@State private var patchCatalog: VPhoneLaunchpadPatchCatalog?
@State private var patchCatalogError: String?
- @State private var showsPatchSettings = false
+ @State private var showsAdvanced = false
@State private var forceMaxSlide = false
@State private var keepArtifacts = false
@@ -86,102 +86,74 @@ struct VPhoneLaunchpadNewMachineView: View {
}
var body: some View {
- Form {
- Section {
- TextField("Name", text: $name, prompt: Text(verbatim: Self.defaultName))
- locationPicker
- } footer: {
- if let problem = nameProblem ?? locationProblem {
- Text(problem).foregroundStyle(.red)
+ VPhoneLaunchpadSheet(Text("New Machine")) {
+ Form {
+ Section {
+ TextField("Name", text: $name, prompt: Text(verbatim: Self.defaultName))
+ locationPicker
+ } footer: {
+ if let problem = nameProblem ?? locationProblem {
+ Text(problem).foregroundStyle(.red)
+ }
}
- }
- firmware
+ firmware
- Section("Hardware") {
- Stepper("CPU: \(cpu) cores", value: $cpu, in: 1 ... ProcessInfo.processInfo.activeProcessorCount)
- Stepper("Memory: \(memoryMB) MB", value: $memoryMB, in: 2048 ... 65536, step: 1024)
- Stepper("Disk: \(diskSizeGB) GB", value: $diskSizeGB, in: 32 ... 512, step: 16)
- Picker("Network", selection: $network) {
- Text("NAT").tag("nat")
- Text("Bridged").tag("bridged")
- Text("None").tag("none")
+ Section {
+ Stepper("CPU: \(cpu) cores", value: $cpu, in: 1 ... ProcessInfo.processInfo.activeProcessorCount)
+ Stepper("Memory: \(memoryMB) MB", value: $memoryMB, in: 2048 ... 65536, step: 1024)
+ Stepper("Disk: \(diskSizeGB) GB", value: $diskSizeGB, in: 32 ... 512, step: 16)
+ } header: {
+ Text("Hardware")
+ } footer: {
+ Text(spaceNote).foregroundStyle(.secondary)
}
- }
- patchSection
-
- Section {
- Toggle("Disable dyld shared cache randomization", isOn: $forceMaxSlide)
- Toggle("Keep prepared restore files", isOn: $keepArtifacts)
- } header: {
- Text("Options")
- } footer: {
- Text(spaceNote).foregroundStyle(.secondary)
+ advancedSection
}
+ .formStyle(.grouped)
+ } actions: {
+ Button("Cancel") { dismiss() }
+ .keyboardShortcut(.cancelAction)
+ Button("Create") { create() }
+ .keyboardShortcut(.defaultAction)
+ .disabled(!canCreate)
}
- .formStyle(.grouped)
- .navigationTitle("New Machine")
- .frame(width: 560, height: 780)
- .sheet(isPresented: $showsPatchSettings) {
- VPhoneLaunchpadPatchSettingsView(machine: nil, initial: patches) { selection in
- patches = selection
- Task { await loadPatchCatalog() }
- }
+ .frame(width: 560)
+ .fixedSize(horizontal: false, vertical: true)
+ .sheet(isPresented: $showsAdvanced) {
+ VPhoneLaunchpadNewMachineAdvancedView(
+ network: $network,
+ patches: $patches,
+ forceMaxSlide: $forceMaxSlide,
+ keepArtifacts: $keepArtifacts,
+ patchCatalog: patchCatalog,
+ patchCatalogError: patchCatalogError,
+ reloadPatches: { Task { await loadPatchCatalog() } },
+ )
.environment(model)
}
- .toolbar {
- ToolbarItem(placement: .cancellationAction) {
- Button("Cancel") { dismiss() }
- }
- ToolbarItem(placement: .confirmationAction) {
- Button("Create") { create() }
- .disabled(!canCreate)
- }
- }
.task { await loadCatalog() }
.task { await loadPatchCatalog() }
.onAppear { location = model.machines.preferredRoot }
}
- // MARK: - Patches
+ // MARK: - Advanced
- private var patchSection: some View {
+ /// Network, patches and restore options, which rarely change, behind one row.
+ private var advancedSection: some View {
Section {
- if let patchCatalog {
- Picker("Preset", selection: presetBinding) {
- ForEach(patchCatalog.presets) { preset in
- Text(verbatim: preset.title).tag(preset.identifier)
- }
- }
- Button("Patch Settings…") { showsPatchSettings = true }
- } else if let patchCatalogError {
- Label(patchCatalogError, systemImage: "exclamationmark.triangle")
- .foregroundStyle(.secondary)
- } else {
- HStack {
- ProgressView().controlSize(.small)
- Text("Reading the bundle's patches…").foregroundStyle(.secondary)
+ LabeledContent("Advanced") {
+ HStack(spacing: 8) {
+ Text(verbatim: advancedSummary)
+ .foregroundStyle(.secondary)
+ .lineLimit(1)
+ .truncationMode(.tail)
+ Button("Edit…") { showsAdvanced = true }
}
}
- } header: {
- Text("Patches")
} footer: {
- patchNote
- }
- }
-
- @ViewBuilder
- 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 {
- Text(verbatim: summary).foregroundStyle(.secondary)
- }
- if patches.hasOverrides {
- Text("Differs from the preset: \(patches.blocked.count) off, \(patches.allowed.count) on.")
- .foregroundStyle(.secondary)
- }
+ let essentialOff = patchCatalog.map { patches.bootEssentialOff(in: $0) } ?? []
if !essentialOff.isEmpty {
Label {
Text("^[\(essentialOff.count) boot-essential patch](inflect: true) off: \(essentialOff.map(\.identifier).joined(separator: ", "))")
@@ -193,19 +165,13 @@ struct VPhoneLaunchpadNewMachineView: View {
}
}
- /// Switching preset here re-bases the overrides for the same reason the editor
- /// does: they are read as a difference from whichever preset is active.
- private var presetBinding: Binding<String> {
- Binding(
- get: { patches.preset },
- set: { identifier in
- guard identifier != patches.preset else {
- return
- }
- patches = VPhoneLaunchpadPatchSelection(preset: identifier)
- Task { await loadPatchCatalog() }
- },
- )
+ /// 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 {
+ return network
+ }
+ return "\(network) · \(preset)"
}
// MARK: - Location
@@ -415,69 +381,58 @@ struct VPhoneLaunchpadCreationView: View {
@State private var showsLog = false
var body: some View {
- Form {
- Section {
- ForEach(VPhoneLaunchpadCreationPipeline.Step.allCases) { step in
- stepRow(step)
- }
- } footer: {
- if creation.isRunning {
- Text("Creation continues if you close this window.").foregroundStyle(.secondary)
+ VPhoneLaunchpadSheet(Text("Creating \(creation.options.name)")) {
+ Form {
+ Section {
+ ForEach(VPhoneLaunchpadCreationPipeline.Step.allCases) { step in
+ stepRow(step)
+ }
+ } footer: {
+ if creation.isRunning {
+ Text("Creation continues if you close this window.").foregroundStyle(.secondary)
+ }
}
}
- Section {
- Button {
- showsLog = true
- } label: {
- Label("Open Log", systemImage: "arrow.up.right")
- }
+ .formStyle(.grouped)
+ } accessory: {
+ Button("Open Log") { showsLog = true }
+ } actions: {
+ if creation.isRunning {
+ Button("Stop Creating", role: .destructive) { creation.cancel() }
+ }
+ if !creation.isRunning, let step = creation.failedStep {
+ Button("Retry from \(step.title)") { creation.start(from: step) }
}
+ Button("Close") { dismiss() }
+ .keyboardShortcut(.cancelAction)
}
- .formStyle(.grouped)
- .navigationTitle("Creating \(creation.options.name)")
- .frame(width: 720, height: 640)
+ .frame(width: 720)
+ .fixedSize(horizontal: false, vertical: true)
.sheet(isPresented: $showsLog) {
VPhoneLaunchpadConsoleView(title: "\(creation.options.name) Creation Log", url: creation.logFile)
}
- .toolbar {
- ToolbarItem(placement: .cancellationAction) {
- Button("Close") { dismiss() }
- }
- ToolbarItem(placement: .destructiveAction) {
- if creation.isRunning {
- Button("Stop Creating", role: .destructive) { creation.cancel() }
- }
- }
- ToolbarItem(placement: .confirmationAction) {
- if !creation.isRunning, let step = creation.failedStep {
- Button("Retry from \(step.title)") { creation.start(from: step) }
- }
- }
- }
}
private func stepRow(_ step: VPhoneLaunchpadCreationPipeline.Step) -> some View {
LabeledContent {
- Text(creation.durations[step].map(Self.duration) ?? "")
- .monospacedDigit()
- .foregroundStyle(.secondary)
+ HStack(spacing: 8) {
+ if let duration = creation.durations[step] {
+ Text(Self.duration(duration))
+ .monospacedDigit()
+ .foregroundStyle(.secondary)
+ }
+ VPhoneLaunchpadCommandInfoButton(command: "vphone-cli \(creation.command(for: step))")
+ }
} label: {
Label {
- VStack(alignment: .leading, spacing: 2) {
- HStack(spacing: 4) {
- Text(step.title)
- if step.needsRoot {
- Image(systemName: "lock.fill")
- .font(.caption)
- .foregroundStyle(.secondary)
- .help("Runs as root through the privileged helper")
- }
+ HStack(spacing: 4) {
+ Text(step.title)
+ if step.needsRoot {
+ Image(systemName: "lock.fill")
+ .font(.caption)
+ .foregroundStyle(.secondary)
+ .help("Runs as root through the privileged helper")
}
- Text(verbatim: "vphone-cli \(creation.command(for: step))")
- .font(.system(.caption, design: .monospaced))
- .foregroundStyle(.secondary)
- .lineLimit(1)
- .truncationMode(.middle)
}
} icon: {
VPhoneLaunchpadStatusIcon(status: creation.status(step))
diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadPatchSettingsView.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadPatchSettingsView.swift
index 26f2939f..cb87c0a5 100644
--- a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadPatchSettingsView.swift
+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadPatchSettingsView.swift
@@ -52,24 +52,27 @@ struct VPhoneLaunchpadPatchSettingsView: View {
}
var body: some View {
- VStack(spacing: 0) {
- header
- Divider()
- list
- Divider()
- footer
- }
- .navigationTitle(machine.map { Text("\($0.name) Patches") } ?? Text("Patches"))
- .frame(width: 920, height: 640)
- .toolbar {
- ToolbarItem(placement: .cancellationAction) {
- Button("Cancel") { dismiss() }
- }
- ToolbarItem(placement: .confirmationAction) {
- Button(machine == nil ? "Done" : "Save") { commit() }
- .disabled(catalog == nil)
+ VPhoneLaunchpadSheet(machine.map { Text("\($0.name) Patches") } ?? Text("Patches")) {
+ VStack(spacing: 0) {
+ header
+ Divider()
+ list
+ Divider()
+ detailPane
}
+ } accessory: {
+ Text(status)
+ .font(.caption)
+ .foregroundStyle(.secondary)
+ .lineLimit(2)
+ } actions: {
+ Button("Cancel") { dismiss() }
+ .keyboardShortcut(.cancelAction)
+ Button(machine == nil ? "Done" : "Save") { commit() }
+ .keyboardShortcut(.defaultAction)
+ .disabled(catalog == nil)
}
+ .frame(width: 920, height: 680)
.confirmationDialog(
"Leave ^[\(essentialOff.count) boot-essential patch](inflect: true) off?",
isPresented: $confirmsBootEssential,
@@ -212,7 +215,7 @@ struct VPhoneLaunchpadPatchSettingsView: View {
// MARK: - Detail
- private var footer: some View {
+ private var detailPane: some View {
VStack(alignment: .leading, spacing: 8) {
if !essentialOff.isEmpty {
Label {
@@ -225,9 +228,6 @@ struct VPhoneLaunchpadPatchSettingsView: View {
.font(.callout)
}
detail
- Text(status)
- .font(.caption)
- .foregroundStyle(.secondary)
}
.frame(maxWidth: .infinity, alignment: .leading)
.padding(12)
diff --git a/VPhoneLaunchpad/VPhoneLaunchpadShared/VPhoneLaunchpadHostPolicy.swift b/VPhoneLaunchpad/VPhoneLaunchpadShared/VPhoneLaunchpadHostPolicy.swift
index 5c320c46..15451ac7 100644
--- a/VPhoneLaunchpad/VPhoneLaunchpadShared/VPhoneLaunchpadHostPolicy.swift
+++ b/VPhoneLaunchpad/VPhoneLaunchpadShared/VPhoneLaunchpadHostPolicy.swift
@@ -40,8 +40,8 @@ nonisolated enum VPhoneLaunchpadHostPolicy {
return try activeConfiguration(query: query)
}
- // Keep the ABI boundary injectable so missing symbols and syscall failures
- // can be tested without altering the host's security configuration.
+ /// Keep the ABI boundary injectable so missing symbols and syscall failures
+ /// can be tested without altering the host's security configuration.
static func activeConfiguration(query: CSRQuery?) throws -> UInt32 {
guard let query else {
throw VPhoneLaunchpadHostPolicyError("Unable to check current host security settings: csr_get_active_config is unavailable.")