Disable selection of presenting sidebar items on focus

This commit is contained in:
Shadowfacts 2021-06-12 22:17:09 -04:00
parent 4f2f8d517f
commit 230bd50661
1 changed files with 14 additions and 0 deletions

View File

@ -448,6 +448,20 @@ extension MainSidebarViewController: UICollectionViewDelegate {
sidebarDelegate?.sidebar(self, didSelectItem: item) 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 { extension MainSidebarViewController: UICollectionViewDragDelegate {