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-02 22:23:01 +00:00
|
|
|
private let environment: AppEnvironment
|
2020-07-29 23:50:30 +00:00
|
|
|
|
|
|
|
init() {
|
2020-08-02 22:23:01 +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-02 22:23:01 +00:00
|
|
|
|
|
|
|
environment = AppEnvironment(
|
2020-08-03 15:20:51 +00:00
|
|
|
URLSessionConfiguration: .default,
|
2020-08-02 22:23:01 +00:00
|
|
|
identityDatabase: identityDatabase,
|
2020-08-06 06:45:57 +00:00
|
|
|
defaults: Defaults(userDefaults: .standard),
|
2020-08-09 02:52:41 +00:00
|
|
|
keychainService: KeychainService(serviceName: Self.keychainServiceName),
|
2020-08-09 01:37:46 +00:00
|
|
|
webAuthSessionType: WebAuthSession.self)
|
2020-07-29 23:50:30 +00:00
|
|
|
}
|
|
|
|
|
2020-07-19 02:06:12 +00:00
|
|
|
var body: some Scene {
|
|
|
|
WindowGroup {
|
2020-08-09 05:37:04 +00:00
|
|
|
RootView(viewModel: RootViewModel(identitiesService: IdentitiesService(environment: environment)))
|
2020-07-19 02:06:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-08-09 02:52:41 +00:00
|
|
|
|
|
|
|
private extension MetatextApp {
|
|
|
|
static let keychainServiceName = "com.metabolist.metatext"
|
|
|
|
}
|