Fix warning
This commit is contained in:
parent
aedade6d5b
commit
0c3313227b
|
@ -223,42 +223,34 @@ extension SceneCoordinator {
|
||||||
func setup() {
|
func setup() {
|
||||||
let rootViewController: UIViewController
|
let rootViewController: UIViewController
|
||||||
|
|
||||||
do {
|
let _authentication = AuthenticationServiceProvider.shared.authenticationSortedByActivation().first
|
||||||
let _authentication = AuthenticationServiceProvider.shared.authenticationSortedByActivation().first
|
let _authContext = _authentication.flatMap { AuthContext(authentication: $0) }
|
||||||
let _authContext = _authentication.flatMap { AuthContext(authentication: $0) }
|
self.authContext = _authContext
|
||||||
self.authContext = _authContext
|
|
||||||
|
|
||||||
switch UIDevice.current.userInterfaceIdiom {
|
switch UIDevice.current.userInterfaceIdiom {
|
||||||
case .phone:
|
case .phone:
|
||||||
let viewController = MainTabBarController(context: appContext, coordinator: self, authContext: _authContext)
|
let viewController = MainTabBarController(context: appContext, coordinator: self, authContext: _authContext)
|
||||||
self.splitViewController = nil
|
self.splitViewController = nil
|
||||||
self.tabBarController = viewController
|
self.tabBarController = viewController
|
||||||
rootViewController = viewController
|
rootViewController = viewController
|
||||||
default:
|
default:
|
||||||
let splitViewController = RootSplitViewController(context: appContext, coordinator: self, authContext: _authContext)
|
let splitViewController = RootSplitViewController(context: appContext, coordinator: self, authContext: _authContext)
|
||||||
self.splitViewController = splitViewController
|
self.splitViewController = splitViewController
|
||||||
self.tabBarController = splitViewController.contentSplitViewController.mainTabBarController
|
self.tabBarController = splitViewController.contentSplitViewController.mainTabBarController
|
||||||
rootViewController = splitViewController
|
rootViewController = splitViewController
|
||||||
|
}
|
||||||
|
|
||||||
|
sceneDelegate.window?.rootViewController = rootViewController // base: main
|
||||||
|
self.rootViewController = rootViewController
|
||||||
|
|
||||||
|
if _authContext == nil { // entry #1: welcome
|
||||||
|
DispatchQueue.main.async {
|
||||||
|
_ = self.present(
|
||||||
|
scene: .welcome,
|
||||||
|
from: self.sceneDelegate.window?.rootViewController,
|
||||||
|
transition: .modal(animated: true, completion: nil)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
sceneDelegate.window?.rootViewController = rootViewController // base: main
|
|
||||||
self.rootViewController = rootViewController
|
|
||||||
|
|
||||||
if _authContext == nil { // entry #1: welcome
|
|
||||||
DispatchQueue.main.async {
|
|
||||||
_ = self.present(
|
|
||||||
scene: .welcome,
|
|
||||||
from: self.sceneDelegate.window?.rootViewController,
|
|
||||||
transition: .modal(animated: true, completion: nil)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch {
|
|
||||||
assertionFailure(error.localizedDescription)
|
|
||||||
Task {
|
|
||||||
try? await Task.sleep(nanoseconds: .second * 2)
|
|
||||||
setup() // entry #2: retry
|
|
||||||
} // end Task
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue