Fix crash when using app icon shortcuts

This commit is contained in:
Shadowfacts 2020-09-21 18:09:23 -04:00
parent 809584cc54
commit 83c7609df5
Signed by untrusted user: shadowfacts
GPG Key ID: 94A5AB95422746E5
2 changed files with 11 additions and 5 deletions

View File

@ -315,10 +315,15 @@ extension MainSplitViewController: TuskerRootViewController {
}
func select(tab: MainTabBarViewController.Tab) {
if tab == .compose {
presentCompose()
if traitCollection.horizontalSizeClass == .compact {
tabBarViewController?.select(tab: tab)
} else {
select(item: .tab(tab))
if tab == .compose {
presentCompose()
} else {
select(item: .tab(tab))
sidebar.select(item: .tab(tab), animated: false)
}
}
}
}

View File

@ -47,8 +47,9 @@ enum AppShortcutItem: String, CaseIterable {
}
let scene = UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene }.first!
let window = scene.windows.first { $0.isKeyWindow }!
let controller = window.rootViewController as! MainTabBarViewController
controller.select(tab: tab)
if let controller = window.rootViewController as? TuskerRootViewController {
controller.select(tab: tab)
}
}
}