diff --git a/Config/Project.xcconfig b/Config/Project.xcconfig index 5772467ee..7a3b4c157 100644 --- a/Config/Project.xcconfig +++ b/Config/Project.xcconfig @@ -25,7 +25,7 @@ KEYCHAIN_ACCESS_GROUP = $(AppIdentifierPrefix)$(BASE_BUNDLE_IDENTIFIER).keychain.shared // Build settings -IPHONEOS_DEPLOYMENT_TARGET = 11.0 +IPHONEOS_DEPLOYMENT_TARGET = 12.1 SDKROOT = iphoneos TARGETED_DEVICE_FAMILY = 1,2 SWIFT_VERSION = 5.3.1 @@ -45,4 +45,4 @@ CLANG_ANALYZER_NONNULL = YES CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE CLANG_ENABLE_MODULES = YES -CLANG_ENABLE_OBJC_ARC = YES \ No newline at end of file +CLANG_ENABLE_OBJC_ARC = YES diff --git a/Podfile b/Podfile index 39477f80a..419b2b05e 100644 --- a/Podfile +++ b/Podfile @@ -1,7 +1,7 @@ source 'https://cdn.cocoapods.org/' # Uncomment this line to define a global platform for your project -platform :ios, '11.0' +platform :ios, '12.1' # Use frameforks to allow usage of pod written in Swift (like PiwikTracker) use_frameworks! @@ -72,7 +72,7 @@ abstract_target 'RiotPods' do pod 'SwiftJWT', '~> 3.6.200' pod 'SideMenu', '~> 6.5' pod 'DSWaveformImage', '~> 6.1.1' - pod 'ffmpeg-kit-ios-audio', '~> 4.4.LTS' + pod 'ffmpeg-kit-ios-audio', '~> 4.4' pod 'FLEX', '~> 4.4.1', :configurations => ['Debug'] diff --git a/Podfile.lock b/Podfile.lock index 34d60ca43..7235fb17d 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -37,7 +37,7 @@ PODS: - DTFoundation/Core - DTFoundation/UIKit (1.7.18): - DTFoundation/Core - - ffmpeg-kit-ios-audio (4.4.LTS) + - ffmpeg-kit-ios-audio (4.4) - FLEX (4.4.1) - FlowCommoniOS (1.10.0) - GBDeviceInfo (6.6.0): @@ -116,7 +116,7 @@ PODS: DEPENDENCIES: - DGCollectionViewLeftAlignFlowLayout (~> 1.0.4) - DSWaveformImage (~> 6.1.1) - - ffmpeg-kit-ios-audio (~> 4.4.LTS) + - ffmpeg-kit-ios-audio (~> 4.4) - FLEX (~> 4.4.1) - FlowCommoniOS (~> 1.10.0) - GBDeviceInfo (~> 6.6.0) @@ -189,7 +189,7 @@ SPEC CHECKSUMS: DSWaveformImage: 3c718a0cf99291887ee70d1d0c18d80101d3d9ce DTCoreText: ec749e013f2e1f76de5e7c7634642e600a7467ce DTFoundation: a53f8cda2489208cbc71c648be177f902ee17536 - ffmpeg-kit-ios-audio: 1c365080b8c76aa77b87c926f9f66ac07859b342 + ffmpeg-kit-ios-audio: ddfc3dac6f574e83d53f8ae33586711162685d3e FLEX: 7ca2c8cd3a435ff501ff6d2f2141e9bdc934eaab FlowCommoniOS: bcdf81a5f30717e711af08a8c812eb045411ba94 GBDeviceInfo: ed0db16230d2fa280e1cbb39a5a7f60f6946aaec @@ -219,6 +219,6 @@ SPEC CHECKSUMS: zxcvbn-ios: fef98b7c80f1512ff0eec47ac1fa399fc00f7e3c ZXingObjC: fdbb269f25dd2032da343e06f10224d62f537bdb -PODFILE CHECKSUM: 1f5ce3d0f93688632aaf046398de5a2c6347ffc4 +PODFILE CHECKSUM: fb064b7e46b1b13cf36073762d0ebf44d1fe9002 -COCOAPODS: 1.10.1 +COCOAPODS: 1.10.2 diff --git a/Riot/Categories/UIDevice.swift b/Riot/Categories/UIDevice.swift index 4c9b18ec0..093a8bdee 100644 --- a/Riot/Categories/UIDevice.swift +++ b/Riot/Categories/UIDevice.swift @@ -21,17 +21,12 @@ import UIKit /// Returns 'true' if the current device has a notch var hasNotch: Bool { - if #available(iOS 11.0, *) { - // Case 1: Portrait && top safe area inset >= 44 - let case1 = !UIDevice.current.orientation.isLandscape && (UIApplication.shared.keyWindow?.safeAreaInsets.top ?? 0) >= 44 - // Case 2: Lanscape && left/right safe area inset > 0 - let case2 = UIDevice.current.orientation.isLandscape && ((UIApplication.shared.keyWindow?.safeAreaInsets.left ?? 0) > 0 || (UIApplication.shared.keyWindow?.safeAreaInsets.right ?? 0) > 0) - - return case1 || case2 - } else { - // Fallback on earlier versions - return false - } + // Case 1: Portrait && top safe area inset >= 44 + let case1 = !UIDevice.current.orientation.isLandscape && (UIApplication.shared.keyWindow?.safeAreaInsets.top ?? 0) >= 44 + // Case 2: Lanscape && left/right safe area inset > 0 + let case2 = UIDevice.current.orientation.isLandscape && ((UIApplication.shared.keyWindow?.safeAreaInsets.left ?? 0) > 0 || (UIApplication.shared.keyWindow?.safeAreaInsets.right ?? 0) > 0) + + return case1 || case2 } /// Returns if the device is a Phone diff --git a/Riot/Categories/UITableView.swift b/Riot/Categories/UITableView.swift index e96446685..5559bfe02 100644 --- a/Riot/Categories/UITableView.swift +++ b/Riot/Categories/UITableView.swift @@ -22,10 +22,8 @@ extension UITableView { /// Returns safe area insetted separator inset. Should only be used when custom constraints on custom table view cells are being set according to separator insets. @objc var vc_separatorInset: UIEdgeInsets { var result = separatorInset - if #available(iOS 11.0, *) { - result.left -= self.safeAreaInsets.left - result.right -= self.safeAreaInsets.right - } + result.left -= self.safeAreaInsets.left + result.right -= self.safeAreaInsets.right return result } diff --git a/Riot/Categories/UITableViewCell.swift b/Riot/Categories/UITableViewCell.swift index dfd80a9c2..86c4b7ee0 100644 --- a/Riot/Categories/UITableViewCell.swift +++ b/Riot/Categories/UITableViewCell.swift @@ -26,10 +26,8 @@ extension UITableViewCell { /// Returns safe area insetted separator inset. Should only be used when custom constraints on custom table view cells are being set according to separator insets. @objc var vc_separatorInset: UIEdgeInsets { var result = separatorInset - if #available(iOS 11.0, *) { - result.left -= self.safeAreaInsets.left - result.right -= self.safeAreaInsets.right - } + result.left -= self.safeAreaInsets.left + result.right -= self.safeAreaInsets.right return result } diff --git a/Riot/Managers/Theme/Theme.swift b/Riot/Managers/Theme/Theme.swift index 72d2d1ab8..37479e048 100644 --- a/Riot/Managers/Theme/Theme.swift +++ b/Riot/Managers/Theme/Theme.swift @@ -80,7 +80,6 @@ import DesignKit var keyboardAppearance: UIKeyboardAppearance { get } - @available(iOS 12.0, *) var userInterfaceStyle: UIUserInterfaceStyle { get } diff --git a/Riot/Managers/Theme/Themes/DarkTheme.swift b/Riot/Managers/Theme/Themes/DarkTheme.swift index f1ef31000..1d4ce7149 100644 --- a/Riot/Managers/Theme/Themes/DarkTheme.swift +++ b/Riot/Managers/Theme/Themes/DarkTheme.swift @@ -76,7 +76,6 @@ class DarkTheme: NSObject, Theme { var scrollBarStyle: UIScrollView.IndicatorStyle = .white var keyboardAppearance: UIKeyboardAppearance = .dark - @available(iOS 12.0, *) var userInterfaceStyle: UIUserInterfaceStyle { return .dark } diff --git a/Riot/Managers/Theme/Themes/DefaultTheme.swift b/Riot/Managers/Theme/Themes/DefaultTheme.swift index 65df6047b..cd618d29d 100644 --- a/Riot/Managers/Theme/Themes/DefaultTheme.swift +++ b/Riot/Managers/Theme/Themes/DefaultTheme.swift @@ -82,7 +82,6 @@ class DefaultTheme: NSObject, Theme { var scrollBarStyle: UIScrollView.IndicatorStyle = .default var keyboardAppearance: UIKeyboardAppearance = .light - @available(iOS 12.0, *) var userInterfaceStyle: UIUserInterfaceStyle { return .light } diff --git a/Riot/Modules/Application/LegacyAppDelegate.m b/Riot/Modules/Application/LegacyAppDelegate.m index abc3e0674..179bcbbc1 100644 --- a/Riot/Modules/Application/LegacyAppDelegate.m +++ b/Riot/Modules/Application/LegacyAppDelegate.m @@ -722,12 +722,9 @@ NSString *const AppDelegateUniversalLinkDidChangeNotification = @"AppDelegateUni } _isAppForeground = YES; - - if (@available(iOS 11.0, *)) - { - // Riot has its own dark theme. Prevent iOS from applying its one - [application keyWindow].accessibilityIgnoresInvertColors = YES; - } + + // Riot has its own dark theme. Prevent iOS from applying its one + [application keyWindow].accessibilityIgnoresInvertColors = YES; [self handleAppState]; } diff --git a/Riot/Modules/Authentication/SSO/LegacySSOAuthentificationSession.swift b/Riot/Modules/Authentication/SSO/LegacySSOAuthentificationSession.swift deleted file mode 100644 index db451bfab..000000000 --- a/Riot/Modules/Authentication/SSO/LegacySSOAuthentificationSession.swift +++ /dev/null @@ -1,59 +0,0 @@ -// -// Copyright 2020 New Vector Ltd -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// - -import Foundation -import SafariServices - -/// LegacySSOAuthentificationSession is session used to authenticate a user through a web service on iOS 11 and earlier. It uses SFAuthenticationSession. -final class LegacySSOAuthentificationSession: SSOAuthentificationSessionProtocol { - - // MARK: - Constants - - // MARK: - Properties - - private var authentificationSession: SFAuthenticationSession? - - // MARK: - Public - - func setContextProvider(_ contextProvider: SSOAuthenticationSessionContextProviding) { - } - - func authenticate(with url: URL, callbackURLScheme: String?, completionHandler: @escaping SSOAuthenticationSessionCompletionHandler) { - - let authentificationSession = SFAuthenticationSession(url: url, callbackURLScheme: callbackURLScheme) { (callbackURL, error) in - - var finalError: Error? - - if let error = error as? SFAuthenticationError { - switch error.code { - case .canceledLogin: - finalError = SSOAuthentificationSessionError.userCanceled - default: - finalError = error - } - } - - completionHandler(callbackURL, finalError) - } - - self.authentificationSession = authentificationSession - authentificationSession.start() - } - - func cancel() { - self.authentificationSession?.cancel() - } -} diff --git a/Riot/Modules/Authentication/SSO/SSOAuthenticationPresenter.swift b/Riot/Modules/Authentication/SSO/SSOAuthenticationPresenter.swift index 3a0b202ec..182d1c74b 100644 --- a/Riot/Modules/Authentication/SSO/SSOAuthenticationPresenter.swift +++ b/Riot/Modules/Authentication/SSO/SSOAuthenticationPresenter.swift @@ -110,19 +110,11 @@ final class SSOAuthenticationPresenter: NSObject { return } - let authenticationSession: SSOAuthentificationSessionProtocol + let authenticationSession = SSOAuthentificationSession() - if #available(iOS 12.0, *) { - authenticationSession = SSOAuthentificationSession() - } else { - authenticationSession = LegacySSOAuthentificationSession() - } - - if #available(iOS 12.0, *) { - if let presentingWindow = presentingViewController.view.window { - let contextProvider = SSOAuthenticationSessionContextProvider(window: presentingWindow) - authenticationSession.setContextProvider(contextProvider) - } + if let presentingWindow = presentingViewController.view.window { + let contextProvider = SSOAuthenticationSessionContextProvider(window: presentingWindow) + authenticationSession.setContextProvider(contextProvider) } authenticationSession.authenticate(with: authenticationURL, callbackURLScheme: self.ssoAuthenticationService.callBackURLScheme) { [weak self] (callBackURL, error) in diff --git a/Riot/Modules/Authentication/SSO/SSOAuthentificationSession.swift b/Riot/Modules/Authentication/SSO/SSOAuthentificationSession.swift index 9c428af03..fa595fc15 100644 --- a/Riot/Modules/Authentication/SSO/SSOAuthentificationSession.swift +++ b/Riot/Modules/Authentication/SSO/SSOAuthentificationSession.swift @@ -18,7 +18,6 @@ import Foundation import AuthenticationServices /// Provides context to target where in an application's UI the authorization view should be shown. -@available(iOS 12.0, *) class SSOAuthenticationSessionContextProvider: NSObject, SSOAuthenticationSessionContextProviding, ASWebAuthenticationPresentationContextProviding { let window: UIWindow @@ -33,7 +32,6 @@ class SSOAuthenticationSessionContextProvider: NSObject, SSOAuthenticationSessio /// SSOAuthentificationSession is session used to authenticate a user through a web service on iOS 12+. It uses ASWebAuthenticationSession. /// More information: https://developer.apple.com/documentation/authenticationservices/authenticating_a_user_through_a_web_service -@available(iOS 12.0, *) final class SSOAuthentificationSession: SSOAuthentificationSessionProtocol { // MARK: - Constants diff --git a/Riot/Modules/Common/Recents/RecentsViewController.m b/Riot/Modules/Common/Recents/RecentsViewController.m index 941aed1ac..7e89bd215 100644 --- a/Riot/Modules/Common/Recents/RecentsViewController.m +++ b/Riot/Modules/Common/Recents/RecentsViewController.m @@ -751,7 +751,7 @@ NSString *const RecentsViewControllerDataReadyNotification = @"RecentsViewContro } // Look for the lowest section index visible in the bottom sticky headers. - CGFloat maxVisiblePosY = self.recentsTableView.contentOffset.y + self.recentsTableView.frame.size.height - self.recentsTableView.mxk_adjustedContentInset.bottom; + CGFloat maxVisiblePosY = self.recentsTableView.contentOffset.y + self.recentsTableView.frame.size.height - self.recentsTableView.adjustedContentInset.bottom; UIView *lastDisplayedSectionHeader = displayedSectionHeaders.lastObject; for (UIView *header in _stickyHeadersBottomContainer.subviews) @@ -1550,7 +1550,7 @@ NSString *const RecentsViewControllerDataReadyNotification = @"RecentsViewContro { if (!self.recentsSearchBar.isHidden) { - if (!self.recentsSearchBar.text.length && (scrollView.contentOffset.y + scrollView.mxk_adjustedContentInset.top > self.recentsSearchBar.frame.size.height)) + if (!self.recentsSearchBar.text.length && (scrollView.contentOffset.y + scrollView.adjustedContentInset.top > self.recentsSearchBar.frame.size.height)) { // Hide the search bar [self hideSearchBar:YES]; @@ -1999,7 +1999,7 @@ NSString *const RecentsViewControllerDataReadyNotification = @"RecentsViewContro - (void)scrollToTop:(BOOL)animated { - [self.recentsTableView setContentOffset:CGPointMake(-self.recentsTableView.mxk_adjustedContentInset.left, -self.recentsTableView.mxk_adjustedContentInset.top) animated:animated]; + [self.recentsTableView setContentOffset:CGPointMake(-self.recentsTableView.adjustedContentInset.left, -self.recentsTableView.adjustedContentInset.top) animated:animated]; } - (void)scrollToTheTopTheNextRoomWithMissedNotificationsInSection:(NSInteger)section diff --git a/Riot/Modules/Communities/GroupsViewController.m b/Riot/Modules/Communities/GroupsViewController.m index f357a783b..5591fdcf6 100644 --- a/Riot/Modules/Communities/GroupsViewController.m +++ b/Riot/Modules/Communities/GroupsViewController.m @@ -545,7 +545,7 @@ { if (!self.groupsSearchBar.isHidden) { - if (!self.groupsSearchBar.text.length && (scrollView.contentOffset.y + scrollView.mxk_adjustedContentInset.top > self.groupsSearchBar.frame.size.height)) + if (!self.groupsSearchBar.text.length && (scrollView.contentOffset.y + scrollView.adjustedContentInset.top > self.groupsSearchBar.frame.size.height)) { // Hide the search bar [self hideSearchBar:YES]; @@ -590,7 +590,7 @@ - (void)scrollToTop:(BOOL)animated { - [self.groupsTableView setContentOffset:CGPointMake(-self.groupsTableView.mxk_adjustedContentInset.left, -self.groupsTableView.mxk_adjustedContentInset.top) animated:animated]; + [self.groupsTableView setContentOffset:CGPointMake(-self.groupsTableView.adjustedContentInset.left, -self.groupsTableView.adjustedContentInset.top) animated:animated]; } #pragma mark - MXKGroupListViewControllerDelegate diff --git a/Riot/Modules/Contacts/ContactsTableViewController.m b/Riot/Modules/Contacts/ContactsTableViewController.m index c9af2e4c5..00c84c3ba 100644 --- a/Riot/Modules/Contacts/ContactsTableViewController.m +++ b/Riot/Modules/Contacts/ContactsTableViewController.m @@ -167,7 +167,7 @@ // Observe kAppDelegateDidTapStatusBarNotification. kAppDelegateDidTapStatusBarNotificationObserver = [[NSNotificationCenter defaultCenter] addObserverForName:kAppDelegateDidTapStatusBarNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *notif) { - [self.contactsTableView setContentOffset:CGPointMake(-self.contactsTableView.mxk_adjustedContentInset.left, -self.contactsTableView.mxk_adjustedContentInset.top) animated:YES]; + [self.contactsTableView setContentOffset:CGPointMake(-self.contactsTableView.adjustedContentInset.left, -self.contactsTableView.adjustedContentInset.top) animated:YES]; }]; @@ -353,7 +353,7 @@ - (void)scrollToTop:(BOOL)animated { // Scroll to the top - [self.contactsTableView setContentOffset:CGPointMake(-self.contactsTableView.mxk_adjustedContentInset.left, -self.contactsTableView.mxk_adjustedContentInset.top) animated:animated]; + [self.contactsTableView setContentOffset:CGPointMake(-self.contactsTableView.adjustedContentInset.left, -self.contactsTableView.adjustedContentInset.top) animated:animated]; } #pragma mark - UITableView delegate diff --git a/Riot/Modules/GlobalSearch/Rooms/DirectoryViewController.m b/Riot/Modules/GlobalSearch/Rooms/DirectoryViewController.m index 7a63d1c2a..3a6278002 100644 --- a/Riot/Modules/GlobalSearch/Rooms/DirectoryViewController.m +++ b/Riot/Modules/GlobalSearch/Rooms/DirectoryViewController.m @@ -113,7 +113,7 @@ // Observe kAppDelegateDidTapStatusBarNotificationObserver. kAppDelegateDidTapStatusBarNotificationObserver = [[NSNotificationCenter defaultCenter] addObserverForName:kAppDelegateDidTapStatusBarNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *notif) { - [self.tableView setContentOffset:CGPointMake(-self.tableView.mxk_adjustedContentInset.left, -self.tableView.mxk_adjustedContentInset.top) animated:YES]; + [self.tableView setContentOffset:CGPointMake(-self.tableView.adjustedContentInset.left, -self.tableView.adjustedContentInset.top) animated:YES]; }]; diff --git a/Riot/Modules/Room/BubbleReactions/BubbleReactionActionViewCell.swift b/Riot/Modules/Room/BubbleReactions/BubbleReactionActionViewCell.swift index 5fbe5de8a..27e387913 100644 --- a/Riot/Modules/Room/BubbleReactions/BubbleReactionActionViewCell.swift +++ b/Riot/Modules/Room/BubbleReactions/BubbleReactionActionViewCell.swift @@ -36,15 +36,14 @@ final class BubbleReactionActionViewCell: UICollectionViewCell, NibReusable, The // MARK: - Life cycle override func preferredLayoutAttributesFitting(_ layoutAttributes: UICollectionViewLayoutAttributes) -> UICollectionViewLayoutAttributes { - if #available(iOS 12.0, *) { - /* - On iOS 12, there are issues with self-sizing cells as described in Apple release notes (https://developer.apple.com/documentation/ios_release_notes/ios_12_release_notes) : - "You might encounter issues with systemLayoutSizeFitting(_:) when using a UICollectionViewCell subclass that requires updateConstraints(). - (42138227) — Workaround: Don't call the cell's setNeedsUpdateConstraints() method unless you need to support live constraint changes. - If you need to support live constraint changes, call updateConstraintsIfNeeded() before calling systemLayoutSizeFitting(_:)." - */ - self.updateConstraintsIfNeeded() - } + /* + On iOS 12, there are issues with self-sizing cells as described in Apple release notes (https://developer.apple.com/documentation/ios_release_notes/ios_12_release_notes) : + "You might encounter issues with systemLayoutSizeFitting(_:) when using a UICollectionViewCell subclass that requires updateConstraints(). + (42138227) — Workaround: Don't call the cell's setNeedsUpdateConstraints() method unless you need to support live constraint changes. + If you need to support live constraint changes, call updateConstraintsIfNeeded() before calling systemLayoutSizeFitting(_:)." + */ + self.updateConstraintsIfNeeded() + return super.preferredLayoutAttributesFitting(layoutAttributes) } diff --git a/Riot/Modules/Room/BubbleReactions/BubbleReactionViewCell.swift b/Riot/Modules/Room/BubbleReactions/BubbleReactionViewCell.swift index c6e2af626..da84b002b 100644 --- a/Riot/Modules/Room/BubbleReactions/BubbleReactionViewCell.swift +++ b/Riot/Modules/Room/BubbleReactions/BubbleReactionViewCell.swift @@ -57,15 +57,14 @@ final class BubbleReactionViewCell: UICollectionViewCell, NibReusable, Themable } override func preferredLayoutAttributesFitting(_ layoutAttributes: UICollectionViewLayoutAttributes) -> UICollectionViewLayoutAttributes { - if #available(iOS 12.0, *) { - /* - On iOS 12, there are issues with self-sizing cells as described in Apple release notes (https://developer.apple.com/documentation/ios_release_notes/ios_12_release_notes) : - "You might encounter issues with systemLayoutSizeFitting(_:) when using a UICollectionViewCell subclass that requires updateConstraints(). - (42138227) — Workaround: Don't call the cell's setNeedsUpdateConstraints() method unless you need to support live constraint changes. - If you need to support live constraint changes, call updateConstraintsIfNeeded() before calling systemLayoutSizeFitting(_:)." - */ - self.updateConstraintsIfNeeded() - } + /* + On iOS 12, there are issues with self-sizing cells as described in Apple release notes (https://developer.apple.com/documentation/ios_release_notes/ios_12_release_notes) : + "You might encounter issues with systemLayoutSizeFitting(_:) when using a UICollectionViewCell subclass that requires updateConstraints(). + (42138227) — Workaround: Don't call the cell's setNeedsUpdateConstraints() method unless you need to support live constraint changes. + If you need to support live constraint changes, call updateConstraintsIfNeeded() before calling systemLayoutSizeFitting(_:)." + */ + self.updateConstraintsIfNeeded() + return super.preferredLayoutAttributesFitting(layoutAttributes) } diff --git a/Riot/Modules/Room/ContextualMenu/RoomContextualMenuViewController.swift b/Riot/Modules/Room/ContextualMenu/RoomContextualMenuViewController.swift index e236a6ec1..4b29dfa83 100644 --- a/Riot/Modules/Room/ContextualMenu/RoomContextualMenuViewController.swift +++ b/Riot/Modules/Room/ContextualMenu/RoomContextualMenuViewController.swift @@ -58,11 +58,7 @@ final class RoomContextualMenuViewController: UIViewController, Themable { private var hiddenToolbarViewBottomConstant: CGFloat { let bottomSafeAreaHeight: CGFloat - if #available(iOS 11.0, *) { - bottomSafeAreaHeight = self.view.safeAreaInsets.bottom - } else { - bottomSafeAreaHeight = self.bottomLayoutGuide.length - } + bottomSafeAreaHeight = self.view.safeAreaInsets.bottom return -(self.menuToolbarViewHeightConstraint.constant + bottomSafeAreaHeight) } diff --git a/Riot/Modules/Room/EmojiPicker/EmojiPickerViewController.swift b/Riot/Modules/Room/EmojiPicker/EmojiPickerViewController.swift index 5bb2154a6..47349e326 100644 --- a/Riot/Modules/Room/EmojiPicker/EmojiPickerViewController.swift +++ b/Riot/Modules/Room/EmojiPicker/EmojiPickerViewController.swift @@ -92,9 +92,7 @@ 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 -// if #available(iOS 11.0, *) { -// self.navigationItem.hidesSearchBarWhenScrolling = true -// } + // self.navigationItem.hidesSearchBarWhenScrolling = true } override func viewDidDisappear(_ animated: Bool) { @@ -140,9 +138,7 @@ final class EmojiPickerViewController: UIViewController { self.setupCollectionView() - if #available(iOS 11.0, *) { - self.setupSearchController() - } + self.setupSearchController() } private func setupCollectionView() { @@ -158,10 +154,8 @@ final class EmojiPickerViewController: UIViewController { collectionViewFlowLayout.sectionInset = CollectionViewLayout.sectionInsets collectionViewFlowLayout.sectionHeadersPinToVisibleBounds = true // Enable sticky headers - // Avoid device notch in landascape (e.g. iPhone X) - if #available(iOS 11.0, *) { - collectionViewFlowLayout.sectionInsetReference = .fromSafeArea - } + // Avoid device notch in landscape (e.g. iPhone X) + collectionViewFlowLayout.sectionInsetReference = .fromSafeArea } self.collectionView.register(supplementaryViewType: EmojiPickerHeaderView.self, ofKind: UICollectionView.elementKindSectionHeader) @@ -175,11 +169,9 @@ final class EmojiPickerViewController: UIViewController { searchController.searchBar.placeholder = VectorL10n.searchDefaultPlaceholder searchController.hidesNavigationBarDuringPresentation = false - if #available(iOS 11.0, *) { - self.navigationItem.searchController = searchController - // Make the search bar visible on first view appearance - self.navigationItem.hidesSearchBarWhenScrolling = false - } + self.navigationItem.searchController = searchController + // Make the search bar visible on first view appearance + self.navigationItem.hidesSearchBarWhenScrolling = false self.definesPresentationContext = true diff --git a/Riot/Modules/Room/RoomViewController.m b/Riot/Modules/Room/RoomViewController.m index 312902949..dd9b7109e 100644 --- a/Riot/Modules/Room/RoomViewController.m +++ b/Riot/Modules/Room/RoomViewController.m @@ -570,7 +570,7 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05; // Observe kAppDelegateDidTapStatusBarNotification. kAppDelegateDidTapStatusBarNotificationObserver = [[NSNotificationCenter defaultCenter] addObserverForName:kAppDelegateDidTapStatusBarNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *notif) { - [self setBubbleTableViewContentOffset:CGPointMake(-self.bubblesTableView.mxk_adjustedContentInset.left, -self.bubblesTableView.mxk_adjustedContentInset.top) animated:YES]; + [self setBubbleTableViewContentOffset:CGPointMake(-self.bubblesTableView.adjustedContentInset.left, -self.bubblesTableView.adjustedContentInset.top) animated:YES]; }]; if ([self.roomDataSource.roomId isEqualToString:[LegacyAppDelegate theDelegate].lastNavigatedRoomIdFromPush]) @@ -764,7 +764,7 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05; CGRect frame = previewHeader.bottomBorderView.frame; self.previewHeaderContainerHeightConstraint.constant = frame.origin.y + frame.size.height; - self.bubblesTableViewTopConstraint.constant = self.previewHeaderContainerHeightConstraint.constant - self.bubblesTableView.mxk_adjustedContentInset.top; + self.bubblesTableViewTopConstraint.constant = self.previewHeaderContainerHeightConstraint.constant - self.bubblesTableView.adjustedContentInset.top; } else { @@ -2356,7 +2356,7 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05; [UIView animateWithDuration:0.3 delay:0 options:UIViewAnimationOptionBeginFromCurrentState | UIViewAnimationOptionCurveEaseIn animations:^{ - self.bubblesTableViewTopConstraint.constant = self.previewHeaderContainerHeightConstraint.constant - self.bubblesTableView.mxk_adjustedContentInset.top; + self.bubblesTableViewTopConstraint.constant = self.previewHeaderContainerHeightConstraint.constant - self.bubblesTableView.adjustedContentInset.top; previewHeader.roomAvatar.alpha = 1; @@ -4202,7 +4202,7 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05; // Switch back to the live mode when the user scrolls to the bottom of the non live timeline. if (!self.roomDataSource.isLive && ![self isRoomPreview]) { - CGFloat contentBottomPosY = self.bubblesTableView.contentOffset.y + self.bubblesTableView.frame.size.height - self.bubblesTableView.mxk_adjustedContentInset.bottom; + CGFloat contentBottomPosY = self.bubblesTableView.contentOffset.y + self.bubblesTableView.frame.size.height - self.bubblesTableView.adjustedContentInset.bottom; if (contentBottomPosY >= self.bubblesTableView.contentSize.height && ![self.roomDataSource.timeline canPaginate:MXTimelineDirectionForwards]) { [self goBackToLive]; @@ -5186,12 +5186,12 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05; if (readMarkerTableViewCell && isAppeared && !self.isBubbleTableViewDisplayInTransition) { // Check whether the read marker is visible - CGFloat contentTopPosY = self.bubblesTableView.contentOffset.y + self.bubblesTableView.mxk_adjustedContentInset.top; + CGFloat contentTopPosY = self.bubblesTableView.contentOffset.y + self.bubblesTableView.adjustedContentInset.top; CGFloat readMarkerViewPosY = readMarkerTableViewCell.frame.origin.y + readMarkerTableViewCell.readMarkerView.frame.origin.y; if (contentTopPosY <= readMarkerViewPosY) { // Compute the max vertical position visible according to contentOffset - CGFloat contentBottomPosY = self.bubblesTableView.contentOffset.y + self.bubblesTableView.frame.size.height - self.bubblesTableView.mxk_adjustedContentInset.bottom; + CGFloat contentBottomPosY = self.bubblesTableView.contentOffset.y + self.bubblesTableView.frame.size.height - self.bubblesTableView.adjustedContentInset.bottom; if (readMarkerViewPosY <= contentBottomPosY) { // Launch animation @@ -5299,7 +5299,7 @@ const NSTimeInterval kResizeComposerAnimationDuration = .05; // The read marker display is still enabled (see roomDataSource.showReadMarker flag), // this means the read marker was not been visible yet. // We show the banner if the marker is located in the top hidden part of the cell. - CGFloat contentTopPosY = self.bubblesTableView.contentOffset.y + self.bubblesTableView.mxk_adjustedContentInset.top; + CGFloat contentTopPosY = self.bubblesTableView.contentOffset.y + self.bubblesTableView.adjustedContentInset.top; CGFloat readMarkerViewPosY = roomBubbleTableViewCell.frame.origin.y + roomBubbleTableViewCell.readMarkerView.frame.origin.y; self.jumpToLastUnreadBannerContainer.hidden = (contentTopPosY < readMarkerViewPosY); } diff --git a/Riot/Modules/Room/Search/Files/RoomFilesSearchViewController.m b/Riot/Modules/Room/Search/Files/RoomFilesSearchViewController.m index babc0c2fe..78a7bfbf9 100644 --- a/Riot/Modules/Room/Search/Files/RoomFilesSearchViewController.m +++ b/Riot/Modules/Room/Search/Files/RoomFilesSearchViewController.m @@ -116,7 +116,7 @@ // Observe kAppDelegateDidTapStatusBarNotificationObserver. kAppDelegateDidTapStatusBarNotificationObserver = [[NSNotificationCenter defaultCenter] addObserverForName:kAppDelegateDidTapStatusBarNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *notif) { - [self.searchTableView setContentOffset:CGPointMake(-self.searchTableView.mxk_adjustedContentInset.left, -self.searchTableView.mxk_adjustedContentInset.top) animated:YES]; + [self.searchTableView setContentOffset:CGPointMake(-self.searchTableView.adjustedContentInset.left, -self.searchTableView.adjustedContentInset.top) animated:YES]; }]; } diff --git a/Riot/Modules/Room/Search/Messages/RoomMessagesSearchViewController.m b/Riot/Modules/Room/Search/Messages/RoomMessagesSearchViewController.m index 5342d6622..a674af70d 100644 --- a/Riot/Modules/Room/Search/Messages/RoomMessagesSearchViewController.m +++ b/Riot/Modules/Room/Search/Messages/RoomMessagesSearchViewController.m @@ -117,7 +117,7 @@ // Observe kAppDelegateDidTapStatusBarNotificationObserver. kAppDelegateDidTapStatusBarNotificationObserver = [[NSNotificationCenter defaultCenter] addObserverForName:kAppDelegateDidTapStatusBarNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *notif) { - [self.searchTableView setContentOffset:CGPointMake(-self.searchTableView.mxk_adjustedContentInset.left, -self.searchTableView.mxk_adjustedContentInset.top) animated:YES]; + [self.searchTableView setContentOffset:CGPointMake(-self.searchTableView.adjustedContentInset.left, -self.searchTableView.adjustedContentInset.top) animated:YES]; }]; } diff --git a/Riot/Modules/Room/Settings/RoomSettingsViewController.m b/Riot/Modules/Room/Settings/RoomSettingsViewController.m index 90adddf3b..c57058dfe 100644 --- a/Riot/Modules/Room/Settings/RoomSettingsViewController.m +++ b/Riot/Modules/Room/Settings/RoomSettingsViewController.m @@ -320,7 +320,7 @@ NSString *const kRoomSettingsAdvancedE2eEnabledCellViewIdentifier = @"kRoomSetti // Observe appDelegateDidTapStatusBarNotificationObserver. appDelegateDidTapStatusBarNotificationObserver = [[NSNotificationCenter defaultCenter] addObserverForName:kAppDelegateDidTapStatusBarNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *notif) { - [self.tableView setContentOffset:CGPointMake(-self.tableView.mxk_adjustedContentInset.left, -self.tableView.mxk_adjustedContentInset.top) animated:YES]; + [self.tableView setContentOffset:CGPointMake(-self.tableView.adjustedContentInset.left, -self.tableView.adjustedContentInset.top) animated:YES]; }]; } diff --git a/Riot/Modules/Room/Views/InputToolbar/RoomInputToolbarView.m b/Riot/Modules/Room/Views/InputToolbar/RoomInputToolbarView.m index 1ebe7f099..00d5bf2f7 100644 --- a/Riot/Modules/Room/Views/InputToolbar/RoomInputToolbarView.m +++ b/Riot/Modules/Room/Views/InputToolbar/RoomInputToolbarView.m @@ -134,7 +134,7 @@ const CGFloat kComposerContainerTrailingPadding = 12; { [self.attachMediaButton setImage:[UIImage imageNamed:@"upload_icon_dark"] forState:UIControlStateNormal]; } - else if (@available(iOS 12.0, *) && ThemeService.shared.theme.userInterfaceStyle == UIUserInterfaceStyleDark) { + else if (ThemeService.shared.theme.userInterfaceStyle == UIUserInterfaceStyleDark) { [self.attachMediaButton setImage:[UIImage imageNamed:@"upload_icon_dark"] forState:UIControlStateNormal]; } diff --git a/Riot/Modules/Rooms/DirectoryPicker/DirectoryServerPickerViewController.m b/Riot/Modules/Rooms/DirectoryPicker/DirectoryServerPickerViewController.m index f79b976c9..0ac6943b4 100644 --- a/Riot/Modules/Rooms/DirectoryPicker/DirectoryServerPickerViewController.m +++ b/Riot/Modules/Rooms/DirectoryPicker/DirectoryServerPickerViewController.m @@ -151,7 +151,7 @@ // Observe kAppDelegateDidTapStatusBarNotificationObserver. kAppDelegateDidTapStatusBarNotificationObserver = [[NSNotificationCenter defaultCenter] addObserverForName:kAppDelegateDidTapStatusBarNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *notif) { - [self.tableView setContentOffset:CGPointMake(-self.tableView.mxk_adjustedContentInset.left, -self.tableView.mxk_adjustedContentInset.top) animated:YES]; + [self.tableView setContentOffset:CGPointMake(-self.tableView.adjustedContentInset.left, -self.tableView.adjustedContentInset.top) animated:YES]; }]; diff --git a/Riot/Modules/Settings/SettingsViewController.m b/Riot/Modules/Settings/SettingsViewController.m index 7fe3b62ac..05a8dbfd1 100644 --- a/Riot/Modules/Settings/SettingsViewController.m +++ b/Riot/Modules/Settings/SettingsViewController.m @@ -756,7 +756,7 @@ TableViewSectionsDelegate> // Observe kAppDelegateDidTapStatusBarNotificationObserver. kAppDelegateDidTapStatusBarNotificationObserver = [[NSNotificationCenter defaultCenter] addObserverForName:kAppDelegateDidTapStatusBarNotification object:nil queue:[NSOperationQueue mainQueue] usingBlock:^(NSNotification *notif) { - [self.tableView setContentOffset:CGPointMake(-self.tableView.mxk_adjustedContentInset.left, -self.tableView.mxk_adjustedContentInset.top) animated:YES]; + [self.tableView setContentOffset:CGPointMake(-self.tableView.adjustedContentInset.left, -self.tableView.adjustedContentInset.top) animated:YES]; }]; diff --git a/Riot/Modules/SlidingModal/SlidingModalContainerView.swift b/Riot/Modules/SlidingModal/SlidingModalContainerView.swift index 5a2c6b8d5..e845a5295 100644 --- a/Riot/Modules/SlidingModal/SlidingModalContainerView.swift +++ b/Riot/Modules/SlidingModal/SlidingModalContainerView.swift @@ -71,11 +71,7 @@ class SlidingModalContainerView: UIView, Themable, NibLoadable { private var dismissContentViewBottomConstant: CGFloat { let bottomSafeAreaHeight: CGFloat - if #available(iOS 11.0, *) { - bottomSafeAreaHeight = self.contentView.safeAreaInsets.bottom - } else { - bottomSafeAreaHeight = 0 - } + bottomSafeAreaHeight = self.contentView.safeAreaInsets.bottom return -(self.contentViewHeightConstraint.constant + bottomSafeAreaHeight) } diff --git a/RiotShareExtension/Modules/Share/Listing/RoomsListViewController.m b/RiotShareExtension/Modules/Share/Listing/RoomsListViewController.m index 94acaa453..cdaa816b7 100644 --- a/RiotShareExtension/Modules/Share/Listing/RoomsListViewController.m +++ b/RiotShareExtension/Modules/Share/Listing/RoomsListViewController.m @@ -267,9 +267,7 @@ - (void)searchBarTextDidBeginEditing:(UISearchBar *)searchBar { dispatch_async(dispatch_get_main_queue(), ^{ - [self.recentsSearchBar setShowsCancelButton:YES animated:NO]; - }); } @@ -288,7 +286,7 @@ { if (!self.recentsSearchBar.isHidden) { - if (!self.recentsSearchBar.text.length && (scrollView.contentOffset.y + scrollView.mxk_adjustedContentInset.top > self.recentsSearchBar.frame.size.height)) + if (!self.recentsSearchBar.text.length && (scrollView.contentOffset.y + scrollView.adjustedContentInset.top > self.recentsSearchBar.frame.size.height)) { // Hide the search bar [self hideSearchBar:YES]; diff --git a/changelog.d/4693.build b/changelog.d/4693.build new file mode 100644 index 000000000..54a9ce206 --- /dev/null +++ b/changelog.d/4693.build @@ -0,0 +1 @@ +Bumped the minimum deployment target to iOS 12.1 \ No newline at end of file