SPB Git

Repository Public

SPWalletApp.swift 1.4 KB 38 lines swift

1// SP Wallet iOS2// File: App/SPWalletApp.swift3// Description: Entry point of SP Wallet for iPhone and iPad: a native SwiftUI app, no web view anywhere.4//5// Author: Simon-Pierre Boucher6// Contact: contact@spboucher.ai7import SwiftUI89@main10struct SPWalletApp: App {11    @State private var model = AppModel(env: AppEnvironment())12    @Environment(\.scenePhase) private var scenePhase1314    init() { NotificationTapHandler.shared.activate() }1516    var body: some Scene {17        let model = model18        WindowGroup {19            RootView()20                .wallet(model)21                .tint(Theme.blue)22                .task { NotificationTapHandler.shared.install { model.router.section = .alerts }; model.alertCenter.start(); await model.bootstrap() }23                .onOpenURL { model.router.open($0) }24                .onChange(of: scenePhase) { _, phase in25                    switch phase {26                    case .background: model.sceneDidEnterBackground(); model.alertCenter.stop(); BackgroundRefresh.schedule()27                    case .active: model.alertCenter.start(); Task { await model.sceneDidBecomeActive() }28                    default: break29                    }30                }31        }32        .commands { AppCommands(router: model.router, model: model) }33        .backgroundTask(.appRefresh(BackgroundRefresh.identifier)) {34            _ = await model.alertCenter.backgroundPass(model: model) { await model.backgroundRefresh() }35        }36    }37}38
Files main
Menu

Theme