Skip to content

Commit

Permalink
Remove iOS 11 conditionals
Browse files Browse the repository at this point in the history
  • Loading branch information
dnicolson authored and JoeMatt committed Sep 6, 2021
1 parent 1319d9c commit 3f108dc
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 62 deletions.
14 changes: 3 additions & 11 deletions Provenance/Emulator/PVEmulatorViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -357,12 +357,8 @@ final class PVEmulatorViewController: PVEmulatorViewControllerRootClass, PVAudio
// Notifies UIKit that your view controller updated its preference regarding the visual indicator

#if os(iOS)
if #available(iOS 11.0, *) {
setNeedsUpdateOfHomeIndicatorAutoHidden()
}
#endif
setNeedsUpdateOfHomeIndicatorAutoHidden()

#if os(iOS)
// Ignore Smart Invert
view.ignoresInvertColors = true
#endif
Expand Down Expand Up @@ -680,19 +676,15 @@ extension PVEmulatorViewController {
// In instances where the controller is connected *after* the VC has been shown, we need to set the pause handler
controller?.setupPauseHandler(onPause: controllerPauseButtonPressed)
#if os(iOS)
if #available(iOS 11.0, *) {
setNeedsUpdateOfHomeIndicatorAutoHidden()
}
setNeedsUpdateOfHomeIndicatorAutoHidden()
#endif
}
}

@objc func controllerDidDisconnect(_: Notification?) {
menuButton?.isHidden = false
#if os(iOS)
if #available(iOS 11.0, *) {
setNeedsUpdateOfHomeIndicatorAutoHidden()
}
setNeedsUpdateOfHomeIndicatorAutoHidden()
#endif
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -434,19 +434,15 @@ final class PVGameLibraryViewController: UIViewController, UITextFieldDelegate,
// Can remove this when we go iOS 9+ and just use safe areas
// in the story board directly - jm
#if os(iOS)
if #available(iOS 11.0, *) {
collectionView.translatesAutoresizingMaskIntoConstraints = false
let guide = view.safeAreaLayoutGuide
NSLayoutConstraint.activate([
collectionView.trailingAnchor.constraint(equalTo: guide.trailingAnchor),
collectionView.leadingAnchor.constraint(equalTo: guide.leadingAnchor),
collectionView.topAnchor.constraint(equalTo: view.topAnchor),
collectionView.bottomAnchor.constraint(equalTo: view.bottomAnchor)
])
layout.sectionInsetReference = .fromSafeArea
} else {
layout.sectionInset = UIEdgeInsets(top: 20, left: 0, bottom: 0, right: 0)
}
collectionView.translatesAutoresizingMaskIntoConstraints = false
let guide = view.safeAreaLayoutGuide
NSLayoutConstraint.activate([
collectionView.trailingAnchor.constraint(equalTo: guide.trailingAnchor),
collectionView.leadingAnchor.constraint(equalTo: guide.leadingAnchor),
collectionView.topAnchor.constraint(equalTo: view.topAnchor),
collectionView.bottomAnchor.constraint(equalTo: view.bottomAnchor)
])
layout.sectionInsetReference = .fromSafeArea
#endif
// Force touch
#if os(iOS)
Expand Down Expand Up @@ -717,19 +713,9 @@ final class PVGameLibraryViewController: UIViewController, UITextFieldDelegate,
// let documentMenu = UIDocumentMenuViewController(documentTypes: extensions, in: .import)
// documentMenu.delegate = self
// present(documentMenu, animated: true, completion: nil)
if #available(iOS 11.0, *) {
// iOS 8 need iCloud entitlements, check
} else {
if FileManager.default.ubiquityIdentityToken == nil {
self.presentMessage("Your version reqires iCloud entitlements to use this feature. Please rebuild with iCloud entitlements enabled.", title: "iCloud Error")
return
}
}

let documentPicker = PVDocumentPickerViewController(documentTypes: extensions, in: .import)
if #available(iOS 11.0, *) {
documentPicker.allowsMultipleSelection = true
}
documentPicker.allowsMultipleSelection = true
documentPicker.delegate = self
self.present(documentPicker, animated: true, completion: nil)
}))
Expand Down
30 changes: 10 additions & 20 deletions Provenance/Game Library/UI/PVGameMoreInfoViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -190,17 +190,12 @@ final class GameMoreInfoPageViewController: UIPageViewController, UIPageViewCont
@IBAction func moreInfoButtonClicked(_: UIBarButtonItem) {
#if os(iOS)
if let urlString = game?.referenceURL, let url = URL(string: urlString) {
if #available(iOS 11.0, *) {
let config = SFSafariViewController.Configuration()
config.barCollapsingEnabled = true
config.entersReaderIfAvailable = true
let config = SFSafariViewController.Configuration()
config.barCollapsingEnabled = true
config.entersReaderIfAvailable = true

let webVC = SFSafariViewController(url: url, configuration: config)
present(webVC, animated: true, completion: nil)
} else {
let webVC = SFSafariViewController(url: url, entersReaderIfAvailable: true)
present(webVC, animated: true, completion: nil)
}
let webVC = SFSafariViewController(url: url, configuration: config)
present(webVC, animated: true, completion: nil)
}
#endif
}
Expand Down Expand Up @@ -458,17 +453,12 @@ final class PVGameMoreInfoViewController: UIViewController, GameLaunchingViewCon

@IBAction func moreInfoButtonClicked(_: UIBarButtonItem) {
if let urlString = game?.referenceURL, let url = URL(string: urlString) {
if #available(iOS 11.0, *) {
let config = SFSafariViewController.Configuration()
config.barCollapsingEnabled = true
config.entersReaderIfAvailable = true
let config = SFSafariViewController.Configuration()
config.barCollapsingEnabled = true
config.entersReaderIfAvailable = true

let webVC = SFSafariViewController(url: url, configuration: config)
present(webVC, animated: true, completion: nil)
} else {
let webVC = SFSafariViewController(url: url, entersReaderIfAvailable: true)
present(webVC, animated: true, completion: nil)
}
let webVC = SFSafariViewController(url: url, configuration: config)
present(webVC, animated: true, completion: nil)
}
}
#endif
Expand Down
9 changes: 2 additions & 7 deletions Provenance/User Interface/Themes/UIView+Theming.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,10 @@ import Foundation
public extension UIView {
@IBInspectable var ignoresInvertColors: Bool {
get {
if #available(iOS 11.0, *) {
return accessibilityIgnoresInvertColors
}
return false
return accessibilityIgnoresInvertColors
}
set {
if #available(iOS 11.0, *) {
accessibilityIgnoresInvertColors = newValue
}
accessibilityIgnoresInvertColors = newValue
}
}
}

0 comments on commit 3f108dc

Please sign in to comment.