From b1166ef5ba7c46d2e84d1d860ae3d797bba4cd09 Mon Sep 17 00:00:00 2001 From: Garth Vander Houwen Date: Fri, 9 Dec 2022 19:15:15 -0800 Subject: [PATCH] Add dismiss button to help sheet on share channels --- Meshtastic/Views/Settings/ShareChannels.swift | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/Meshtastic/Views/Settings/ShareChannels.swift b/Meshtastic/Views/Settings/ShareChannels.swift index 4862835c..d2f1328c 100644 --- a/Meshtastic/Views/Settings/ShareChannels.swift +++ b/Meshtastic/Views/Settings/ShareChannels.swift @@ -33,6 +33,7 @@ struct ShareChannels: View { @Environment(\.managedObjectContext) var context @EnvironmentObject var bleManager: BLEManager + @Environment(\.dismiss) private var dismiss @State var channelSet: ChannelSet = ChannelSet() @State var includeChannel0 = true @State var includeChannel1 = true @@ -48,8 +49,6 @@ struct ShareChannels: View { var qrCodeImage = QrCodeImage() var body: some View { - - // VStack { GeometryReader { bounds in let smallest = min(bounds.size.width, bounds.size.height) ScrollView { @@ -218,8 +217,6 @@ struct ShareChannels: View { } } } - - //} } .sheet(isPresented: $isPresentingHelp) { VStack { @@ -244,6 +241,18 @@ struct ShareChannels: View { .padding() .presentationDetents([.large]) .presentationDragIndicator(.automatic) + + #if targetEnvironment(macCatalyst) + Button { + dismiss() + } label: { + Label("Close", systemImage: "xmark") + } + .buttonStyle(.bordered) + .buttonBorderShape(.capsule) + .controlSize(.large) + .padding() + #endif } .navigationTitle("Generate QR Code") .navigationBarTitleDisplayMode(.inline) @@ -263,7 +272,6 @@ struct ShareChannels: View { .onChange(of: includeChannel6) { includeCh6 in GenerateChannelSet() } .onChange(of: includeChannel7) { includeCh7 in GenerateChannelSet() } } - // } } func GenerateChannelSet() { channelSet = ChannelSet()