diff --git a/Paicord/Baseplates/LargeBaseplate.swift b/Paicord/Baseplates/LargeBaseplate.swift index 52c8f3f..ee8c2a0 100644 --- a/Paicord/Baseplates/LargeBaseplate.swift +++ b/Paicord/Baseplates/LargeBaseplate.swift @@ -9,6 +9,13 @@ import DiscordModels @_spi(Advanced) import SwiftUIIntrospect import SwiftUIX + +// makes a fallback to .automatic on iOS because topBarLeading is not available on macOS +@available(iOS, unavailable) +extension ToolbarItemPlacement { + @_disfavoredOverload + static var topBarLeading: Self { .automatic } +} // if on macos or ipad struct LargeBaseplate: View { @@ -33,20 +40,22 @@ struct LargeBaseplate: View { } .toolbar(removing: .sidebarToggle) .toolbar { - Group { - if columnVisibility != .detailOnly { - if let currentGuildStore { - Text(currentGuildStore.guild?.name ?? "Direct Messages") - .font(.title2) - .bold() - } else { - Text("Direct Messages") - .font(.title2) - .bold() + ToolbarItem(placement: .topBarLeading) { + Group { + if columnVisibility != .detailOnly { + if let currentGuildStore { + Text(currentGuildStore.guild?.name ?? "Direct Messages") + .font(.title2) + .bold() + } else { + Text("Direct Messages") + .font(.title2) + .bold() + } } } + .minimumScaleFactor(0.5) } - .minimumScaleFactor(0.5) } .navigationSplitViewColumnWidth(min: 280, ideal: 310, max: 360) diff --git a/Paicord/macOS/Sidebar/ProfileBar.swift b/Paicord/macOS/Sidebar/ProfileBar.swift index c489d11..2f3b539 100644 --- a/Paicord/macOS/Sidebar/ProfileBar.swift +++ b/Paicord/macOS/Sidebar/ProfileBar.swift @@ -20,6 +20,9 @@ struct ProfileBar: View { @State var showingUsername = false @State var showingPopover = false @State var barHovered = false +#if os(iOS) + @State var settingsSheetPresented = false +#endif var body: some View { HStack { @@ -80,22 +83,26 @@ struct ProfileBar: View { } Spacer() - - #if os(macOS) - Button { - openWindow(id: "settings") - } label: { - Image(systemName: "gearshape.fill") - .font(.title2) - .padding(5) - .background(.ultraThinMaterial) - .clipShape(.circle) - } - .buttonStyle(.borderless) - #elseif os(iOS) - /// targetting ipad here, ios wouldnt have this at all - // do something - #endif + + Button { +#if os(macOS) + openWindow(id: "settings") +#elseif os(iOS) + settingsSheetPresented = true +#endif + } label: { + Image(systemName: "gearshape.fill") + .font(.title2) + .padding(5) + .background(.ultraThinMaterial) + .clipShape(.circle) + } + .buttonStyle(.borderless) +#if os(iOS) + .sheet(isPresented: $settingsSheetPresented) { + SettingsView() + } +#endif } .padding(8) .background {