yattee/Shared/YatteeApp.swift

46 lines
1.1 KiB
Swift
Raw Normal View History

2021-09-25 08:18:22 +00:00
import Defaults
2021-06-09 20:51:23 +00:00
import SwiftUI
@main
2021-11-07 13:32:01 +00:00
struct YatteeApp: App {
2021-10-24 09:16:04 +00:00
#if os(macOS)
@NSApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
2021-12-07 23:09:49 +00:00
@StateObject private var updater = UpdaterModel()
2021-10-24 09:16:04 +00:00
#endif
2021-11-08 23:14:28 +00:00
@StateObject private var menu = MenuModel()
2021-06-09 20:51:23 +00:00
var body: some Scene {
WindowGroup {
ContentView()
2021-11-08 23:14:28 +00:00
.environmentObject(menu)
2021-06-09 20:51:23 +00:00
}
2021-07-27 22:40:04 +00:00
#if !os(tvOS)
2021-11-08 16:29:35 +00:00
.handlesExternalEvents(matching: Set(["*"]))
.commands {
SidebarCommands()
2021-12-07 23:09:49 +00:00
2021-11-08 16:29:35 +00:00
CommandGroup(replacing: .newItem, addition: {})
2021-12-07 23:09:49 +00:00
#if os(macOS)
CommandGroup(after: .appInfo) {
CheckForUpdatesView()
.environmentObject(updater)
}
#endif
2021-11-08 23:14:28 +00:00
MenuCommands(model: Binding<MenuModel>(get: { menu }, set: { _ in }))
2021-11-08 16:29:35 +00:00
}
2021-07-27 22:40:04 +00:00
#endif
2021-09-25 08:18:22 +00:00
#if os(macOS)
Settings {
SettingsView()
2021-11-12 20:46:15 +00:00
.environmentObject(AccountsModel())
.environmentObject(InstancesModel())
2021-12-07 23:09:49 +00:00
.environmentObject(updater)
2021-09-25 08:18:22 +00:00
}
#endif
}
2021-06-09 20:51:23 +00:00
}