From 230bd50661fe0afaed7881c3a9eda1cb5e7fefb1 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Sat, 12 Jun 2021 22:17:09 -0400 Subject: [PATCH] Disable selection of presenting sidebar items on focus --- .../Screens/Main/MainSidebarViewController.swift | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Tusker/Screens/Main/MainSidebarViewController.swift b/Tusker/Screens/Main/MainSidebarViewController.swift index 53922328..9fa01706 100644 --- a/Tusker/Screens/Main/MainSidebarViewController.swift +++ b/Tusker/Screens/Main/MainSidebarViewController.swift @@ -448,6 +448,20 @@ extension MainSidebarViewController: UICollectionViewDelegate { sidebarDelegate?.sidebar(self, didSelectItem: item) } } + + @available(iOS 15.0, *) + func collectionView(_ collectionView: UICollectionView, selectionFollowsFocusForItemAt indexPath: IndexPath) -> Bool { + guard let item = dataSource.itemIdentifier(for: indexPath) else { + return true + } + // don't immediately select items that present VCs when the they're focused, only when deliberately selected + switch item { + case .tab(.compose), .addList, .addSavedHashtag, .addSavedInstance: + return false + default: + return true + } + } } extension MainSidebarViewController: UICollectionViewDragDelegate {