remove legacy os code
This commit is contained in:
parent
603ecccf35
commit
bb51fba0e5
@ -83,11 +83,9 @@
|
||||
self.enabled = YES;
|
||||
|
||||
// Disable SmartQuotes
|
||||
if (@available(iOS 11.0, *)) {
|
||||
self.textField.smartQuotesType = UITextSmartQuotesTypeNo;
|
||||
self.textField.smartDashesType = UITextSmartDashesTypeNo;
|
||||
self.textField.smartInsertDeleteType = UITextSmartInsertDeleteTypeNo;
|
||||
}
|
||||
self.textField.smartQuotesType = UITextSmartQuotesTypeNo;
|
||||
self.textField.smartDashesType = UITextSmartDashesTypeNo;
|
||||
self.textField.smartInsertDeleteType = UITextSmartInsertDeleteTypeNo;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -173,11 +173,10 @@
|
||||
view.placeHolderLabel.textColor = [UIColor mfLightGrayColor];
|
||||
|
||||
// Disable SmartQuotes
|
||||
if (@available(iOS 11.0, *)) {
|
||||
view.textView.smartQuotesType = UITextSmartQuotesTypeNo;
|
||||
view.textView.smartDashesType = UITextSmartDashesTypeNo;
|
||||
view.textView.smartInsertDeleteType = UITextSmartInsertDeleteTypeNo;
|
||||
}
|
||||
view.textView.smartQuotesType = UITextSmartQuotesTypeNo;
|
||||
view.textView.smartDashesType = UITextSmartDashesTypeNo;
|
||||
view.textView.smartInsertDeleteType = UITextSmartInsertDeleteTypeNo;
|
||||
|
||||
[view didSetFont:view.textView.font];
|
||||
view.hideBorder = YES;
|
||||
return view;
|
||||
|
||||
@ -48,9 +48,7 @@
|
||||
|
||||
- (void)setAsMolecule {
|
||||
self.translatesAutoresizingMaskIntoConstraints = NO;
|
||||
if (@available(iOS 11.0, *)) {
|
||||
self.insetsLayoutMarginsFromSafeArea = NO;
|
||||
}
|
||||
self.insetsLayoutMarginsFromSafeArea = NO;
|
||||
}
|
||||
|
||||
- (void)reset {
|
||||
|
||||
@ -61,12 +61,8 @@
|
||||
tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
||||
tableView.delegate = self;
|
||||
tableView.dataSource = self;
|
||||
if (@available(iOS 11.0, *)) {
|
||||
tableView.insetsContentViewsToSafeArea = NO;
|
||||
}
|
||||
if ([tableView respondsToSelector:@selector(setCellLayoutMarginsFollowReadableWidth:)]) {
|
||||
tableView.cellLayoutMarginsFollowReadableWidth = NO;
|
||||
}
|
||||
tableView.insetsContentViewsToSafeArea = NO;
|
||||
tableView.cellLayoutMarginsFollowReadableWidth = NO;
|
||||
return tableView;
|
||||
}
|
||||
|
||||
|
||||
@ -91,10 +91,7 @@ static NSTimeInterval const HandScrollAnimationTiming = 7.f;
|
||||
- (void)viewDidLayoutSubviews {
|
||||
[super viewDidLayoutSubviews];
|
||||
|
||||
BOOL automaticInset = NO;
|
||||
if (@available(iOS 11.0, *)) {
|
||||
automaticInset = self.navigationController && self.scrollView.contentInsetAdjustmentBehavior == UIScrollViewContentInsetAdjustmentAutomatic;
|
||||
}
|
||||
BOOL automaticInset = self.navigationController && self.scrollView.contentInsetAdjustmentBehavior == UIScrollViewContentInsetAdjustmentAutomatic;
|
||||
|
||||
// Takes into account the navigation bar.
|
||||
if (!automaticInset && (self.edgesForExtendedLayout & UIRectEdgeTop)) {
|
||||
|
||||
@ -190,13 +190,9 @@ open class ThreeLayerTableViewController: MFProgrammaticTableViewController {
|
||||
footerView.topAnchor.constraint(equalTo: tableView.bottomAnchor).isActive = true
|
||||
footerView.leftAnchor.constraint(equalTo: view.leftAnchor).isActive = true
|
||||
view.rightAnchor.constraint(equalTo: footerView.rightAnchor).isActive = true
|
||||
if #available(iOS 11.0, *) {
|
||||
view.safeAreaLayoutGuide.bottomAnchor.constraint(equalTo: footerView.bottomAnchor).isActive = true
|
||||
safeAreaView = MVMCoreUICommonViewsUtility.getAndSetupSafeAreaView(on: view)
|
||||
safeAreaView?.backgroundColor = bottomView?.backgroundColor
|
||||
} else {
|
||||
view.bottomAnchor.constraint(equalTo: footerView.bottomAnchor).isActive = true
|
||||
}
|
||||
view.safeAreaLayoutGuide.bottomAnchor.constraint(equalTo: footerView.bottomAnchor).isActive = true
|
||||
safeAreaView = MVMCoreUICommonViewsUtility.getAndSetupSafeAreaView(on: view)
|
||||
safeAreaView?.backgroundColor = bottomView?.backgroundColor
|
||||
} else {
|
||||
bottomConstraint?.isActive = true
|
||||
var y: CGFloat?
|
||||
|
||||
@ -45,7 +45,7 @@ open class ThreeLayerViewController: ProgrammaticScrollViewController {
|
||||
return
|
||||
}
|
||||
|
||||
if #available(iOS 11.0, *), scrollView.contentInsetAdjustmentBehavior == UIScrollView.ContentInsetAdjustmentBehavior.automatic {
|
||||
if scrollView.contentInsetAdjustmentBehavior == UIScrollView.ContentInsetAdjustmentBehavior.automatic {
|
||||
heightConstraint?.constant = -scrollView.adjustedContentInset.top - scrollView.adjustedContentInset.bottom
|
||||
} else {
|
||||
heightConstraint?.constant = -scrollView.contentInset.top - scrollView.contentInset.bottom
|
||||
@ -233,14 +233,10 @@ extension ThreeLayerViewController {
|
||||
view.topAnchor.constraint(equalTo: scrollView.bottomAnchor).isActive = true
|
||||
NSLayoutConstraint.pinViewLeft(toSuperview: view, useMargins: useMargins, constant: 0).isActive = true
|
||||
NSLayoutConstraint.pinViewRight(toSuperview: view, useMargins: useMargins, constant: 0).isActive = true
|
||||
if #available(iOS 11.0, *) {
|
||||
parentView.safeAreaLayoutGuide.bottomAnchor.constraint(equalTo: view.bottomAnchor).isActive = true
|
||||
if let safeAreaView = MVMCoreUICommonViewsUtility.getAndSetupSafeAreaView(on: parentView) {
|
||||
safeAreaView.backgroundColor = bottomView?.backgroundColor
|
||||
self.safeAreaView = safeAreaView
|
||||
}
|
||||
} else {
|
||||
NSLayoutConstraint.pinViewBottom(toSuperview: view, useMargins: useMargins, constant: 0).isActive = true
|
||||
parentView.safeAreaLayoutGuide.bottomAnchor.constraint(equalTo: view.bottomAnchor).isActive = true
|
||||
if let safeAreaView = MVMCoreUICommonViewsUtility.getAndSetupSafeAreaView(on: parentView) {
|
||||
safeAreaView.backgroundColor = bottomView?.backgroundColor
|
||||
self.safeAreaView = safeAreaView
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -283,16 +283,6 @@
|
||||
|
||||
// So we will update titles.
|
||||
[self newDataBuildScreen];
|
||||
|
||||
// Fix for right bar button item with custom view which disappears when user navigates to top tabbar page controller
|
||||
if (@available(iOS 11.0, *)) {
|
||||
} else {
|
||||
NSMutableArray *buttonItems = [[NSMutableArray alloc] init];
|
||||
UIBarButtonItem *space = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:self action:nil];
|
||||
[buttonItems addObject:space];
|
||||
[buttonItems addObjectsFromArray:self.navigationItem.rightBarButtonItems];
|
||||
self.navigationItem.rightBarButtonItems = buttonItems;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)viewWillDisappear:(BOOL)animated {
|
||||
|
||||
@ -325,19 +325,13 @@
|
||||
NSLayoutConstraint *bottomViewTop = [NSLayoutConstraint constraintWithItem:footerView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:tableView attribute:NSLayoutAttributeBottom multiplier:1 constant:0];
|
||||
bottomViewTop.active = YES;
|
||||
|
||||
NSLayoutConstraint *bottomViewBot = nil;
|
||||
if (@available(iOS 11.0, *)) {
|
||||
bottomViewBot = [self.view.safeAreaLayoutGuide.bottomAnchor constraintEqualToAnchor:footerView.bottomAnchor];
|
||||
|
||||
UIView *safeAreaView = [MVMCoreUICommonViewsUtility getAndSetupSafeAreaViewOnView:self.view];
|
||||
safeAreaView.backgroundColor = footerView.backgroundColor;
|
||||
self.safeAreaView = safeAreaView;
|
||||
} else {
|
||||
// Fallback on earlier versions
|
||||
bottomViewBot = [NSLayoutConstraint constraintWithItem:self.view attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:footerView attribute:NSLayoutAttributeBottom multiplier:1 constant:0];
|
||||
}
|
||||
bottomViewBot.priority = 900;
|
||||
bottomViewBot.active = YES;
|
||||
NSLayoutConstraint *bottomViewBot = [self.view.safeAreaLayoutGuide.bottomAnchor constraintEqualToAnchor:footerView.bottomAnchor];
|
||||
bottomViewBot.priority = 900;
|
||||
bottomViewBot.active = YES;
|
||||
|
||||
UIView *safeAreaView = [MVMCoreUICommonViewsUtility getAndSetupSafeAreaViewOnView:self.view];
|
||||
safeAreaView.backgroundColor = footerView.backgroundColor;
|
||||
self.safeAreaView = safeAreaView;
|
||||
|
||||
[NSLayoutConstraint activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-0-[footerView]-0@900-|" options:NSLayoutFormatDirectionLeadingToTrailing metrics:nil views:NSDictionaryOfVariableBindings(footerView)]];
|
||||
} else {
|
||||
|
||||
@ -272,13 +272,8 @@
|
||||
- (void)updateViewConstraints {
|
||||
[super updateViewConstraints];
|
||||
|
||||
// Updates for ios 11
|
||||
if (@available(iOS 11.0, *)) {
|
||||
if (self.scrollView.contentInsetAdjustmentBehavior == UIScrollViewContentInsetAdjustmentAutomatic) {
|
||||
self.heightConstraint.constant = -self.scrollView.adjustedContentInset.top - self.scrollView.adjustedContentInset.bottom;
|
||||
} else {
|
||||
self.heightConstraint.constant = -self.scrollView.contentInset.top - self.scrollView.contentInset.bottom;
|
||||
}
|
||||
if (self.scrollView.contentInsetAdjustmentBehavior == UIScrollViewContentInsetAdjustmentAutomatic) {
|
||||
self.heightConstraint.constant = -self.scrollView.adjustedContentInset.top - self.scrollView.adjustedContentInset.bottom;
|
||||
} else {
|
||||
self.heightConstraint.constant = -self.scrollView.contentInset.top - self.scrollView.contentInset.bottom;
|
||||
}
|
||||
@ -322,17 +317,13 @@
|
||||
[self.view addSubview:bottomView];
|
||||
|
||||
UIScrollView *scrollview = self.scrollView;
|
||||
if (@available(iOS 11.0, *)) {
|
||||
[NSLayoutConstraint activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[scrollview]-0-[bottomView]" options:NSLayoutFormatDirectionLeadingToTrailing metrics:nil views:NSDictionaryOfVariableBindings(scrollview,bottomView)]];
|
||||
[self.view.safeAreaLayoutGuide.bottomAnchor constraintEqualToAnchor:bottomView.bottomAnchor].active = YES;
|
||||
|
||||
UIView *safeAreaView = [MVMCoreUICommonViewsUtility getAndSetupSafeAreaViewOnView:self.view];
|
||||
safeAreaView.backgroundColor = bottomView.backgroundColor;
|
||||
self.safeAreaView = safeAreaView;
|
||||
} else {
|
||||
// Fallback on earlier versions
|
||||
[NSLayoutConstraint activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[scrollview]-0-[bottomView]-0-|" options:NSLayoutFormatDirectionLeadingToTrailing metrics:nil views:NSDictionaryOfVariableBindings(scrollview,bottomView)]];
|
||||
}
|
||||
[NSLayoutConstraint activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:[scrollview]-0-[bottomView]" options:NSLayoutFormatDirectionLeadingToTrailing metrics:nil views:NSDictionaryOfVariableBindings(scrollview,bottomView)]];
|
||||
[self.view.safeAreaLayoutGuide.bottomAnchor constraintEqualToAnchor:bottomView.bottomAnchor].active = YES;
|
||||
|
||||
UIView *safeAreaView = [MVMCoreUICommonViewsUtility getAndSetupSafeAreaViewOnView:self.view];
|
||||
safeAreaView.backgroundColor = bottomView.backgroundColor;
|
||||
self.safeAreaView = safeAreaView;
|
||||
|
||||
[NSLayoutConstraint activateConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-0-[bottomView]-0@900-|" options:NSLayoutFormatDirectionLeadingToTrailing metrics:nil views:NSDictionaryOfVariableBindings(bottomView)]];
|
||||
}
|
||||
|
||||
|
||||
@ -37,11 +37,9 @@ open class MoleculeCollectionViewCell: UICollectionViewCell, MVMCoreUIMoleculeVi
|
||||
}
|
||||
isAccessibilityElement = false
|
||||
contentView.isAccessibilityElement = false
|
||||
if #available(iOS 11.0, *) {
|
||||
insetsLayoutMarginsFromSafeArea = false
|
||||
contentView.insetsLayoutMarginsFromSafeArea = false
|
||||
contentView.preservesSuperviewLayoutMargins = false
|
||||
}
|
||||
insetsLayoutMarginsFromSafeArea = false
|
||||
contentView.insetsLayoutMarginsFromSafeArea = false
|
||||
contentView.preservesSuperviewLayoutMargins = false
|
||||
|
||||
// Covers the card when peaking.
|
||||
peakingCover.backgroundColor = .white
|
||||
|
||||
@ -87,29 +87,16 @@ import UIKit
|
||||
// MARK: - MFViewProtocol
|
||||
public func updateView(_ size: CGFloat) {
|
||||
MFStyler.setMarginsFor(self, size: size, defaultHorizontal: updateViewHorizontalDefaults, top: topMarginPadding, bottom: bottomMarginPadding)
|
||||
if #available(iOS 11.0, *) {
|
||||
if accessoryView != nil {
|
||||
// Smaller left margin if accessory view.
|
||||
var margin = directionalLayoutMargins
|
||||
margin.trailing = 16
|
||||
contentView.directionalLayoutMargins = margin
|
||||
} else {
|
||||
contentView.directionalLayoutMargins = directionalLayoutMargins
|
||||
}
|
||||
topSeparatorView?.setLeftAndRightPinConstant(directionalLayoutMargins.leading)
|
||||
bottomSeparatorView?.setLeftAndRightPinConstant(directionalLayoutMargins.leading)
|
||||
if accessoryView != nil {
|
||||
// Smaller left margin if accessory view.
|
||||
var margin = directionalLayoutMargins
|
||||
margin.trailing = 16
|
||||
contentView.directionalLayoutMargins = margin
|
||||
} else {
|
||||
if accessoryView != nil {
|
||||
// Smaller left margin if accessory view.
|
||||
var margin = layoutMargins
|
||||
margin.right = 16
|
||||
contentView.layoutMargins = margin
|
||||
} else {
|
||||
contentView.layoutMargins = layoutMargins
|
||||
}
|
||||
topSeparatorView?.setLeftAndRightPinConstant(layoutMargins.left)
|
||||
bottomSeparatorView?.setLeftAndRightPinConstant(layoutMargins.left)
|
||||
contentView.directionalLayoutMargins = directionalLayoutMargins
|
||||
}
|
||||
topSeparatorView?.setLeftAndRightPinConstant(directionalLayoutMargins.leading)
|
||||
bottomSeparatorView?.setLeftAndRightPinConstant(directionalLayoutMargins.leading)
|
||||
|
||||
molecule?.updateView(size)
|
||||
if let _ = accessoryView, let caretView = caretView, let widthObject = caretViewWidthSizeObject, let heightObject = caretViewHeightSizeObject {
|
||||
@ -121,11 +108,9 @@ import UIKit
|
||||
|
||||
public func setupView() {
|
||||
selectionStyle = .none
|
||||
if #available(iOS 11.0, *) {
|
||||
insetsLayoutMarginsFromSafeArea = false
|
||||
contentView.insetsLayoutMarginsFromSafeArea = false
|
||||
contentView.preservesSuperviewLayoutMargins = false
|
||||
}
|
||||
insetsLayoutMarginsFromSafeArea = false
|
||||
contentView.insetsLayoutMarginsFromSafeArea = false
|
||||
contentView.preservesSuperviewLayoutMargins = false
|
||||
}
|
||||
|
||||
// MARK: - MVMCoreUIMoleculeViewProtocol
|
||||
|
||||
@ -198,13 +198,8 @@ static const CGFloat VertialShadowOffset = 6;
|
||||
[view.rightAnchor constraintEqualToAnchor:button.rightAnchor constant:PaddingTwo].active = YES;
|
||||
[view.centerYAnchor constraintEqualToAnchor:button.centerYAnchor].active = YES;
|
||||
} else {
|
||||
if (@available(iOS 11.0, *)) {
|
||||
[button.topAnchor constraintEqualToAnchor:view.safeAreaLayoutGuide.topAnchor constant:PaddingOne].active = YES;
|
||||
[view.safeAreaLayoutGuide.trailingAnchor constraintEqualToAnchor:button.trailingAnchor constant:PaddingTwo].active = YES;
|
||||
} else {
|
||||
[NSLayoutConstraint constraintPinSubview:button pinTop:YES topConstant:PaddingOne pinBottom:NO bottomConstant:0 pinLeft:NO leftConstant:0 pinRight:YES rightConstant:PaddingTwo];
|
||||
}
|
||||
|
||||
[button.topAnchor constraintEqualToAnchor:view.safeAreaLayoutGuide.topAnchor constant:PaddingOne].active = YES;
|
||||
[view.safeAreaLayoutGuide.trailingAnchor constraintEqualToAnchor:button.trailingAnchor constant:PaddingTwo].active = YES;
|
||||
}
|
||||
}
|
||||
return button;
|
||||
@ -249,16 +244,12 @@ static const CGFloat VertialShadowOffset = 6;
|
||||
}
|
||||
|
||||
+ (nullable UIView *)getAndSetupSafeAreaViewOnView:(nonnull UIView *)view {
|
||||
if (@available(iOS 11.0, *)) {
|
||||
UIView *safeAreaView = [MVMCoreUICommonViewsUtility commonView];
|
||||
[view addSubview:safeAreaView];
|
||||
[safeAreaView.topAnchor constraintEqualToAnchor:view.safeAreaLayoutGuide.bottomAnchor].active = YES;
|
||||
[view.bottomAnchor constraintEqualToAnchor:safeAreaView.bottomAnchor].active = YES;
|
||||
[NSLayoutConstraint constraintPinSubview:safeAreaView pinTop:NO topConstant:0 pinBottom:NO bottomConstant:0 pinLeft:YES leftConstant:0 pinRight:YES rightConstant:0];
|
||||
return safeAreaView;
|
||||
} else {
|
||||
return nil;
|
||||
}
|
||||
UIView *safeAreaView = [MVMCoreUICommonViewsUtility commonView];
|
||||
[view addSubview:safeAreaView];
|
||||
[safeAreaView.topAnchor constraintEqualToAnchor:view.safeAreaLayoutGuide.bottomAnchor].active = YES;
|
||||
[view.bottomAnchor constraintEqualToAnchor:safeAreaView.bottomAnchor].active = YES;
|
||||
[NSLayoutConstraint constraintPinSubview:safeAreaView pinTop:NO topConstant:0 pinBottom:NO bottomConstant:0 pinLeft:YES leftConstant:0 pinRight:YES rightConstant:0];
|
||||
return safeAreaView;
|
||||
}
|
||||
|
||||
#pragma mark - shadows
|
||||
|
||||
@ -58,21 +58,13 @@
|
||||
}
|
||||
|
||||
+ (UIEdgeInsets)getMarginsForView:(nullable UIView *)view {
|
||||
if (@available(iOS 11.0, *)) {
|
||||
return UIEdgeInsetsMake(view.directionalLayoutMargins.top, view.directionalLayoutMargins.leading, view.directionalLayoutMargins.bottom, view.directionalLayoutMargins.trailing);
|
||||
} else {
|
||||
return view.layoutMargins;
|
||||
}
|
||||
return UIEdgeInsetsMake(view.directionalLayoutMargins.top, view.directionalLayoutMargins.leading, view.directionalLayoutMargins.bottom, view.directionalLayoutMargins.trailing)
|
||||
}
|
||||
|
||||
#pragma mark - Setters
|
||||
|
||||
+ (void)setMarginsForView:(nullable UIView *)view leading:(CGFloat)leading top:(CGFloat)top trailing:(CGFloat)trailing bottom:(CGFloat)bottom {
|
||||
if (@available(iOS 11.0, *)) {
|
||||
view.directionalLayoutMargins = NSDirectionalEdgeInsetsMake(top, leading, bottom, trailing);
|
||||
} else {
|
||||
view.layoutMargins = UIEdgeInsetsMake(top, leading, bottom, trailing);
|
||||
}
|
||||
view.directionalLayoutMargins = NSDirectionalEdgeInsetsMake(top, leading, bottom, trailing);
|
||||
}
|
||||
|
||||
#pragma mark - Formatting
|
||||
@ -152,12 +144,9 @@
|
||||
CGFloat topInset = scrollview.contentInset.top;
|
||||
CGFloat bottomInset = scrollview.contentInset.bottom;
|
||||
|
||||
// Updates for ios 11
|
||||
if (@available(iOS 11.0, *)) {
|
||||
if (scrollview.contentInsetAdjustmentBehavior == UIScrollViewContentInsetAdjustmentAutomatic) {
|
||||
topInset = scrollview.adjustedContentInset.top;
|
||||
bottomInset = scrollview.adjustedContentInset.bottom;
|
||||
}
|
||||
if (scrollview.contentInsetAdjustmentBehavior == UIScrollViewContentInsetAdjustmentAutomatic) {
|
||||
topInset = scrollview.adjustedContentInset.top;
|
||||
bottomInset = scrollview.adjustedContentInset.bottom;
|
||||
}
|
||||
|
||||
CGFloat remainingSpace = frameHeight - contentSizeHeight - topInset - bottomInset;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user