Skip to content

Commit bc7ba72

Browse files
committed
Drop iOS 9 and iOS 10
1 parent 7c66e23 commit bc7ba72

4 files changed

Lines changed: 11 additions & 40 deletions

File tree

MessageKit.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = 'MessageKit'
3-
s.version = '3.1.0-beta.1'
3+
s.version = '3.1.0'
44
s.license = { :type => "MIT", :file => "LICENSE.md" }
55

66
s.summary = 'An elegant messages UI library for iOS.'
@@ -13,7 +13,7 @@ Pod::Spec.new do |s|
1313

1414
s.swift_version = '5.0'
1515

16-
s.ios.deployment_target = '9.0'
16+
s.ios.deployment_target = '11.0'
1717
s.ios.resource_bundle = { 'MessageKitAssets' => 'Assets/MessageKitAssets.bundle/Images' }
1818

1919
s.dependency 'InputBarAccessoryView', '~> 4.3.0'

MessageKit.xcodeproj/project.pbxproj

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -783,7 +783,7 @@
783783
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
784784
GCC_WARN_UNUSED_FUNCTION = YES;
785785
GCC_WARN_UNUSED_VARIABLE = YES;
786-
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
786+
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
787787
MTL_ENABLE_DEBUG_INFO = YES;
788788
ONLY_ACTIVE_ARCH = YES;
789789
SDKROOT = iphoneos;
@@ -838,7 +838,7 @@
838838
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
839839
GCC_WARN_UNUSED_FUNCTION = YES;
840840
GCC_WARN_UNUSED_VARIABLE = YES;
841-
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
841+
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
842842
MTL_ENABLE_DEBUG_INFO = NO;
843843
SDKROOT = iphoneos;
844844
SWIFT_VERSION = 5.0;
@@ -865,7 +865,6 @@
865865
GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = YES;
866866
INFOPLIST_FILE = "$(SRCROOT)/Sources/Supporting/Info.plist";
867867
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
868-
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
869868
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks $(FRAMEWORK_SEARCH_PATHS)";
870869
PRODUCT_BUNDLE_IDENTIFIER = com.messagekit.MessageKit;
871870
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -891,7 +890,6 @@
891890
GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = YES;
892891
INFOPLIST_FILE = "$(SRCROOT)/Sources/Supporting/Info.plist";
893892
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
894-
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
895893
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks $(FRAMEWORK_SEARCH_PATHS)";
896894
PRODUCT_BUNDLE_IDENTIFIER = com.messagekit.MessageKit;
897895
PRODUCT_NAME = "$(TARGET_NAME)";

Sources/Controllers/MessagesViewController+Keyboard.swift

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ internal extension MessagesViewController {
3232
func addKeyboardObservers() {
3333
NotificationCenter.default.addObserver(self, selector: #selector(MessagesViewController.handleKeyboardDidChangeState(_:)), name: UIResponder.keyboardWillChangeFrameNotification, object: nil)
3434
NotificationCenter.default.addObserver(self, selector: #selector(MessagesViewController.handleTextViewDidBeginEditing(_:)), name: UITextView.textDidBeginEditingNotification, object: nil)
35-
NotificationCenter.default.addObserver(self, selector: #selector(MessagesViewController.adjustScrollViewTopInset), name: UIDevice.orientationDidChangeNotification, object: nil)
3635
}
3736

3837
func removeKeyboardObservers() {
@@ -105,19 +104,6 @@ internal extension MessagesViewController {
105104

106105
// MARK: - Inset Computation
107106

108-
@objc
109-
func adjustScrollViewTopInset() {
110-
if #available(iOS 11.0, *) {
111-
// No need to add to the top contentInset
112-
} else {
113-
let navigationBarInset = navigationController?.navigationBar.frame.height ?? 0
114-
let statusBarInset: CGFloat = UIApplication.shared.isStatusBarHidden ? 0 : 20
115-
let topInset = navigationBarInset + statusBarInset
116-
messagesCollectionView.contentInset.top = topInset
117-
messagesCollectionView.scrollIndicatorInsets.top = topInset
118-
}
119-
}
120-
121107
private func requiredScrollViewBottomInset(forKeyboardFrame keyboardFrame: CGRect) -> CGFloat {
122108
// we only need to adjust for the part of the keyboard that covers (i.e. intersects) our collection view;
123109
// see https://developer.apple.com/videos/play/wwdc2017/242/ for more details
@@ -142,11 +128,7 @@ internal extension MessagesViewController {
142128
///
143129
/// - Returns: The distance automatically added to contentInset.bottom, if any.
144130
private var automaticallyAddedBottomInset: CGFloat {
145-
if #available(iOS 11.0, *) {
146-
return messagesCollectionView.adjustedContentInset.bottom - messagesCollectionView.contentInset.bottom
147-
} else {
148-
return 0
149-
}
131+
return messagesCollectionView.adjustedContentInset.bottom - messagesCollectionView.contentInset.bottom
150132
}
151133

152134
}

Sources/Controllers/MessagesViewController.swift

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -130,13 +130,10 @@ UICollectionViewDelegateFlowLayout, UICollectionViewDataSource {
130130
addKeyboardObservers()
131131
messageCollectionViewBottomInset = requiredInitialScrollViewBottomInset()
132132
}
133-
adjustScrollViewTopInset()
134133
}
135134

136135
open override func viewSafeAreaInsetsDidChange() {
137-
if #available(iOS 11.0, *) {
138-
super.viewSafeAreaInsetsDidChange()
139-
}
136+
super.viewSafeAreaInsetsDidChange()
140137
messageCollectionViewBottomInset = requiredInitialScrollViewBottomInset()
141138
}
142139

@@ -153,8 +150,8 @@ UICollectionViewDelegateFlowLayout, UICollectionViewDataSource {
153150

154151
private func setupDefaults() {
155152
extendedLayoutIncludesOpaqueBars = true
156-
automaticallyAdjustsScrollViewInsets = false
157153
view.backgroundColor = .backgroundColor
154+
messagesCollectionView.contentInsetAdjustmentBehavior = .never
158155
messagesCollectionView.keyboardDismissMode = .interactive
159156
messagesCollectionView.alwaysBounceVertical = true
160157
messagesCollectionView.backgroundColor = .backgroundColor
@@ -172,17 +169,11 @@ UICollectionViewDelegateFlowLayout, UICollectionViewDataSource {
172169
private func setupConstraints() {
173170
messagesCollectionView.translatesAutoresizingMaskIntoConstraints = false
174171

175-
let top = messagesCollectionView.topAnchor.constraint(equalTo: view.topAnchor, constant: topLayoutGuide.length)
172+
let top = messagesCollectionView.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor)
176173
let bottom = messagesCollectionView.bottomAnchor.constraint(equalTo: view.bottomAnchor)
177-
if #available(iOS 11.0, *) {
178-
let leading = messagesCollectionView.leadingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leadingAnchor)
179-
let trailing = messagesCollectionView.trailingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.trailingAnchor)
180-
NSLayoutConstraint.activate([top, bottom, trailing, leading])
181-
} else {
182-
let leading = messagesCollectionView.leadingAnchor.constraint(equalTo: view.leadingAnchor)
183-
let trailing = messagesCollectionView.trailingAnchor.constraint(equalTo: view.trailingAnchor)
184-
NSLayoutConstraint.activate([top, bottom, trailing, leading])
185-
}
174+
let leading = messagesCollectionView.leadingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leadingAnchor)
175+
let trailing = messagesCollectionView.trailingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.trailingAnchor)
176+
NSLayoutConstraint.activate([top, bottom, trailing, leading])
186177
}
187178

188179
// MARK: - Typing Indicator API

0 commit comments

Comments
 (0)