Files
Outpost/Outpost/OutpostApp.swift
T
Puranjay Savar Mattas 6ffba3be02 fix(about): About Outpost opens Settings' About section, no popup window
"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.
2026-08-19 14:08:43 +01:00

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
}