Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions VirtualUI/Source/Installer/Steps/InstallProgressDoneView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
//
// InstallProgressDoneView.swift
// VirtualBuddy
//
// Created by Michael Fey on 3/10/26.
//


import SwiftUI
import VirtualCore
import BuddyKit

struct InstallProgressDoneView: View {
@EnvironmentObject private var viewModel: VMInstallationViewModel
@EnvironmentObject private var library: VMLibraryController
@EnvironmentObject private var sessionManager: VirtualMachineSessionUIManager
@Environment(\.dismiss) private var dismiss

var body: some View {
VStack(spacing: 0) {
Spacer(minLength: 0)

VStack(spacing: 18) {
VirtualBuddyMonoIcon(style: .success)

Text(viewModel.data.systemType.installFinishedMessage)
.font(.subheadline)

if let machine = viewModel.machine {
launchButton(for: machine)
.padding(.top, 10)
.padding(.bottom, 6)
}
}
.monospacedDigit()
.multilineTextAlignment(.center)
.foregroundStyle(.green)
.tint(.green)

Spacer(minLength: 56)
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
}

private func launchButton(for machine: VBVirtualMachine) -> some View {
ZStack {
Button("Let\u{2019}s Go!") {
launch(machine)
}
.foregroundStyle(Color(white: 0.03))
.controlSize(.large)
.accessibilityHint("Launches the new virtual machine")

// This is a hidden button that exists purely to accept the keyboardShortcut(.defaultAction) for this window. Setting a default action for a button overrides the foreground styling on the button leaving white text on a lighter green background, which is difficult to read.
Button("") {
launch(machine)
}
.keyboardShortcut(.defaultAction)
.labelsHidden()
.frame(width: 0, height: 0)
.opacity(0)
.accessibilityHidden(true)
}
}

private func launch(_ machine: VBVirtualMachine) {
sessionManager.launch(machine, library: library, options: nil)
dismiss()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import BuddyKit

struct InstallProgressDisplayView: View {
@EnvironmentObject private var viewModel: VMInstallationViewModel
@EnvironmentObject private var library: VMLibraryController
@EnvironmentObject private var sessionManager: VirtualMachineSessionUIManager
@Environment(\.dismiss) private var dismiss

var body: some View {
VirtualDisplayView {
Expand All @@ -14,10 +17,7 @@ struct InstallProgressDisplayView: View {
case .install:
InstallProgressStepView()
case .done:
VirtualBuddyMonoProgressView(
status: Text(viewModel.data.systemType.installFinishedMessage),
style: .success
)
InstallProgressDoneView()
default:
EmptyView()
}
Expand Down
3 changes: 2 additions & 1 deletion VirtualUI/Source/Installer/VMInstallationWizard.swift
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ public struct VMInstallationWizard: View {
Button("Done") {
closeWindow()
}
.keyboardShortcut(.defaultAction)
}
}

Expand Down Expand Up @@ -299,6 +298,8 @@ extension VMInstallationWizard {
static func preview(step: VMInstallationStep) -> some View {
VMInstallationWizard(library: .preview, initialStep: step)
.frame(width: 900)
.environmentObject(VMLibraryController.preview)
.environmentObject(VirtualMachineSessionUIManager.shared)
}

@ViewBuilder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ public final class VirtualMachineSessionUIManager: ObservableObject {
openWindow(animationBehavior: .documentWindow) {
VMInstallationWizard(library: library, restoringAt: restoreURL)
.environmentObject(library)
.environmentObject(self)
}
}

Expand Down