feat: update for macos

This commit is contained in:
dscyrescotti
2024-07-18 00:34:31 +07:00
parent 47347099e9
commit c9381bfad3
3 changed files with 37 additions and 2 deletions

View File

@@ -58,6 +58,7 @@ struct Sidebar: View {
.navigationSplitViewColumnWidth(min: 250, ideal: 250, max: 250)
}
#if os(iOS)
private var compactList: some View {
list
.toolbar {
@@ -66,6 +67,7 @@ struct Sidebar: View {
}
}
}
#endif
private var list: some View {
List(selection: $sidebarItem) {

View File

@@ -16,14 +16,22 @@ struct AboutView: View {
Spacer()
Text("v\(Bundle.main.appVersion) (\(Bundle.main.appBuild))")
}
#if os(macOS)
.listRowSeparator(.hidden)
#endif
}
Section("Copyright") {
Section("COPYRIGHT") {
Text(Bundle.main.copyright)
.font(.callout)
#if os(macOS)
.listRowSeparator(.hidden)
#endif
}
}
.listStyle(.insetGrouped)
.navigationTitle("About")
#if os(iOS)
.listStyle(.insetGrouped)
.navigationBarTitleDisplayMode(.inline)
#endif
}
}

View File

@@ -8,6 +8,8 @@
import SwiftUI
struct SettingsView: View {
@Environment(\.dismiss) private var dismiss
var body: some View {
NavigationStack {
List {
@@ -19,10 +21,33 @@ struct SettingsView: View {
}
}
.navigationTitle("Settings")
#if os(iOS)
.navigationBarTitleDisplayMode(.large)
#endif
.toolbar {
#if os(iOS)
ToolbarItem(placement: .topBarTrailing) {
Button {
dismiss()
} label: {
Text("Close")
}
}
#endif
}
}
.focusedSceneValue(\.activeSceneKey, .settings)
.interactiveDismissDisabled()
#if os(macOS)
.onAppear {
DispatchQueue.main.async {
NSApplication.shared.windows.forEach { window in
guard window.identifier?.rawValue.contains(AppWindow.settings.id) == true else { return }
window.standardWindowButton(.zoomButton)?.isEnabled = false
}
}
}
#endif
}
}