diff --git a/submodules/AccountContext/Sources/DeviceContactData.swift b/submodules/AccountContext/Sources/DeviceContactData.swift index cc223ba8029..e4dceec87d5 100644 --- a/submodules/AccountContext/Sources/DeviceContactData.swift +++ b/submodules/AccountContext/Sources/DeviceContactData.swift @@ -327,14 +327,10 @@ public final class DeviceContactExtendedData: Equatable { public extension DeviceContactExtendedData { convenience init?(vcard: Data) { - if #available(iOSApplicationExtension 9.0, iOS 9.0, *) { - guard let contact = (try? CNContactVCardSerialization.contacts(with: vcard))?.first else { - return nil - } - self.init(contact: contact) - } else { + guard let contact = (try? CNContactVCardSerialization.contacts(with: vcard))?.first else { return nil } + self.init(contact: contact) } @available(iOSApplicationExtension 9.0, iOS 9.0, *) diff --git a/submodules/AdUI/Sources/AdInfoScreen.swift b/submodules/AdUI/Sources/AdInfoScreen.swift index 9c835909d74..59110264572 100644 --- a/submodules/AdUI/Sources/AdInfoScreen.swift +++ b/submodules/AdUI/Sources/AdInfoScreen.swift @@ -81,9 +81,7 @@ public final class AdInfoScreen: ViewController { self.scrollNode.view.scrollsToTop = true self.scrollNode.view.delaysContentTouches = false self.scrollNode.view.canCancelContentTouches = true - if #available(iOS 11.0, *) { - self.scrollNode.view.contentInsetAdjustmentBehavior = .never - } + self.scrollNode.view.contentInsetAdjustmentBehavior = .never var openUrl: ((String) -> Void)? diff --git a/submodules/BotPaymentsUI/Sources/BotCheckoutWebInteractionControllerNode.swift b/submodules/BotPaymentsUI/Sources/BotCheckoutWebInteractionControllerNode.swift index 4352cb60a02..29d36e45552 100644 --- a/submodules/BotPaymentsUI/Sources/BotCheckoutWebInteractionControllerNode.swift +++ b/submodules/BotPaymentsUI/Sources/BotCheckoutWebInteractionControllerNode.swift @@ -57,14 +57,10 @@ final class BotCheckoutWebInteractionControllerNode: ViewControllerTracingNode, configuration.userContentController = userController webView = WKWebView(frame: CGRect(), configuration: configuration) - if #available(iOSApplicationExtension 9.0, iOS 9.0, *) { - webView.allowsLinkPreview = false - } + webView.allowsLinkPreview = false case .externalVerification: webView = WKWebView() - if #available(iOSApplicationExtension 9.0, iOS 9.0, *) { - webView.allowsLinkPreview = false - } + webView.allowsLinkPreview = false webView.navigationDelegate = self } if #available(iOSApplicationExtension 11.0, iOS 11.0, *) { diff --git a/submodules/Components/ReactionListContextMenuContent/Sources/ReactionListContextMenuContent.swift b/submodules/Components/ReactionListContextMenuContent/Sources/ReactionListContextMenuContent.swift index 754b885bca9..273f7830ec9 100644 --- a/submodules/Components/ReactionListContextMenuContent/Sources/ReactionListContextMenuContent.swift +++ b/submodules/Components/ReactionListContextMenuContent/Sources/ReactionListContextMenuContent.swift @@ -275,9 +275,7 @@ public final class ReactionListContextMenuContent: ContextControllerItemsContent self.scrollNode.view.delaysContentTouches = false self.scrollNode.view.showsVerticalScrollIndicator = false self.scrollNode.view.showsHorizontalScrollIndicator = false - if #available(iOS 11.0, *) { - self.scrollNode.view.contentInsetAdjustmentBehavior = .never - } + self.scrollNode.view.contentInsetAdjustmentBehavior = .never self.scrollNode.view.disablesInteractiveTransitionGestureRecognizer = true self.itemNodes = reactions.map { reaction, count in @@ -795,9 +793,7 @@ public final class ReactionListContextMenuContent: ContextControllerItemsContent self.scrollNode.canCancelAllTouchesInViews = true self.scrollNode.view.delaysContentTouches = false self.scrollNode.view.showsVerticalScrollIndicator = false - if #available(iOS 11.0, *) { - self.scrollNode.view.contentInsetAdjustmentBehavior = .never - } + self.scrollNode.view.contentInsetAdjustmentBehavior = .never self.scrollNode.clipsToBounds = false super.init() diff --git a/submodules/DeviceLocationManager/Sources/DeviceLocationManager.swift b/submodules/DeviceLocationManager/Sources/DeviceLocationManager.swift index 6336580241f..aca01f901a8 100644 --- a/submodules/DeviceLocationManager/Sources/DeviceLocationManager.swift +++ b/submodules/DeviceLocationManager/Sources/DeviceLocationManager.swift @@ -58,9 +58,7 @@ public final class DeviceLocationManager: NSObject { self.manager.activityType = .other self.manager.pausesLocationUpdatesAutomatically = false self.manager.headingFilter = 2.0 - if #available(iOS 11.0, *) { - self.manager.showsBackgroundLocationIndicator = true - } + self.manager.showsBackgroundLocationIndicator = true } public func push(mode: DeviceLocationMode, updated: @escaping (CLLocation, Double?) -> Void) -> Disposable { diff --git a/submodules/Display/Source/CAAnimationUtils.swift b/submodules/Display/Source/CAAnimationUtils.swift index 1466f465301..7e93bae3654 100644 --- a/submodules/Display/Source/CAAnimationUtils.swift +++ b/submodules/Display/Source/CAAnimationUtils.swift @@ -271,11 +271,8 @@ public extension CALayer { func springAnimation(from: AnyObject, to: AnyObject, keyPath: String, duration: Double, delay: Double = 0.0, initialVelocity: CGFloat = 0.0, damping: CGFloat = 88.0, removeOnCompletion: Bool = true, additive: Bool = false) -> CABasicAnimation { let animation: CABasicAnimation - if #available(iOS 9.0, *) { - animation = makeSpringBounceAnimation(keyPath, initialVelocity, damping) - } else { - animation = makeSpringAnimation(keyPath) - } + animation = makeSpringBounceAnimation(keyPath, initialVelocity, damping) + animation.fromValue = from animation.toValue = to animation.isRemovedOnCompletion = removeOnCompletion @@ -302,11 +299,8 @@ public extension CALayer { func animateSpring(from: AnyObject, to: AnyObject, keyPath: String, duration: Double, delay: Double = 0.0, initialVelocity: CGFloat = 0.0, damping: CGFloat = 88.0, removeOnCompletion: Bool = true, additive: Bool = false, completion: ((Bool) -> Void)? = nil) { let animation: CABasicAnimation - if #available(iOS 9.0, *) { - animation = makeSpringBounceAnimation(keyPath, initialVelocity, damping) - } else { - animation = makeSpringAnimation(keyPath) - } + animation = makeSpringBounceAnimation(keyPath, initialVelocity, damping) + animation.fromValue = from animation.toValue = to animation.isRemovedOnCompletion = removeOnCompletion diff --git a/submodules/InstantPageUI/Sources/InstantPageWebEmbedNode.swift b/submodules/InstantPageUI/Sources/InstantPageWebEmbedNode.swift index 300745d8893..9bb1eb7dcc3 100644 --- a/submodules/InstantPageUI/Sources/InstantPageWebEmbedNode.swift +++ b/submodules/InstantPageUI/Sources/InstantPageWebEmbedNode.swift @@ -56,9 +56,7 @@ final class InstantPageWebEmbedNode: ASDisplayNode, InstantPageNode { let webView = WKWebView(frame: CGRect(origin: CGPoint(), size: frame.size), configuration: configuration) webView.allowsBackForwardNavigationGestures = false - if #available(iOSApplicationExtension 9.0, iOS 9.0, *) { - webView.allowsLinkPreview = false - } + webView.allowsLinkPreview = false if #available(iOSApplicationExtension 11.0, iOS 11.0, *) { webView.scrollView.contentInsetAdjustmentBehavior = .never } diff --git a/submodules/TelegramUI/Sources/StoreDownloadedMedia.swift b/submodules/TelegramUI/Sources/StoreDownloadedMedia.swift index 74b48423b7f..75939e76522 100644 --- a/submodules/TelegramUI/Sources/StoreDownloadedMedia.swift +++ b/submodules/TelegramUI/Sources/StoreDownloadedMedia.swift @@ -184,9 +184,7 @@ private final class DownloadedMediaStoreContext { } let options = PHFetchOptions() - if #available(iOSApplicationExtension 9.0, iOS 9.0, *) { - options.fetchLimit = 11 - } + options.fetchLimit = 11 options.predicate = NSPredicate(format: "creationDate == %@", creationDate as CVarArg) var alreadyStored = false diff --git a/submodules/TooltipUI/Sources/TooltipScreen.swift b/submodules/TooltipUI/Sources/TooltipScreen.swift index 4f2b673a16b..accf86e483a 100644 --- a/submodules/TooltipUI/Sources/TooltipScreen.swift +++ b/submodules/TooltipUI/Sources/TooltipScreen.swift @@ -751,9 +751,7 @@ private final class TooltipScreenNode: ViewControllerTracingNode { } var eventIsPresses = false - if #available(iOSApplicationExtension 9.0, iOS 9.0, *) { - eventIsPresses = event.type == .presses - } + eventIsPresses = event.type == .presses if event.type == .touches || eventIsPresses { if let actionButtonNode = self.actionButtonNode, let result = actionButtonNode.hitTest(self.convert(point, to: actionButtonNode), with: event) { return result diff --git a/submodules/TranslateUI/Sources/TranslateScreen.swift b/submodules/TranslateUI/Sources/TranslateScreen.swift index a42435f60eb..d9df26f8271 100644 --- a/submodules/TranslateUI/Sources/TranslateScreen.swift +++ b/submodules/TranslateUI/Sources/TranslateScreen.swift @@ -673,12 +673,10 @@ public class TranslateScreen: ViewController { self.containerView.layer.cornerRadius = 10.0 } - if #available(iOS 11.0, *) { - if layout.safeInsets.bottom.isZero { - self.containerView.layer.maskedCorners = [.layerMinXMinYCorner, .layerMaxXMinYCorner] - } else { - self.containerView.layer.maskedCorners = [.layerMinXMinYCorner, .layerMaxXMinYCorner, .layerMinXMaxYCorner, .layerMaxXMaxYCorner] - } + if layout.safeInsets.bottom.isZero { + self.containerView.layer.maskedCorners = [.layerMinXMinYCorner, .layerMaxXMinYCorner] + } else { + self.containerView.layer.maskedCorners = [.layerMinXMinYCorner, .layerMaxXMinYCorner, .layerMinXMaxYCorner, .layerMaxXMaxYCorner] } if isLandscape { diff --git a/submodules/WatchBridge/Sources/WatchCommunicationManager.swift b/submodules/WatchBridge/Sources/WatchCommunicationManager.swift index 4672c1a99ba..821fef2688e 100644 --- a/submodules/WatchBridge/Sources/WatchCommunicationManager.swift +++ b/submodules/WatchBridge/Sources/WatchCommunicationManager.swift @@ -207,11 +207,7 @@ public func watchCommunicationManager(context: Signal 1 }) - guard let dragInteraction = (contentView?.interactions.compactMap { $0 as? UIDragInteraction }.first) else { - return - } - contentView?.removeInteraction(dragInteraction) - }) - - NotificationCenter.default.removeObserver(self, name: UIResponder.keyboardWillChangeFrameNotification, object: nil) - NotificationCenter.default.removeObserver(self, name: UIResponder.keyboardWillShowNotification, object: nil) - NotificationCenter.default.removeObserver(self, name: UIResponder.keyboardWillHideNotification, object: nil) - } + let webScrollView = self.subviews.compactMap { $0 as? UIScrollView }.first + Queue.mainQueue().after(0.1, { + let contentView = webScrollView?.subviews.first(where: { $0.interactions.count > 1 }) + guard let dragInteraction = (contentView?.interactions.compactMap { $0 as? UIDragInteraction }.first) else { + return + } + contentView?.removeInteraction(dragInteraction) + }) + + NotificationCenter.default.removeObserver(self, name: UIResponder.keyboardWillChangeFrameNotification, object: nil) + NotificationCenter.default.removeObserver(self, name: UIResponder.keyboardWillShowNotification, object: nil) + NotificationCenter.default.removeObserver(self, name: UIResponder.keyboardWillHideNotification, object: nil) } func sendEvent(name: String, data: String?) {