From f9c0506590eb75584e9ba27eaeecf5f36f02e68b Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Mon, 9 Sep 2024 19:18:12 -0400 Subject: [PATCH] Add tab-switching shortcuts to new tab bar Closes #541 --- .../Main/NewMainTabBarViewController.swift | 31 ++++++++++++++++--- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/Tusker/Screens/Main/NewMainTabBarViewController.swift b/Tusker/Screens/Main/NewMainTabBarViewController.swift index 44335353..3b7c32a0 100644 --- a/Tusker/Screens/Main/NewMainTabBarViewController.swift +++ b/Tusker/Screens/Main/NewMainTabBarViewController.swift @@ -314,10 +314,6 @@ final class NewMainTabBarViewController: BaseMainTabBarViewController { } } - @objc func handleComposeKeyCommand() { - compose(editing: nil) - } - @objc private func sidebarTapped() { #if !os(visionOS) fastAccountSwitcher?.hide() @@ -408,6 +404,33 @@ final class NewMainTabBarViewController: BaseMainTabBarViewController { return true } #endif + + // MARK: Keyboard shortcuts + + @objc func handleSidebarCommandTimelines() { + selectedTab = homeTab + } + + @objc func handleSidebarCommandNotifications() { + selectedTab = notificationsTab + } + + @objc func handleSidebarCommandExplore() { + selectedTab = exploreTab + } + + @objc func handleSidebarCommandBookmarks() { + selectedTab = bookmarksTab + } + + @objc func handleSidebarCommandMyProfile() { + selectedTab = myProfileTab + } + + @objc func handleComposeKeyCommand() { + compose(editing: nil) + } + } @available(iOS 18.0, *)