Revert "#4693 - Drop iOS 11 support."

This reverts commit a2b359f21960e1b9f75139d94adc7aeb35fa479f.
This commit is contained in:
Stefan Ceriu
2021-09-06 17:13:08 +03:00
committed by Stefan Ceriu
parent 8207ef4b8e
commit 8f46e037f2
32 changed files with 176 additions and 73 deletions
@@ -92,7 +92,9 @@ final class EmojiPickerViewController: UIViewController {
// Enable to hide search bar on scrolling after first time view appear
// Commenting out below code for now. It broke the navigation bar background. For details: https://github.com/vector-im/riot-ios/issues/3271
// self.navigationItem.hidesSearchBarWhenScrolling = true
// if #available(iOS 11.0, *) {
// self.navigationItem.hidesSearchBarWhenScrolling = true
// }
}
override func viewDidDisappear(_ animated: Bool) {
@@ -138,7 +140,9 @@ final class EmojiPickerViewController: UIViewController {
self.setupCollectionView()
self.setupSearchController()
if #available(iOS 11.0, *) {
self.setupSearchController()
}
}
private func setupCollectionView() {
@@ -154,8 +158,10 @@ final class EmojiPickerViewController: UIViewController {
collectionViewFlowLayout.sectionInset = CollectionViewLayout.sectionInsets
collectionViewFlowLayout.sectionHeadersPinToVisibleBounds = true // Enable sticky headers
// Avoid device notch in landscape (e.g. iPhone X)
collectionViewFlowLayout.sectionInsetReference = .fromSafeArea
// Avoid device notch in landascape (e.g. iPhone X)
if #available(iOS 11.0, *) {
collectionViewFlowLayout.sectionInsetReference = .fromSafeArea
}
}
self.collectionView.register(supplementaryViewType: EmojiPickerHeaderView.self, ofKind: UICollectionView.elementKindSectionHeader)
@@ -169,9 +175,11 @@ final class EmojiPickerViewController: UIViewController {
searchController.searchBar.placeholder = VectorL10n.searchDefaultPlaceholder
searchController.hidesNavigationBarDuringPresentation = false
self.navigationItem.searchController = searchController
// Make the search bar visible on first view appearance
self.navigationItem.hidesSearchBarWhenScrolling = false
if #available(iOS 11.0, *) {
self.navigationItem.searchController = searchController
// Make the search bar visible on first view appearance
self.navigationItem.hidesSearchBarWhenScrolling = false
}
self.definesPresentationContext = true