Fix not being able to switch accounts
This commit is contained in:
parent
0d89a0f38f
commit
f320311a78
|
@ -131,6 +131,13 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
|
|||
}
|
||||
}
|
||||
|
||||
func switchToAccount(_ account: LocalData.Account) {
|
||||
LocalData.mostRecentAccountID = account.id
|
||||
fervorController = FervorController(account: account)
|
||||
createAppUI()
|
||||
syncFromServer()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extension SceneDelegate: LoginViewControllerDelegate {
|
||||
|
@ -147,15 +154,6 @@ extension SceneDelegate: LoginViewControllerDelegate {
|
|||
}
|
||||
}
|
||||
|
||||
extension SceneDelegate: HomeViewControllerDelegate {
|
||||
func switchToAccount(_ account: LocalData.Account) {
|
||||
LocalData.mostRecentAccountID = account.id
|
||||
fervorController = FervorController(account: account)
|
||||
createAppUI()
|
||||
syncFromServer()
|
||||
}
|
||||
}
|
||||
|
||||
#if targetEnvironment(macCatalyst)
|
||||
extension NSToolbarItem.Identifier {
|
||||
static let toggleItemRead = NSToolbarItem.Identifier("ToggleItemRead")
|
||||
|
|
|
@ -49,6 +49,7 @@ class AppSplitViewController: UISplitViewController {
|
|||
setViewController(secondaryNav, for: .secondary)
|
||||
|
||||
let home = HomeViewController(fervorController: fervorController)
|
||||
home.delegate = self
|
||||
let nav = AppNavigationController(rootViewController: home)
|
||||
setViewController(nav, for: .compact)
|
||||
}
|
||||
|
@ -61,3 +62,10 @@ extension AppSplitViewController: ItemsViewControllerDelegate {
|
|||
}
|
||||
}
|
||||
|
||||
extension AppSplitViewController: HomeViewControllerDelegate {
|
||||
func switchToAccount(_ account: LocalData.Account) {
|
||||
if let delegate = view.window?.windowScene?.delegate as? SceneDelegate {
|
||||
delegate.switchToAccount(account)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue