Remove some no-longer-needed #available checks.
This commit is contained in:
parent
22f3fb62f8
commit
565b3ac2c3
@ -191,15 +191,16 @@ private extension FeedTableViewCell {
|
||||
}
|
||||
|
||||
func addDisclosureView() {
|
||||
|
||||
disclosureButton = NonIntrinsicButton(type: .roundedRect)
|
||||
|
||||
disclosureButton!.addTarget(self, action: #selector(buttonPressed(_:)), for: UIControl.Event.touchUpInside)
|
||||
disclosureButton?.setImage(AppAssets.disclosureImage, for: .normal)
|
||||
disclosureButton?.tintColor = AppAssets.controlBackgroundColor
|
||||
disclosureButton?.imageView?.contentMode = .center
|
||||
disclosureButton?.imageView?.clipsToBounds = false
|
||||
if #available(iOS 13.4, *) {
|
||||
disclosureButton?.addInteraction(UIPointerInteraction())
|
||||
}
|
||||
disclosureButton?.addInteraction(UIPointerInteraction())
|
||||
|
||||
addSubviewAtInit(disclosureButton!)
|
||||
}
|
||||
|
||||
|
@ -84,14 +84,15 @@ class FeedTableViewSectionHeader: UITableViewHeaderFooterView {
|
||||
private let unreadCountView = FeedUnreadCountView(frame: CGRect.zero)
|
||||
|
||||
private lazy var disclosureButton: UIButton = {
|
||||
|
||||
let button = NonIntrinsicButton()
|
||||
|
||||
button.tintColor = UIColor.tertiaryLabel
|
||||
button.setImage(AppAssets.disclosureImage, for: .normal)
|
||||
button.contentMode = .center
|
||||
if #available(iOS 13.4, *) {
|
||||
button.addInteraction(UIPointerInteraction())
|
||||
}
|
||||
button.addInteraction(UIPointerInteraction())
|
||||
button.addTarget(self, action: #selector(toggleDisclosure), for: .touchUpInside)
|
||||
|
||||
return button
|
||||
}()
|
||||
|
||||
|
@ -19,11 +19,7 @@ class FeedsViewController: UITableViewController, UndoableCommandRunner {
|
||||
private var refreshProgressView: RefreshProgressView?
|
||||
@IBOutlet weak var addNewItemButton: UIBarButtonItem! {
|
||||
didSet {
|
||||
if #available(iOS 14, *) {
|
||||
addNewItemButton.primaryAction = nil
|
||||
} else {
|
||||
addNewItemButton.action = #selector(FeedsViewController.add(_:))
|
||||
}
|
||||
addNewItemButton.primaryAction = nil
|
||||
}
|
||||
}
|
||||
|
||||
@ -428,40 +424,6 @@ class FeedsViewController: UITableViewController, UndoableCommandRunner {
|
||||
coordinator.toggleReadFeedsFilter()
|
||||
}
|
||||
|
||||
@IBAction func add(_ sender: UIBarButtonItem) {
|
||||
|
||||
if #available(iOS 14, *) {
|
||||
|
||||
} else {
|
||||
let title = NSLocalizedString("Add Item", comment: "Add Item")
|
||||
let alertController = UIAlertController(title: title, message: nil, preferredStyle: .actionSheet)
|
||||
|
||||
let cancelTitle = NSLocalizedString("Cancel", comment: "Cancel")
|
||||
let cancelAction = UIAlertAction(title: cancelTitle, style: .cancel)
|
||||
|
||||
let addFeedActionTitle = NSLocalizedString("Add Web Feed", comment: "Add Web Feed")
|
||||
let addFeedAction = UIAlertAction(title: addFeedActionTitle, style: .default) { _ in
|
||||
self.coordinator.showAddFeed()
|
||||
}
|
||||
|
||||
let addFolderActionTitle = NSLocalizedString("Add Folder", comment: "Add Folder")
|
||||
let addFolderAction = UIAlertAction(title: addFolderActionTitle, style: .default) { _ in
|
||||
self.coordinator.showAddFolder()
|
||||
}
|
||||
|
||||
alertController.addAction(addFeedAction)
|
||||
|
||||
alertController.addAction(addFolderAction)
|
||||
alertController.addAction(cancelAction)
|
||||
|
||||
alertController.popoverPresentationController?.barButtonItem = sender
|
||||
|
||||
present(alertController, animated: true)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@objc func toggleSectionHeader(_ sender: UITapGestureRecognizer) {
|
||||
guard let headerView = sender.view as? FeedTableViewSectionHeader else {
|
||||
return
|
||||
@ -622,35 +584,32 @@ class FeedsViewController: UITableViewController, UndoableCommandRunner {
|
||||
configureContextMenu()
|
||||
}
|
||||
|
||||
@objc
|
||||
func configureContextMenu(_: Any? = nil) {
|
||||
if #available(iOS 14.0, *) {
|
||||
@objc func configureContextMenu(_: Any? = nil) {
|
||||
|
||||
/*
|
||||
Context Menu Order:
|
||||
1. Add Web Feed
|
||||
2. Add Folder
|
||||
*/
|
||||
/*
|
||||
Context Menu Order:
|
||||
1. Add Web Feed
|
||||
2. Add Folder
|
||||
*/
|
||||
|
||||
var menuItems: [UIAction] = []
|
||||
var menuItems: [UIAction] = []
|
||||
|
||||
let addFeedActionTitle = NSLocalizedString("Add Web Feed", comment: "Add Web Feed")
|
||||
let addFeedAction = UIAction(title: addFeedActionTitle, image: AppAssets.plus) { _ in
|
||||
self.coordinator.showAddFeed()
|
||||
}
|
||||
menuItems.append(addFeedAction)
|
||||
|
||||
let addFolderActionTitle = NSLocalizedString("Add Folder", comment: "Add Folder")
|
||||
let addFolderAction = UIAction(title: addFolderActionTitle, image: AppAssets.folderOutlinePlus) { _ in
|
||||
self.coordinator.showAddFolder()
|
||||
}
|
||||
|
||||
menuItems.append(addFolderAction)
|
||||
|
||||
let contextMenu = UIMenu(title: NSLocalizedString("Add Item", comment: "Add Item"), image: nil, identifier: nil, options: [], children: menuItems.reversed())
|
||||
|
||||
self.addNewItemButton.menu = contextMenu
|
||||
let addFeedActionTitle = NSLocalizedString("Add Web Feed", comment: "Add Web Feed")
|
||||
let addFeedAction = UIAction(title: addFeedActionTitle, image: AppAssets.plus) { _ in
|
||||
self.coordinator.showAddFeed()
|
||||
}
|
||||
menuItems.append(addFeedAction)
|
||||
|
||||
let addFolderActionTitle = NSLocalizedString("Add Folder", comment: "Add Folder")
|
||||
let addFolderAction = UIAction(title: addFolderActionTitle, image: AppAssets.folderOutlinePlus) { _ in
|
||||
self.coordinator.showAddFolder()
|
||||
}
|
||||
|
||||
menuItems.append(addFolderAction)
|
||||
|
||||
let contextMenu = UIMenu(title: NSLocalizedString("Add Item", comment: "Add Item"), image: nil, identifier: nil, options: [], children: menuItems.reversed())
|
||||
|
||||
self.addNewItemButton.menu = contextMenu
|
||||
}
|
||||
|
||||
func focus() {
|
||||
|
@ -34,19 +34,14 @@ class TimelineTitleView: UIView {
|
||||
func buttonize() {
|
||||
heightAnchor.constraint(equalToConstant: 40.0).isActive = true
|
||||
accessibilityTraits = .button
|
||||
if #available(iOS 13.4, *) {
|
||||
addInteraction(pointerInteraction)
|
||||
}
|
||||
addInteraction(pointerInteraction)
|
||||
}
|
||||
|
||||
func debuttonize() {
|
||||
heightAnchor.constraint(equalToConstant: 40.0).isActive = true
|
||||
accessibilityTraits.remove(.button)
|
||||
if #available(iOS 13.4, *) {
|
||||
removeInteraction(pointerInteraction)
|
||||
}
|
||||
removeInteraction(pointerInteraction)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extension TimelineTitleView: UIPointerInteractionDelegate {
|
||||
@ -58,5 +53,4 @@ extension TimelineTitleView: UIPointerInteractionDelegate {
|
||||
|
||||
return UIPointerStyle(effect: .automatic(UITargetedPreview(view: self)), shape: .roundedRect(rect))
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -101,13 +101,10 @@ class TimelineViewController: UITableViewController, UndoableCommandRunner {
|
||||
}
|
||||
|
||||
// Disable swipe back on iPad Mice
|
||||
if #available(iOS 13.4, *) {
|
||||
guard let gesture = self.navigationController?.interactivePopGestureRecognizer as? UIPanGestureRecognizer else {
|
||||
return
|
||||
}
|
||||
gesture.allowedScrollTypesMask = []
|
||||
guard let gesture = self.navigationController?.interactivePopGestureRecognizer as? UIPanGestureRecognizer else {
|
||||
return
|
||||
}
|
||||
|
||||
gesture.allowedScrollTypesMask = []
|
||||
}
|
||||
|
||||
override func viewWillAppear(_ animated: Bool) {
|
||||
@ -525,12 +522,7 @@ class TimelineViewController: UITableViewController, UndoableCommandRunner {
|
||||
}
|
||||
|
||||
@objc private func reloadAllVisibleCells() {
|
||||
if #available(iOS 15, *) {
|
||||
reconfigureCells(coordinator.articles)
|
||||
} else {
|
||||
let visibleArticles = tableView.indexPathsForVisibleRows!.compactMap { return dataSource.itemIdentifier(for: $0) }
|
||||
reloadCells(visibleArticles)
|
||||
}
|
||||
reconfigureCells(coordinator.articles)
|
||||
}
|
||||
|
||||
private func reloadCells(_ articles: [Article]) {
|
||||
@ -542,9 +534,10 @@ class TimelineViewController: UITableViewController, UndoableCommandRunner {
|
||||
}
|
||||
|
||||
private func reconfigureCells(_ articles: [Article]) {
|
||||
guard #available(iOS 15, *) else { return }
|
||||
|
||||
var snapshot = dataSource.snapshot()
|
||||
snapshot.reconfigureItems(articles)
|
||||
|
||||
dataSource.apply(snapshot, animatingDifferences: false) { [weak self] in
|
||||
self?.restoreSelectionIfNecessary(adjustScroll: false)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user