"About Outpost" in the app menu used to open a separate standalone window (Window(id: "about") wrapping AboutView). Now just opens Settings and jumps straight to the About section instead — same content (AboutInfoView, unchanged), one less window/code path to maintain. Also removed the "Check for Updates…" button — deferred per explicit instruction, not deleted for a real reason beyond "not now." A simple button can come back later; no update-checking logic was ever built; , nothing else to clean up alongside it.
92 lines
2.8 KiB
Swift
92 lines
2.8 KiB
Swift
//
|
|
// OutpostApp.swift
|
|
// Outpost
|
|
//
|
|
// Created by Puranjay Savar Mattas on 12/08/26.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
#if os(macOS)
|
|
import AppKit
|
|
#endif
|
|
|
|
@main
|
|
struct OutpostApp: App {
|
|
@State private var session = SessionStore()
|
|
@State private var navigation = AppNavigation()
|
|
@AppStorage("outpost.appearance") private var appearance: AppAppearance = .system
|
|
|
|
#if os(macOS)
|
|
@State private var isShowingLogoutConfirmation = false
|
|
#endif
|
|
|
|
var body: some Scene {
|
|
WindowGroup {
|
|
RootView()
|
|
.environment(session)
|
|
.environment(navigation)
|
|
#if os(iOS)
|
|
.preferredColorScheme(appearance.colorScheme)
|
|
#endif
|
|
#if os(macOS)
|
|
.onAppear { applyMacAppearance() }
|
|
.onChange(of: appearance) { _, _ in applyMacAppearance() }
|
|
.logoutConfirmationDialog(isPresented: $isShowingLogoutConfirmation, session: session)
|
|
#endif
|
|
}
|
|
#if os(macOS)
|
|
.commands {
|
|
CommandGroup(replacing: .appInfo) {
|
|
Button("About Outpost") {
|
|
navigation.selectedSettingsSection = .about
|
|
navigation.isShowingSettings = true
|
|
}
|
|
}
|
|
// No `Settings {}` scene anymore — Settings renders inside the
|
|
// root window (see `AppNavigation`), not a separate popup, so
|
|
// ⌘, has to be wired up by hand instead of coming for free.
|
|
CommandGroup(replacing: .appSettings) {
|
|
Button("Settings…") {
|
|
navigation.isShowingSettings = true
|
|
}
|
|
.keyboardShortcut(",")
|
|
.disabled(!session.isSignedIn)
|
|
}
|
|
CommandGroup(after: .appSettings) {
|
|
Divider()
|
|
Button("Log Out…") {
|
|
isShowingLogoutConfirmation = true
|
|
}
|
|
.disabled(!session.isSignedIn)
|
|
}
|
|
}
|
|
#endif
|
|
|
|
#if os(macOS)
|
|
Window("Keyboard Shortcuts", id: "keyboard-shortcuts") {
|
|
KeyboardShortcutsView()
|
|
.disablesFullScreen()
|
|
}
|
|
.windowResizability(.contentSize)
|
|
#endif
|
|
}
|
|
|
|
#if os(macOS)
|
|
/// `.preferredColorScheme(nil)` doesn't reliably reset the window's real
|
|
/// `NSAppearance` back to "follow system" after an explicit override — this
|
|
/// sets the actual AppKit-level appearance directly instead, which every
|
|
/// window (present and future) inherits.
|
|
private func applyMacAppearance() {
|
|
switch appearance {
|
|
case .system:
|
|
NSApp.appearance = nil
|
|
case .light:
|
|
NSApp.appearance = NSAppearance(named: .aqua)
|
|
case .dark:
|
|
NSApp.appearance = NSAppearance(named: .darkAqua)
|
|
}
|
|
}
|
|
#endif
|
|
}
|