Play your own Switch games on iPhone/iPad — one-click macOS app, no terminal. | 把 Switch 游戏装进 iPhone:图形界面一键构建,不用命令行。Bring your own game.
Swift apple-siliconcustom-formathomebrewiosipaipadipadosiphonemetalnative-portnintendo-switchnxnativeromfsswitch-games
Lay out the export steps on one grid
v0lumehibca345c65bc0
diff --git a/frontend/Sources/NXLauncher/ExportSteps.swift b/frontend/Sources/NXLauncher/ExportSteps.swiftindex cb124881..098b97e5 100644--- a/frontend/Sources/NXLauncher/ExportSteps.swift+++ b/frontend/Sources/NXLauncher/ExportSteps.swift@@ -5,10 +5,16 @@ import NXModel/// The export of the shared app as an IPA, in three steps (LNPANDY/NX2Apple#416): export it, install it with another tool, send the/// game data. Shown by the Install card when its switch says "Export as IPA". Observes the build store (the steps' state) and the/// device store (the device and the place the data goes to).+///+/// The grid (ExportGrid): a step's number sits where a card row's dot sits, and everything that belongs to the step (its title, text,+/// controls, progress and notes) starts on one axis to the right of it. Each step has at most one action, a row button in the card's+/// right column, so the actions of all steps end on one edge. A control and its own small button (the device and Refresh, the folder+/// and Choose folder) form one group that fills the room up to the action.package struct ExportSteps: View {@ObservedObject var build: BuildStore@ObservedObject var devices: DeviceStore@EnvironmentObject var loc: Localizer+ @State private var detailsOpen = falsepackage init(build: BuildStore, devices: DeviceStore) {self.build = build@@ -19,75 +25,96 @@ package struct ExportSteps: View {private var sentDone: Bool {switch build.send { case .sent, .copied: return true; default: return false }}+ private var copying: Bool { if case .copying = build.send { return true } else { return false } }+ /// Step 3 waits for step 1: until the IPA exists its controls are shown, but all of them quieter and inert.+ private var inert: Bool { !exported && !sentDone }private var toDrive: Bool { devices.sendWhere == SendWhere.drive }private var gameName: String { ((build.basePath as NSString).lastPathComponent as NSString).deletingPathExtension }package var body: some View {VStack(spacing: 0) {- step(1, done: exported, title: loc.t("shell.step1Title"),+ step(1, exported ? .done : .current, title: loc.t("shell.step1Title"),sub: exported ? String(format: loc.t("shell.step1Done"), build.exportedIPAText) : loc.t("shell.step1Sub")) {if exported {- Button(loc.t("shell.showInFinder")) { revealInFinder(build.exportedIPAPath) }+ action(loc.t("shell.showInFinder")) { revealInFinder(build.exportedIPAPath) }} else {- Button(loc.t("shell.step1Button")) { build.startBuild() }.disabled(!build.canBuild || build.running)+ action(loc.t("shell.step1Button"), enabled: build.canBuild && !build.running) { build.startBuild() }}}CardDivider()- step(2, done: sentDone, title: loc.t("shell.step2Title"), sub: loc.t("shell.step2Sub")) { EmptyView() }+ step(2, sentDone ? .done : exported ? .current : .upcoming, title: loc.t("shell.step2Title"), sub: loc.t("shell.step2Sub")) { EmptyView() }CardDivider()- step(3, done: sentDone, title: loc.t("shell.step3Title"), sub: loc.t("shell.step3Sub")) {- LauncherSegmented(options: [(SendWhere.device, loc.t("shell.whereDevice")), (SendWhere.drive, loc.t("shell.whereDrive"))],- selection: devices.sendWhere) { devices.sendWhere = $0; build.refreshDrive() }- }- VStack(alignment: .leading, spacing: 10) {- if toDrive { driveBody } else { deviceBody }+ VStack(alignment: .leading, spacing: 0) {+ step(3, sentDone ? .done : exported ? .current : .upcoming, title: loc.t("shell.step3Title"), sub: loc.t("shell.step3Sub")) {+ LauncherSegmented(options: [(SendWhere.device, loc.t("shell.whereDevice")), (SendWhere.drive, loc.t("shell.whereDrive"))],+ selection: devices.sendWhere) { devices.sendWhere = $0; build.refreshDrive() }+ .frame(width: ExportGrid.switchWidth)+ .opacity(inert ? ExportGrid.quiet : 1)+ }+ VStack(alignment: .leading, spacing: ExportGrid.noteGap) {+ if toDrive { driveRow; driveStatus } else { deviceRow; deviceStatus }+ }+ .padding(.leading, ExportGrid.axis).padding(.trailing, ExportGrid.inset).padding(.bottom, ExportGrid.inset)+ .frame(maxWidth: .infinity, alignment: .leading)+ .animation(.easeInOut(duration: 0.18), value: statusKind)}- .padding(.leading, 49).padding(.trailing, 18).padding(.bottom, 16)- .frame(maxWidth: .infinity, alignment: .leading)- .disabled(!exported && !sentDone)- .opacity(exported || sentDone ? 1 : 0.5)+ .disabled(inert)}}// MARK: A step- private func step<Trailing: View>(_ number: Int, done: Bool, title: String, sub: String, @ViewBuilder trailing: () -> Trailing) -> some View {- HStack(spacing: 12) {+ private enum Phase { case upcoming, current, done }++ private func step<Trailing: View>(_ number: Int, _ phase: Phase, title: String, sub: String, @ViewBuilder trailing: () -> Trailing) -> some View {+ HStack(spacing: ExportGrid.gutter) {ZStack {- Circle().fill(done ? LauncherPalette.ready : Color.white.opacity(0.10)).frame(width: 25, height: 25)- if done { Image(systemName: "checkmark").font(.system(size: 11, weight: .bold)).foregroundStyle(.black) }- else { Text("\(number)").font(.manrope(12.5, .semibold)).foregroundStyle(.secondary) }+ Circle().fill(phase == .done ? LauncherPalette.ready : Color.white.opacity(phase == .current ? 0.12 : 0.06))+ if phase == .done { Image(systemName: "checkmark").font(.system(size: 11, weight: .bold)).foregroundStyle(.black) }+ else { Text("\(number)").font(.manrope(12.5, .semibold)).foregroundStyle(phase == .current ? .primary : .tertiary) }}+ .frame(width: ExportGrid.badge, height: ExportGrid.badge)+ .accessibilityHidden(true)VStack(alignment: .leading, spacing: 3) {- Text(title).font(.manrope(14, .semibold)).fixedSize(horizontal: false, vertical: true)- Text(sub).font(.manrope(12.5)).foregroundStyle(.secondary).fixedSize(horizontal: false, vertical: true)+ Text(title).font(.manrope(14, .semibold)).foregroundStyle(phase == .upcoming ? .secondary : .primary)+ .fixedSize(horizontal: false, vertical: true)+ Text(sub).font(.manrope(12.5)).foregroundStyle(phase == .upcoming ? .tertiary : .secondary)+ .fixedSize(horizontal: false, vertical: true)}- Spacer(minLength: 12)+ Spacer(minLength: ExportGrid.gap)trailing().launcherRowControls()}- .padding(.horizontal, 18).padding(.vertical, 13)+ .padding(.horizontal, ExportGrid.inset).padding(.vertical, 13).frame(minHeight: 52)}+ /// The one action of a step, in the card's right column: as wide and as high as every row button of the launcher.+ private func action(_ title: String, accent: Color? = nil, enabled: Bool = true, _ perform: @escaping () -> Void) -> some View {+ Button(title, action: perform)+ .buttonStyle(LauncherSecondaryButtonStyle(accent: accent))+ .disabled(!enabled)+ .launcherRowControls()+ }+// MARK: To the device- private var connectionText: String {- guard let d = devices.devices.first(where: { $0.id == devices.installDevice }) else { return "" }- return d.wired ? "USB" : d.overNetwork ? "Wi-Fi" : ""+ /// The device with its connection, so USB or Wi-Fi is part of the choice and not a word beside it.+ private var deviceOptions: [(value: String, label: String)] {+ [(value: "", label: loc.t("dev.none"))] + devices.devices.map { d in+ let link = !d.reachable ? " (" + loc.t("dev.notConnected") + ")" : d.wired ? " · USB" : d.overNetwork ? " · Wi-Fi" : ""+ return (value: d.id, label: d.name + link)+ }}- @ViewBuilder private var deviceBody: some View {- let options = [(value: "", label: loc.t("dev.none"))] + devices.devices.map { (value: $0.id, label: $0.name) }- HStack(spacing: 10) {- LauncherDropdown(options: options, selection: devices.installDevice, label: loc.t("dev.target")) { devices.installDevice = $0 }- .frame(width: 220)- if !connectionText.isEmpty { Text(connectionText).font(.mono(12)).foregroundStyle(.secondary) }- Button(loc.t("dev.refresh")) { _ = devices.refresh() }.buttonStyle(.plain).font(.manrope(13)).foregroundStyle(.secondary)- Spacer(minLength: 8)- Button { build.sendGameData() } label: { Label(loc.t("shell.sendButton"), systemImage: "arrow.up.circle") }- .buttonStyle(LauncherSecondaryButtonStyle()).disabled(!build.canSendToDevice).frame(width: LauncherControl.width)+ private var deviceRow: some View {+ HStack(spacing: ExportGrid.gap) {+ HStack(spacing: ExportGrid.tight) {+ LauncherDropdown(options: deviceOptions, selection: devices.installDevice, label: loc.t("dev.target"),+ style: .button, fill: true, leading: true) { devices.installDevice = $0 }+ RefreshDevicesButton(devices: devices)+ }+ action(loc.t("shell.sendButton"), enabled: build.canSendToDevice) { build.sendGameData() }}- deviceStatus}@ViewBuilder private var deviceStatus: some View {@@ -96,27 +123,40 @@ package struct ExportSteps: View {progress(String(format: loc.t("shell.sendProgress"), gameName, ShellInstall.sizeText(done), ShellInstall.sizeText(total)) +(note.isEmpty ? "" : " " + note), done: done, total: total)case .sent:- note(loc.t("shell.sendDone"), LauncherPalette.ready)+ note(.done, loc.t("shell.sendDone"))case .appNotFound:- note(loc.t("shell.sendNoApp"), LauncherPalette.building)+ note(.warning, loc.t("shell.sendNoApp"))case .chooseApp(let apps):- note(loc.t("shell.sendSeveral"), LauncherPalette.building)- ForEach(apps, id: \.bundle) { app in- Button(app.name.isEmpty ? app.bundle : app.name + " · " + app.bundle) { build.sendGameData(bundle: app.bundle) }- .buttonStyle(LauncherSecondaryButtonStyle())+ note(.warning, loc.t("shell.sendSeveral")) {+ ForEach(apps, id: \.bundle) { app in+ Button(app.name.isEmpty ? app.bundle : app.name + " · " + app.bundle) { build.sendGameData(bundle: app.bundle) }+ .buttonStyle(LauncherSecondaryButtonStyle())+ }}case .refused(let detail):- note(loc.t("shell.sendRefused"), LauncherPalette.building)- HStack(spacing: 12) {- Button(loc.t("shell.sendShowData")) { build.showGameDataInFinder() }.buttonStyle(LauncherSecondaryButtonStyle())+ note(.warning, loc.t("shell.sendRefused")) {Text(loc.t("shell.sendFinderSteps")).font(.manrope(12.5)).foregroundStyle(.secondary).fixedSize(horizontal: false, vertical: true)+ HStack(spacing: 16) {+ Button(loc.t("shell.sendShowData")) { build.showGameDataInFinder() }.buttonStyle(LauncherSecondaryButtonStyle())+ Button { withAnimation(.easeInOut(duration: 0.18)) { detailsOpen.toggle() } } label: {+ HStack(spacing: 6) {+ Text(loc.t("shell.sendDetails")).font(.manrope(12.5, .medium))+ Image(systemName: "chevron.right").font(.system(size: 9, weight: .bold)).rotationEffect(.degrees(detailsOpen ? 90 : 0))+ }+ .foregroundStyle(.secondary).contentShape(Rectangle())+ }+ .buttonStyle(.plain).accessibilityAddTraits(detailsOpen ? .isSelected : [])+ }+ if detailsOpen {+ Text(detail).font(.mono(11.5)).foregroundStyle(.secondary).textSelection(.enabled)+ .fixedSize(horizontal: false, vertical: true)+ .padding(.horizontal, 12).padding(.vertical, 9)+ .frame(maxWidth: .infinity, alignment: .leading)+ .background(ExportGrid.well, in: RoundedRectangle(cornerRadius: 9))+ }}- DisclosureGroup(loc.t("shell.sendDetails")) {- Text(detail).font(.mono(11.5)).foregroundStyle(.secondary).textSelection(.enabled)- .frame(maxWidth: .infinity, alignment: .leading)- }.font(.manrope(12.5))case .failed(let text):- note(text, LauncherPalette.building)+ note(.warning, text)case .idle, .copying, .copied:EmptyView()}@@ -124,21 +164,28 @@ package struct ExportSteps: View {// MARK: To a drive or folder- @ViewBuilder private var driveBody: some View {- HStack(spacing: 10) {- Text(devices.driveFolder.isEmpty ? loc.t("shell.driveNone") : build.shortPath(devices.driveFolder))- .font(devices.driveFolder.isEmpty ? .manrope(13) : .mono(12)).foregroundStyle(.secondary)- .lineLimit(1).truncationMode(.middle)- .padding(.horizontal, 12).padding(.vertical, 8)- .frame(maxWidth: 300, alignment: .leading)- .background(Color.white.opacity(0.05), in: RoundedRectangle(cornerRadius: 9))- Button(loc.t("shell.driveChoose")) { build.chooseDriveFolder() }.buttonStyle(LauncherSecondaryButtonStyle())- .frame(width: LauncherControl.width)- Spacer(minLength: 8)- Button(loc.t("shell.driveCopy")) { build.copyToDrive() }- .buttonStyle(LauncherSecondaryButtonStyle()).disabled(!build.canCopyToDrive).frame(width: LauncherControl.width)+ private var driveRow: some View {+ HStack(spacing: ExportGrid.gap) {+ HStack(spacing: ExportGrid.tight) {+ // The folder, drawn as a field: the same height and text inset as the device's dropdown in the other mode.+ let none = devices.driveFolder.isEmpty+ Text(none ? loc.t("shell.driveNone") : build.shortPath(devices.driveFolder))+ .font(none ? .manrope(13) : .mono(12)).foregroundStyle(none ? .tertiary : .primary)+ .lineLimit(1).truncationMode(.middle)+ .padding(.horizontal, 15)+ .frame(maxWidth: .infinity, minHeight: LauncherControl.height, maxHeight: LauncherControl.height, alignment: .leading)+ .background(ExportGrid.well, in: RoundedRectangle(cornerRadius: 9))+ .overlay(RoundedRectangle(cornerRadius: 9).strokeBorder(Color.white.opacity(0.08)))+ .opacity(inert ? ExportGrid.quiet : 1)+ .help(devices.driveFolder)+ Button(loc.t("shell.driveChoose")) { build.chooseDriveFolder() }.buttonStyle(LauncherSecondaryButtonStyle()).fixedSize()+ }+ if copying {+ action(loc.t("btn.stop"), accent: LauncherPalette.building) { build.stopDriveCopy() }+ } else {+ action(loc.t("shell.driveCopy"), enabled: build.canCopyToDrive) { build.copyToDrive() }+ }}- driveStatus}private var gameDataRow: String { L10n.string("ios.ui.gameData", loc.lang) }@@ -146,37 +193,108 @@ package struct ExportSteps: View {@ViewBuilder private var driveStatus: some View {if case .copying(let done, let total) = build.send {progress(String(format: loc.t("shell.driveProgress"), gameName, ShellInstall.sizeText(done), ShellInstall.sizeText(total)), done: done, total: total)- Button(loc.t("btn.stop")) { build.stopDriveCopy() }.buttonStyle(LauncherSecondaryButtonStyle())} else if case .copied(let folder) = build.send {- note(String(format: loc.t("shell.driveDone"), build.shortPath((folder as NSString).deletingLastPathComponent), gameDataRow), LauncherPalette.ready)+ note(.done, String(format: loc.t("shell.driveDone"), build.shortPath((folder as NSString).deletingLastPathComponent), gameDataRow))} else if case .failed(let text) = build.send {- note(text, LauncherPalette.building)+ note(.warning, text)} else if let state = build.drive {switch state.problem {- case .fat32: note(loc.t("shell.driveFat32"), .red)- case .readOnly: note(loc.t("shell.driveReadOnly"), .red)+ case .fat32: note(.blocked, loc.t("shell.driveFat32"))+ case .readOnly: note(.blocked, loc.t("shell.driveReadOnly"))case .noSpace(let needed, let free):- note(String(format: loc.t("shell.driveNoSpace"), ShellInstall.sizeText(needed), ShellInstall.sizeText(free)), .red)+ note(.blocked, String(format: loc.t("shell.driveNoSpace"), ShellInstall.sizeText(needed), ShellInstall.sizeText(free)))case nil:if let volume = state.volume {- Text(String(format: loc.t("shell.driveNote"), ShellInstall.sizeText(state.needed), ShellInstall.sizeText(volume.freeBytes),- DriveCopy.fileSystemName(volume.fileSystem), gameDataRow))- .font(.manrope(12.5)).foregroundStyle(.secondary).fixedSize(horizontal: false, vertical: true)+ note(.info, String(format: loc.t("shell.driveNote"), ShellInstall.sizeText(state.needed), ShellInstall.sizeText(volume.freeBytes),+ DriveCopy.fileSystemName(volume.fileSystem), gameDataRow))}}}}- // MARK: Pieces+ // MARK: Notes and progress++ /// What changes the shape of the status area, without the numbers of a running copy (they animate in the bar itself).+ private var statusKind: String {+ let send: String+ switch build.send {+ case .idle: send = "idle"+ case .sending: send = "sending"+ case .sent: send = "sent"+ case .appNotFound: send = "noApp"+ case .chooseApp: send = "choose"+ case .refused: send = "refused"+ case .failed: send = "failed"+ case .copying: send = "copying"+ case .copied: send = "copied"+ }+ return devices.sendWhere + send + (build.drive.map { "\($0.problem == nil)" } ?? "") + "\(detailsOpen)"+ }++ private enum NoteKind { case done, info, warning, blocked }- private func note(_ text: String, _ color: Color) -> some View {- Text(text).font(.manrope(12.5)).foregroundStyle(color).fixedSize(horizontal: false, vertical: true)+ /// The launcher's note under a row (as the key check's line): a small symbol, then the text. A good or neutral note is in the+ /// secondary colour, a warning in amber, a problem that stops the copy in red. More lines of the same note go under its text.+ private func note<More: View>(_ kind: NoteKind, _ text: String, @ViewBuilder more: () -> More = { EmptyView() }) -> some View {+ let (symbol, color): (String, Color) = {+ switch kind {+ case .done: return ("checkmark.circle.fill", LauncherPalette.ready)+ case .info: return ("info.circle", .secondary)+ case .warning: return ("exclamationmark.triangle.fill", LauncherPalette.building)+ case .blocked: return ("exclamationmark.triangle.fill", .red)+ }+ }()+ return HStack(alignment: .firstTextBaseline, spacing: 7) {+ Image(systemName: symbol).font(.system(size: 11, weight: .semibold)).foregroundStyle(color).frame(width: 13)+ VStack(alignment: .leading, spacing: 8) {+ Text(text).font(.manrope(12.5)).foregroundStyle(kind == .done || kind == .info ? Color.secondary : color)+ .fixedSize(horizontal: false, vertical: true)+ more()+ }+ Spacer(minLength: 0)+ }}private func progress(_ text: String, done: Int64, total: Int64) -> some View {- VStack(alignment: .leading, spacing: 6) {- ProgressView(value: total > 0 ? Double(done) / Double(total) : 0).progressViewStyle(.linear).tint(LauncherPalette.cream)- Text(text).font(.manrope(12.5)).foregroundStyle(.secondary).fixedSize(horizontal: false, vertical: true)+ VStack(alignment: .leading, spacing: 8) {+ LauncherProgressBar(value: total > 0 ? Double(done) / Double(total) : 0, height: 6)+ .frame(height: 6).accessibilityLabel(text)+ Text(text).font(.manrope(12.5)).monospacedDigit().foregroundStyle(.secondary).fixedSize(horizontal: false, vertical: true)+ }+ .padding(.top, 4)+ }+}++/// Looks for devices again: an icon button beside the device's dropdown, named for VoiceOver and in its tooltip. While the list is+/// read it turns into a small spinner. Never as wide as a row's buttons, so it stays a small companion of the dropdown.+struct RefreshDevicesButton: View {+ @ObservedObject var devices: DeviceStore+ @EnvironmentObject var loc: Localizer++ var body: some View {+ Button { _ = devices.refresh() } label: {+ ZStack {+ if devices.checked { Image(systemName: "arrow.clockwise").font(.system(size: 12, weight: .semibold)) }+ else { ProgressView().controlSize(.small).scaleEffect(0.8) }+ }+ .frame(width: 14, height: 18)}+ .buttonStyle(LauncherSecondaryButtonStyle())+ .environment(\.launcherControlWidth, nil)+ .help(loc.t("dev.refresh")).accessibilityLabel(loc.t("dev.refresh"))}}++/// The measures of the export's steps. The edges and the row height are CardRow's, so the steps sit in the card like its other rows.+enum ExportGrid {+ static let inset: CGFloat = 18 // the card's edge to the number, and to the right column+ static let badge: CGFloat = 25 // the step's number+ static let gutter: CGFloat = 12 // the number to the step's text+ static let axis: CGFloat = inset + badge + gutter // 55: where a step's title, text, controls, progress and notes start+ static let gap: CGFloat = 12 // a control group to the action+ static let tight: CGFloat = 8 // a control to its own small button+ static let noteGap: CGFloat = 12 // the controls to the notes under them+ static let switchWidth: CGFloat = 330 // the two switches of the card are equally wide and end on one edge+ static let quiet: Double = 0.45 // step 3 before there is an IPA, as a switched-off launcher switch+ static let well = Color.black.opacity(0.22) // a field's inside: the folder, devicectl's own text+}diff --git a/frontend/Sources/NXLauncher/InstallCard.swift b/frontend/Sources/NXLauncher/InstallCard.swiftindex 23714577..41086043 100644--- a/frontend/Sources/NXLauncher/InstallCard.swift+++ b/frontend/Sources/NXLauncher/InstallCard.swift@@ -37,15 +37,14 @@ package struct InstallCard: View {CardRow(loc.t("shell.modeTitle")) {LauncherSegmented(options: [("install", loc.t("shell.modeInstall")), ("export", loc.t("shell.modeExport"))],selection: devices.exportIPA ? "export" : "install") { devices.exportIPA = $0 == "export" }- .frame(width: 330)+ .frame(width: ExportGrid.switchWidth)}CardDivider()if devices.exportIPA {ExportSteps(build: build, devices: devices)} else {CardRow(loc.t("dev.target"), detail: devices.checked && devices.devices.isEmpty ? loc.t("dev.noDevices") : "") {- if !devices.checked { ProgressView().controlSize(.small) }- Button(loc.t("dev.refresh")) { _ = devices.refresh() }.buttonStyle(.plain).font(.manrope(13)).foregroundStyle(.secondary)+ RefreshDevicesButton(devices: devices)LauncherDropdown(options: options, selection: devices.installDevice, label: loc.t("dev.target")) { devices.installDevice = $0 }}if !devices.installDevice.isEmpty {diff --git a/frontend/Sources/NXLauncher/LauncherDropdown.swift b/frontend/Sources/NXLauncher/LauncherDropdown.swiftindex 2af7befa..0216c7d2 100644--- a/frontend/Sources/NXLauncher/LauncherDropdown.swift+++ b/frontend/Sources/NXLauncher/LauncherDropdown.swift@@ -226,14 +226,17 @@ package struct LauncherDropdownList: View {/// `label` names the setting for VoiceOver, which then reads the choice as the value.package struct LauncherDropdown: View {package init(options: [(value: String, label: String)], selection: String, label: String = "", style: LauncherDropdownStyle = .pill,- fill: Bool = false, choose: @escaping (String) -> Void) {- self.options = options; self.selection = selection; self.label = label; self.style = style; self.fill = fill; self.choose = choose+ fill: Bool = false, leading: Bool = false, choose: @escaping (String) -> Void) {+ self.options = options; self.selection = selection; self.label = label; self.style = style; self.fill = fill; self.leading = leading+ self.choose = choose}package let options: [(value: String, label: String)]package let selection: Stringpackage var label = ""package var style: LauncherDropdownStyle = .pillpackage var fill = false+ /// With `fill`: the choice starts at the left, like the text of a field (the export's device, LNPANDY/NX2Apple#416).+ package var leading = falsepackage let choose: (String) -> Void@Environment(\.launcherDropdownHost) private var host@State private var id = UUID()@@ -256,8 +259,8 @@ package struct LauncherDropdown: View {Text(current).font(.manrope(rounded ? 13 : 12.5, .semibold)).lineLimit(1).minimumScaleFactor(width == nil ? 1 : 0.85).fixedSize(horizontal: !fill && width == nil, vertical: false)- .frame(maxWidth: fill || width != nil ? .infinity : nil, alignment: .center) // the words centre across the whole button- .padding(.leading, fill || width != nil ? 14 : 0) // room so the chevron never crowds them+ .frame(maxWidth: fill || width != nil ? .infinity : nil, alignment: fill && leading ? .leading : .center) // the words centre across the whole button+ .padding(.leading, (fill && !leading) || width != nil ? 14 : 0) // room so the chevron never crowds themif fill || width != nil {Image(systemName: "chevron.down").font(.system(size: 9, weight: .bold)).foregroundStyle(.secondary).rotationEffect(.degrees(open ? 180 : 0)).padding(.trailing, 14)@@ -267,7 +270,7 @@ package struct LauncherDropdown: View {}}.padding(.horizontal, rounded ? 15 : 14).padding(.vertical, rounded ? 9 : 7)- .frame(width: width, height: width == nil ? nil : LauncherControl.height)+ .frame(width: width, height: width != nil || (fill && rounded) ? LauncherControl.height : nil) // a filling button as high as a row's buttons.frame(maxWidth: fill ? .infinity : nil).background(Color.white.opacity(open ? 0.13 : (rounded ? 0.055 : 0.06)), in: shape).overlay(shape.strokeBorder(Color.white.opacity(open ? 0.18 : 0.10)))diff --git a/frontend/Tests/NX2AppleTests/LauncherControlWidthTests.swift b/frontend/Tests/NX2AppleTests/LauncherControlWidthTests.swiftindex 3f836b89..62ebeb3f 100644--- a/frontend/Tests/NX2AppleTests/LauncherControlWidthTests.swift+++ b/frontend/Tests/NX2AppleTests/LauncherControlWidthTests.swift@@ -128,6 +128,25 @@ import NXModels.deviceStore.installDevice = device.ids.deviceStore.signingTeam = team.id},+ Scenario(name: "builds exporting an IPA, sent to a device", page: .builds, atLeast: 6) { s, _, directory in+ s.repo.path = try self.makeRepo(directory, git: true)+ s.build.target = "ios"+ MainActor.assumeIsolated { s.deviceStore.checked = true }+ MainActor.assumeIsolated { s.deviceStore.devices = [device] }+ s.deviceStore.installDevice = device.id+ s.deviceStore.exportIPA = true+ s.deviceStore.sendWhere = SendWhere.device+ s.build.exportedIPAPath = directory.appendingPathComponent("NX2Apple.ipa").path+ },+ Scenario(name: "builds exporting an IPA, copied to a drive", page: .builds, atLeast: 6) { s, _, directory in+ s.repo.path = try self.makeRepo(directory, git: true)+ s.build.target = "ios"+ MainActor.assumeIsolated { s.deviceStore.checked = true }+ s.deviceStore.exportIPA = true+ s.deviceStore.sendWhere = SendWhere.drive+ s.build.exportedIPAPath = directory.appendingPathComponent("NX2Apple.ipa").path+ s.build.send = .copying(done: 1, total: 2)+ },Scenario(name: "a finished Mac app build", page: .builds, atLeast: 6) { s, _, directory ins.repo.path = try self.makeRepo(directory, git: true)s.build.target = "mac-app"@@ -180,7 +199,7 @@ import NXModel/// Settings and Builds, in every language: each button and dropdown of a row is LauncherControl.width wide and/// LauncherControl.height high, and its label fits on one line.@MainActor func testEveryRowControlOnTheRealPagesFitsInEveryLanguage() throws {- let keys = ["repoPath", "depsExpanded", "buildTarget", "installDevice", "signingTeam", "buildOutputDirectory", "autoUpdateRepo"]+ let keys = ["repoPath", "depsExpanded", "buildTarget", "installDevice", "signingTeam", "buildOutputDirectory", "autoUpdateRepo", "exportIPA", "sendWhere"]let saved = keys.map { ($0, UserDefaults.standard.object(forKey: $0)) }defer { for (key, value) in saved { UserDefaults.standard.set(value, forKey: key) } }for scenario in scenarios {diff --git a/frontend/Tests/NX2AppleTests/ShellExportCaptureTests.swift b/frontend/Tests/NX2AppleTests/ShellExportCaptureTests.swiftindex ede4b2be..9015395d 100644--- a/frontend/Tests/NX2AppleTests/ShellExportCaptureTests.swift+++ b/frontend/Tests/NX2AppleTests/ShellExportCaptureTests.swift@@ -9,7 +9,7 @@ import NXModel/// Visual QA of LNPANDY/NX2Apple#416 (matched by --filter testRenderExportStatesForVisualQA).final class ShellExportCaptureTests: XCTestCase {/// The Install card in every state of the export, for the pull request's screenshots: ready, exported, sending, done, app not found,- /// refused, drive and FAT32. Also the card with the install flow, which the segmented switch changed.+ /// refused, several apps, drive, copying, copied, FAT32 and the drive before an export. Also the card with the install flow, which the segmented switch changed.@MainActor func testRenderExportStatesForVisualQA() throws {guard let directory = ProcessInfo.processInfo.environment["NX_LAUNCHER_CAPTURE_DIR"] else { throw XCTSkip("Set NX_LAUNCHER_CAPTURE_DIR to capture native views") }let output = URL(fileURLWithPath: directory)@@ -18,12 +18,14 @@ final class ShellExportCaptureTests: XCTestCase {let lang = ProcessInfo.processInfo.environment["NX_CAPTURE_LANG"].flatMap { Lang.find($0) } ?? .enlet saved = ["buildTarget", "installDevice", "exportIPA", "sendWhere", "driveFolder", "shellRoot"].map { ($0, UserDefaults.standard.object(forKey: $0)) }defer { for (key, value) in saved { UserDefaults.standard.set(value, forKey: key) } }- let ipa = fm.temporaryDirectory.appendingPathComponent("NX2Apple-capture-\(UUID().uuidString).ipa")+ let shellFolder = fm.temporaryDirectory.appendingPathComponent("NX2Apple-capture-\(UUID().uuidString)")+ try fm.createDirectory(at: shellFolder, withIntermediateDirectories: true)+ let ipa = shellFolder.appendingPathComponent("NX2Apple.ipa") // the name an export writesfm.createFile(atPath: ipa.path, contents: nil)let handle = try FileHandle(forWritingTo: ipa)- try handle.truncate(atOffset: 1_200_000_000) // a sparse file of the size the card shows+ try handle.truncate(atOffset: 184_000_000) // a sparse file of the size the card showstry handle.close()- defer { try? fm.removeItem(at: ipa) }+ defer { try? fm.removeItem(at: shellFolder) }let stores = LauncherStores(); let model = stores.buildstores.localizer.lang = lang@@ -66,13 +68,25 @@ final class ShellExportCaptureTests: XCTestCase {try shot("5-app-not-found", card())model.send = .refused(detail: "ERROR: Failed to copy: the app does not allow access to its data container (get-task-allow). (com.apple.dt.CoreDeviceError error 7)")try shot("6-refused", card())+ model.send = .chooseApp([InstalledApp(bundle: "org.nxnative.shell.ABCDE12345", name: "NX2Apple"),+ InstalledApp(bundle: "org.nxnative.shell", name: "NX2Apple")])+ try shot("6b-choose-app", card())model.send = .idlestores.deviceStore.sendWhere = SendWhere.drivestores.deviceStore.driveFolder = "/Volumes/GameDrive/Switch"model.drive = DriveState(volume: DriveCopy.Volume(freeBytes: 412_000_000_000, fileSystem: "exfat", readOnly: false), needed: 12_400_000_000, problem: nil)try shot("7-drive", card())+ model.send = .copying(done: 5_300_000_000, total: 12_400_000_000)+ try shot("8-drive-copying", card())+ model.send = .copied(folder: "/Volumes/GameDrive/Switch/0100000000010000")+ try shot("9-drive-done", card())+ model.send = .idlemodel.drive = DriveState(volume: DriveCopy.Volume(freeBytes: 412_000_000_000, fileSystem: "msdos", readOnly: false), needed: 12_400_000_000,problem: .fat32(largest: 12_000_000_000))- try shot("8-fat32", card())+ try shot("10-fat32", card())+ model.exportedIPAPath = ""+ stores.deviceStore.driveFolder = ""+ model.drive = nil+ try shot("11-drive-before-export", card())}}