Repository Public
1// Author: Simon-Pierre Boucher — contact@spboucher.ai2// File: App/SPWalletApp.swift3// Description: Entry point of SP Wallet for macOS: one main window (NavigationSplitView), a Settings scene and the app's menu commands. Every screen is SwiftUI/AppKit; no web view exists in this app.4import SwiftUI56@main struct SPWalletApp: App {7 @NSApplicationDelegateAdaptor(AppDelegate.self) private var delegate8 @State private var model = AppModel()9 @State private var nav = Navigator()1011 var body: some Scene {12 Window(AppEnvironment.isDevelopment ? "SP Wallet Dev" : "SP Wallet", id: "main") {13 RootView(model: model, nav: nav)14 .frame(minWidth: 980, minHeight: 640)15 .task {16 delegate.model = model; await model.start()17 #if SPW_DEV18 await DevHarness.run(model: model, nav: nav)19 #endif20 }21 }22 .defaultSize(width: 1280, height: 820)23 .windowResizability(.contentMinSize)24 .commands {25 CommandGroup(replacing: .newItem) {}26 CommandGroup(after: .sidebar) {27 Button("Actualiser") { Task { await model.refreshAll() } }.keyboardShortcut("r").disabled(model.phase != .signedIn)28 Divider()29 ForEach(Array(Section.allCases.prefix(9).enumerated()), id: \.element) { i, s in30 Button(s.title) { nav.section = s }.keyboardShortcut(KeyEquivalent(Character(String(i + 1))), modifiers: .command)31 }32 }33 CommandMenu("Portefeuille") {34 Button("Envoyer…") { nav.section = .send }.keyboardShortcut("e", modifiers: [.command, .shift]).disabled(!model.canOperate)35 Button("Recevoir") { nav.section = .receive }.keyboardShortcut("d", modifiers: [.command, .shift])36 Divider()37 Button("Verrouiller l’app") { model.lock.lockNow() }.keyboardShortcut("l", modifiers: [.command, .control]).disabled(!model.lock.enabled)38 Button("Se déconnecter") { Task { await model.signOut(eraseLocalData: false) } }.disabled(model.phase != .signedIn)39 }40 }41 Settings { SettingsView(model: model).frame(width: 560) }42 }43}44