Skip to content

Commit

Permalink
Merge pull request #2553 from wikimedia/feature/drop_10
Browse files Browse the repository at this point in the history
Drop iOS 10
  • Loading branch information
joewalsh committed Aug 7, 2018
2 parents 7b6b911 + a28eb63 commit 9379af8
Show file tree
Hide file tree
Showing 154 changed files with 83 additions and 322 deletions.
Expand Up @@ -31,9 +31,7 @@ class WMFTodayContinueReadingWidgetViewController: UIViewController, NCWidgetPro
daysAgoLabel.textColor = theme.colors.overlayText
daysAgoView.backgroundColor = theme.colors.overlayBackground

if #available(iOSApplicationExtension 11.0, *) {
imageView.accessibilityIgnoresInvertColors = true
}
imageView.accessibilityIgnoresInvertColors = true

emptyDescriptionLabel.text = WMFLocalizedString("continue-reading-empty-title", value:"No recently read articles", comment: "No recently read articles")
emptyDescriptionLabel.text = WMFLocalizedString("continue-reading-empty-description", value:"Explore Wikipedia for more articles to read", comment: "Explore Wikipedia for more articles to read")
Expand Down
6 changes: 2 additions & 4 deletions WMF Framework/BatchEditToolbarViewController.swift
Expand Up @@ -21,10 +21,8 @@ public final class BatchEditToolbarViewController: UIViewController {
}

public override func didMove(toParentViewController parent: UIViewController?) {
if #available(iOS 11.0, *) {
if let parent = parent, let safeAreaOwningView = view.safeAreaLayoutGuide.owningView {
bottomConstraint.constant = max(0, parent.bottomLayoutGuide.length - safeAreaOwningView.frame.height)
}
if let parent = parent, let safeAreaOwningView = view.safeAreaLayoutGuide.owningView {
bottomConstraint.constant = max(0, parent.view.safeAreaInsets.bottom - safeAreaOwningView.frame.height)
}
}

Expand Down
7 changes: 1 addition & 6 deletions WMF Framework/ColumnarCollectionViewLayout.swift
Expand Up @@ -110,12 +110,7 @@ public class ColumnarCollectionViewLayout: UICollectionViewLayout {
return
}

let readableWidth: CGFloat
if #available(iOS 11.0, *) {
readableWidth = collectionView.readableContentGuide.layoutFrame.size.width
} else {
readableWidth = min(maxColumnWidth, collectionView.bounds.size.width - collectionView.layoutMargins.left - collectionView.layoutMargins.right)
}
let readableWidth: CGFloat = collectionView.readableContentGuide.layoutFrame.size.width

if let metrics = metrics, !metrics.readableWidth.isEqual(to: readableWidth) {
isLayoutValid = false
Expand Down
35 changes: 6 additions & 29 deletions WMF Framework/NavigationBar.swift
Expand Up @@ -49,16 +49,10 @@ public class NavigationBar: SetupView, FakeProgressReceiving, FakeProgressDelega
return _displayType
}
set {
let adjustedNewValue: NavigationBarDisplayType
if #available(iOS 11.0, *) {
adjustedNewValue = newValue
} else {
adjustedNewValue = .backVisible
}
guard adjustedNewValue != _displayType else {
guard newValue != _displayType else {
return
}
_displayType = adjustedNewValue
_displayType = newValue
isTitleShrinkingEnabled = _displayType == .largeTitle
updateTitleBarConstraints()
updateNavigationItems()
Expand Down Expand Up @@ -112,18 +106,12 @@ public class NavigationBar: SetupView, FakeProgressReceiving, FakeProgressDelega
titleBarItems.append(UIBarButtonItem(barButtonSystemItem: .flexibleSpace, target: nil, action: nil))

if let item = navigationItem.leftBarButtonItem {
var leftBarButtonItem = item
if #available(iOS 11.0, *) {
leftBarButtonItem = barButtonItem(from: item)
}
let leftBarButtonItem = barButtonItem(from: item)
titleBarItems.append(leftBarButtonItem)
}

if let item = navigationItem.rightBarButtonItem {
var rightBarButtonItem = item
if #available(iOS 11.0, *) {
rightBarButtonItem = barButtonItem(from: item)
}
let rightBarButtonItem = barButtonItem(from: item)
titleBarItems.append(rightBarButtonItem)
}
titleBar.setItems(titleBarItems, animated: false)
Expand Down Expand Up @@ -212,19 +200,8 @@ public class NavigationBar: SetupView, FakeProgressReceiving, FakeProgressDelega
let statusBarUnderlayTopConstraint = topAnchor.constraint(equalTo: statusBarUnderlay.topAnchor)
updatedConstraints.append(statusBarUnderlayTopConstraint)

var safeArea: UILayoutGuide?
if #available(iOS 11.0, *) {
safeArea = safeAreaLayoutGuide
}

if let safeArea = safeArea {
let statusBarUnderlayBottomConstraint = safeArea.topAnchor.constraint(equalTo: statusBarUnderlay.bottomAnchor)
updatedConstraints.append(statusBarUnderlayBottomConstraint)
} else {
let underlayHeightConstraint = statusBarUnderlay.heightAnchor.constraint(equalToConstant: 0)
statusBarHeightConstraint = underlayHeightConstraint
statusBarUnderlay.addConstraint(underlayHeightConstraint)
}
let statusBarUnderlayBottomConstraint = safeAreaLayoutGuide.topAnchor.constraint(equalTo: statusBarUnderlay.bottomAnchor)
updatedConstraints.append(statusBarUnderlayBottomConstraint)

let statusBarUnderlayLeadingConstraint = leadingAnchor.constraint(equalTo: statusBarUnderlay.leadingAnchor)
updatedConstraints.append(statusBarUnderlayLeadingConstraint)
Expand Down

0 comments on commit 9379af8

Please sign in to comment.