Fix crash when using app icon shortcuts
This commit is contained in:
parent
809584cc54
commit
83c7609df5
|
@ -315,10 +315,15 @@ extension MainSplitViewController: TuskerRootViewController {
|
||||||
}
|
}
|
||||||
|
|
||||||
func select(tab: MainTabBarViewController.Tab) {
|
func select(tab: MainTabBarViewController.Tab) {
|
||||||
|
if traitCollection.horizontalSizeClass == .compact {
|
||||||
|
tabBarViewController?.select(tab: tab)
|
||||||
|
} else {
|
||||||
if tab == .compose {
|
if tab == .compose {
|
||||||
presentCompose()
|
presentCompose()
|
||||||
} else {
|
} else {
|
||||||
select(item: .tab(tab))
|
select(item: .tab(tab))
|
||||||
|
sidebar.select(item: .tab(tab), animated: false)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,9 +47,10 @@ enum AppShortcutItem: String, CaseIterable {
|
||||||
}
|
}
|
||||||
let scene = UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene }.first!
|
let scene = UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene }.first!
|
||||||
let window = scene.windows.first { $0.isKeyWindow }!
|
let window = scene.windows.first { $0.isKeyWindow }!
|
||||||
let controller = window.rootViewController as! MainTabBarViewController
|
if let controller = window.rootViewController as? TuskerRootViewController {
|
||||||
controller.select(tab: tab)
|
controller.select(tab: tab)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension AppShortcutItem {
|
extension AppShortcutItem {
|
||||||
|
|
Loading…
Reference in New Issue