Skip to content

Run Windows games on Apple Silicon — free, open source, with an open compatibility database that tells you what actually works.

fix: make settings page back navigation work

Matias G.d65d49afac2c
diff --git a/Sources/HighballApp/BottleView.swift b/Sources/HighballApp/BottleView.swift
index 03666d1..5db9a06 100644
--- a/Sources/HighballApp/BottleView.swift
+++ b/Sources/HighballApp/BottleView.swift
@@ -54,6 +54,9 @@ struct BottleView: View {
ScrollView {
VStack(alignment: .leading, spacing: 34) {
HStack(spacing: 12) {
+ Button { dismiss() } label: {
+ Label(L("Back"), systemImage: "chevron.left")
+ }
Button {
navigationPath.append(EnvironmentSettingsDestination(name: bottle.name))
} label: { Label(L("Environment settings"), systemImage: "slider.horizontal.3") }
@@ -84,6 +87,7 @@ struct BottleView: View {
.background(BottleBackdrop())
.navigationTitle(bottle.name)
.navigationSubtitle(engine?.displayName ?? "")
+ .navigationBarBackButtonHidden()
.toolbar {
ToolbarItem(placement: .confirmationAction) {
if navigationPath.count == 1 {
@@ -289,6 +293,8 @@ struct EnvironmentSettingsPage: View {
@Environment(AppState.self) private var state
@Environment(\.dismiss) private var dismiss
let bottle: Bottle
+ // Settings' TabView owns the window toolbar; its generated navigation arrow does not pop.
+ var showsInlineBack = false
@State private var selectedSection: EnvironmentSettingsSection = .graphics
@State private var confirmDelete = false
@State private var showFrameGenInfo = false
@@ -317,6 +323,11 @@ struct EnvironmentSettingsPage: View {
var body: some View {
VStack(spacing: 0) {
HStack(spacing: 10) {
+ if showsInlineBack {
+ Button { dismiss() } label: {
+ Label(L("Back"), systemImage: "chevron.left")
+ }
+ }
VStack(alignment: .leading, spacing: 4) {
Text(bottle.name).font(.title2.bold())
Text(engine?.displayName ?? "").font(.caption).foregroundStyle(.secondary)
@@ -590,6 +601,7 @@ struct EnvironmentSettingsPage: View {
.formStyle(.grouped)
}
.navigationTitle(L("Environment settings"))
+ .navigationBarBackButtonHidden(showsInlineBack)
.background { PageCancelShortcut { dismiss() } }
.confirmationDialog(UserFolders.hasFilesInside(driveC: bottle.driveC)
? L("Delete this environment? Its Windows drive and everything installed in it are removed, including the game saves kept in its Documents folder.")
diff --git a/Sources/HighballApp/L10n.swift b/Sources/HighballApp/L10n.swift
index ceec8fd..224f116 100644
--- a/Sources/HighballApp/L10n.swift
+++ b/Sources/HighballApp/L10n.swift
@@ -9,6 +9,7 @@ func L(_ en: String) -> String {
enum L10n {
static let fr: [String: String] = [
+ "Back": "Retour",
"Display": "Affichage",
"Changes save automatically": "Les modifications sont enregistrées automatiquement",
"Choose a store or a Windows program you already have.": "Choisissez une boutique ou un programme Windows que vous possédez déjà.",
diff --git a/Sources/HighballApp/SettingsView.swift b/Sources/HighballApp/SettingsView.swift
index dd884f3..93cb1b8 100644
--- a/Sources/HighballApp/SettingsView.swift
+++ b/Sources/HighballApp/SettingsView.swift
@@ -131,7 +131,7 @@ struct EnvironmentsPane: View {
}
.navigationDestination(for: EnvironmentSettingsDestination.self) { destination in
if let bottle = state.bottles.first(where: { $0.name == destination.name }) {
- EnvironmentSettingsPage(bottle: bottle)
+ EnvironmentSettingsPage(bottle: bottle, showsInlineBack: true)
}
}
.sheet(isPresented: $showCreate) { CreateBottleSheet() }