From 38f64ea2838991c16eee85f54e0e40f39969b78e Mon Sep 17 00:00:00 2001 From: osy Date: Thu, 28 Mar 2024 15:36:31 -0700 Subject: [PATCH] main: hide UUP-Dump under advanced options --- Source/Main.swift | 6 +++++- Source/SimpleContentView.swift | 11 +++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Source/Main.swift b/Source/Main.swift index 0fdb9a7..3249e81 100644 --- a/Source/Main.swift +++ b/Source/Main.swift @@ -19,7 +19,8 @@ import SwiftUI @main struct Main: App { @StateObject private var worker = Worker() - + @AppStorage("ShowAdvancedOptions") private var showAdvancedOptions: Bool = false + var body: some Scene { WindowGroup(id: "ESDConvert") { SimpleContentView().environmentObject(worker) @@ -31,6 +32,9 @@ struct Main: App { .frame(minWidth: 800, minHeight: 400) }.commands { SidebarCommands() + CommandGroup(after: .sidebar) { + Toggle("Show Advanced Options", isOn: $showAdvancedOptions) + } }.handlesExternalEvents(matching: Set(["UUPDump"])) } } diff --git a/Source/SimpleContentView.swift b/Source/SimpleContentView.swift index dcf5b4e..3089ba2 100644 --- a/Source/SimpleContentView.swift +++ b/Source/SimpleContentView.swift @@ -18,6 +18,7 @@ import SwiftUI struct SimpleContentView: View { @EnvironmentObject private var worker: Worker + @AppStorage("ShowAdvancedOptions") private var showAdvancedOptions: Bool = false @State private var isConfirmCancelShown: Bool = false @State private var isDownloadCompleted: Bool = false @@ -88,10 +89,12 @@ struct SimpleContentView: View { } } HStack { - ShowWindowButtonView(id: "UUPDump") { - Text("All builds…") - }.disabled(worker.isBusy) - .help("Build custom installation for any build through UUP Dump.") + if showAdvancedOptions { + ShowWindowButtonView(id: "UUPDump") { + Text("All builds…") + }.disabled(worker.isBusy) + .help("Build custom installation for any build through UUP Dump.") + } Spacer() if worker.isBusy { Button(role: .cancel) {