2020-07-19 02:12:32 +00:00
|
|
|
// Copyright © 2020 Metabolist. All rights reserved.
|
2020-07-19 02:06:12 +00:00
|
|
|
|
|
|
|
import SwiftUI
|
|
|
|
|
|
|
|
@main
|
|
|
|
struct MetatextApp: App {
|
2020-08-12 07:24:39 +00:00
|
|
|
// swiftlint:disable weak_delegate
|
|
|
|
#if os(macOS)
|
|
|
|
@NSApplicationDelegateAdaptor(AppDelegate.self) private var appDelegate
|
|
|
|
#else
|
|
|
|
@UIApplicationDelegateAdaptor(AppDelegate.self) private var appDelegate
|
|
|
|
#endif
|
|
|
|
// swiftlint:enable weak_delegate
|
|
|
|
|
2020-08-26 21:35:06 +00:00
|
|
|
private let allIdentitiesService: AllIdentitiesService = {
|
2020-08-12 07:24:39 +00:00
|
|
|
let identityDatabase: IdentityDatabase
|
2020-07-29 23:50:30 +00:00
|
|
|
|
|
|
|
do {
|
|
|
|
try identityDatabase = IdentityDatabase()
|
|
|
|
} catch {
|
|
|
|
fatalError("Failed to initialize identity database")
|
|
|
|
}
|
2020-08-12 07:24:39 +00:00
|
|
|
|
2020-08-26 21:35:06 +00:00
|
|
|
return AllIdentitiesService(identityDatabase: identityDatabase, environment: .live)
|
2020-08-12 07:24:39 +00:00
|
|
|
}()
|
2020-07-29 23:50:30 +00:00
|
|
|
|
2020-07-19 02:06:12 +00:00
|
|
|
var body: some Scene {
|
|
|
|
WindowGroup {
|
2020-08-09 11:27:38 +00:00
|
|
|
RootView(
|
2020-08-12 07:24:39 +00:00
|
|
|
viewModel: RootViewModel(appDelegate: appDelegate,
|
2020-08-26 21:35:06 +00:00
|
|
|
allIdentitiesService: allIdentitiesService,
|
2020-08-13 10:18:21 +00:00
|
|
|
userNotificationService: UserNotificationService()))
|
2020-07-19 02:06:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|