Improve UI
This commit is contained in:
@@ -12,7 +12,7 @@ open class ApplicationDelegate: NSObject, NSApplicationDelegate {
|
||||
let launchedAsLogInItem =
|
||||
event?.eventID == kAEOpenApplication &&
|
||||
event?.paramDescriptor(forKeyword: keyAEPropData)?.enumCodeValue == keyAELaunchedAsLogInItem
|
||||
if !launchedAsLogInItem || !SharedPreferences.showMenuBarExtra.getBlocking() || !SharedPreferences.menuBarExtraInBackground.getBlocking() {
|
||||
if SharedPreferences.inDebug || !launchedAsLogInItem || !SharedPreferences.showMenuBarExtra.getBlocking() || !SharedPreferences.menuBarExtraInBackground.getBlocking() {
|
||||
NSApp.setActivationPolicy(.regular)
|
||||
NSApp.activate(ignoringOtherApps: true)
|
||||
} else {
|
||||
@@ -35,7 +35,7 @@ open class ApplicationDelegate: NSObject, NSApplicationDelegate {
|
||||
}
|
||||
|
||||
public func applicationShouldTerminateAfterLastWindowClosed(_: NSApplication) -> Bool {
|
||||
!SharedPreferences.menuBarExtraInBackground.getBlocking()
|
||||
SharedPreferences.inDebug || !SharedPreferences.menuBarExtraInBackground.getBlocking()
|
||||
}
|
||||
|
||||
public func applicationShouldHandleReopen(_: NSApplication, hasVisibleWindows flag: Bool) -> Bool {
|
||||
|
||||
@@ -35,27 +35,14 @@ public struct MacApplication: Scene {
|
||||
}
|
||||
}
|
||||
SidebarCommands()
|
||||
CommandGroup(replacing: .appSettings) {
|
||||
Button("Settings") {
|
||||
environments.openSettings.send()
|
||||
}
|
||||
.keyboardShortcut(",", modifiers: [.command])
|
||||
}
|
||||
}
|
||||
|
||||
WindowGroup("New Profile", id: NewProfileView.windowID, for: NewProfileView.ImportRequest.self) { importRequest in
|
||||
NewProfileView(importRequest.wrappedValue)
|
||||
.environmentObject(environments)
|
||||
}.commandsRemoved()
|
||||
|
||||
WindowGroup("Edit Profile", id: EditProfileWindowView.windowID, for: Int64.self) { profileID in
|
||||
EditProfileWindowView(profileID.wrappedValue)
|
||||
.environmentObject(environments)
|
||||
}.commandsRemoved()
|
||||
|
||||
WindowGroup("Edit Content", id: EditProfileContentView.windowID, for: EditProfileContentView.Context.self) { context in
|
||||
EditProfileContentView(context.wrappedValue)
|
||||
.environmentObject(environments)
|
||||
}.commandsRemoved()
|
||||
|
||||
Window("Service Log", id: ServiceLogView.windowID) {
|
||||
ServiceLogView()
|
||||
.environmentObject(environments)
|
||||
}
|
||||
MenuBarExtra(isInserted: $showMenuBarExtra) {
|
||||
MenuView(isMenuPresented: $isMenuPresented)
|
||||
.environmentObject(environments)
|
||||
|
||||
@@ -26,8 +26,10 @@ public struct MainView: View {
|
||||
NavigationSplitView {
|
||||
SidebarView()
|
||||
} detail: {
|
||||
selection.contentView
|
||||
.navigationTitle(selection.title)
|
||||
NavigationStack {
|
||||
selection.contentView
|
||||
.navigationTitle(selection.title)
|
||||
}
|
||||
}
|
||||
.onAppear {
|
||||
environments.postReload()
|
||||
@@ -55,6 +57,9 @@ public struct MainView: View {
|
||||
environments.connectLog()
|
||||
}
|
||||
}
|
||||
.onReceive(environments.openSettings) {
|
||||
selection = .settings
|
||||
}
|
||||
.formStyle(.grouped)
|
||||
.environment(\.selection, $selection)
|
||||
.environment(\.importProfile, $importProfile)
|
||||
|
||||
@@ -25,24 +25,30 @@ public struct SidebarView: View {
|
||||
|
||||
var body: some View {
|
||||
VStack {
|
||||
if extensionProfile.status.isConnectedStrict {
|
||||
List(selection: selection) {
|
||||
Section(NavigationPage.dashboard.title) {
|
||||
Label("Overview", systemImage: "text.and.command.macwindow").tag(NavigationPage.dashboard)
|
||||
NavigationPage.groups.label.tag(NavigationPage.groups)
|
||||
viewBuilder {
|
||||
if extensionProfile.status.isConnectedStrict {
|
||||
List(selection: selection) {
|
||||
Section(NavigationPage.dashboard.title) {
|
||||
Label("Overview", systemImage: "text.and.command.macwindow")
|
||||
.tint(.textColor)
|
||||
.tag(NavigationPage.dashboard)
|
||||
NavigationPage.groups.label.tag(NavigationPage.groups)
|
||||
}
|
||||
Divider()
|
||||
ForEach(NavigationPage.macosDefaultPages, id: \.self) { it in
|
||||
it.label
|
||||
}
|
||||
}
|
||||
Divider()
|
||||
ForEach(NavigationPage.macosDefaultPages, id: \.self) { it in
|
||||
} else {
|
||||
List(NavigationPage.allCases.filter { it in
|
||||
it.visible(extensionProfile)
|
||||
}, selection: selection) { it in
|
||||
it.label
|
||||
}
|
||||
}
|
||||
} else {
|
||||
List(NavigationPage.allCases.filter { it in
|
||||
it.visible(extensionProfile)
|
||||
}, selection: selection) { it in
|
||||
it.label
|
||||
}
|
||||
}
|
||||
.listStyle(.sidebar)
|
||||
.scrollDisabled(true)
|
||||
}
|
||||
.onChangeCompat(of: extensionProfile.status) {
|
||||
if !selection.wrappedValue.visible(extensionProfile) {
|
||||
|
||||
Reference in New Issue
Block a user