🔥 Removes unused #available checks

This commit is contained in:
Stuart Breckenridge
2025-06-20 19:48:15 +08:00
parent 00b8affe5f
commit cabaa32be5
14 changed files with 80 additions and 210 deletions

View File

@@ -29,6 +29,7 @@ class FolderTreeMenu {
}
let menuItem = NSMenuItem(title: account.nameForDisplay, action: nil, keyEquivalent: "")
menuItem.image = AppAssets.image(for: <#T##AccountType#>)
menuItem.representedObject = childNode.representedObject
if account.behaviors.contains(.disallowFeedInRootFolder) {

View File

@@ -120,19 +120,6 @@ final class DetailWebViewController: NSViewController {
view = webView
// Use the safe area layout guides if they are available.
if #available(OSX 11.0, *) {
// These constraints have been removed as they were unsatisfiable after removing NSBox.
} else {
let constraints = [
webView.topAnchor.constraint(equalTo: view.topAnchor),
webView.bottomAnchor.constraint(equalTo: view.bottomAnchor),
webView.leadingAnchor.constraint(equalTo: view.leadingAnchor),
webView.trailingAnchor.constraint(equalTo: view.trailingAnchor),
]
NSLayoutConstraint.activate(constraints)
}
// Hide the web view until the first reload (navigation) is complete (plus some delay) to avoid the awful white flash that happens on the initial display in dark mode.
// See bug #901.
webView.isHidden = true
@@ -346,9 +333,6 @@ private extension DetailWebViewController {
func fetchScrollInfo(_ completion: @escaping (ScrollInfo?) -> Void) {
var javascriptString = "var x = {contentHeight: document.body.scrollHeight, offsetY: document.body.scrollTop}; x"
if #available(macOS 10.15, *) {
javascriptString = "var x = {contentHeight: document.body.scrollHeight, offsetY: window.pageYOffset}; x"
}
webView.evaluateJavaScript(javascriptString) { (info, error) in
guard let info = info as? [String: Any] else {

View File

@@ -23,11 +23,7 @@ struct SidebarCellAppearance: Equatable {
textFieldFontSize = 11
case .large:
imageSize = CGSize(width: 22, height: 22)
if #available(macOS 11.0, *) {
textFieldFontSize = 15
} else {
textFieldFontSize = 13
}
textFieldFontSize = 15
default:
imageSize = CGSize(width: 19, height: 19)
textFieldFontSize = 13

View File

@@ -56,11 +56,7 @@ struct TimelineCellAppearance: Equatable {
self.showIcon = showIcon
if #available(macOS 11.0, *) {
cellPadding = NSEdgeInsets(top: 8.0, left: 4.0, bottom: 10.0, right: 4.0)
} else {
cellPadding = NSEdgeInsets(top: 8.0, left: 18.0, bottom: 10.0, right: 18.0)
}
cellPadding = NSEdgeInsets(top: 8.0, left: 4.0, bottom: 10.0, right: 4.0)
let margin = self.cellPadding.left + self.unreadCircleDimension + self.unreadCircleMarginRight
self.boxLeftMargin = margin

View File

@@ -59,21 +59,12 @@ class TimelineTableRowView : NSTableRowView {
separator!.wantsLayer = true
separator!.layer?.backgroundColor = AppAssets.timelineSeparatorColor.cgColor
addSubview(separator!)
if #available(macOS 11.0, *) {
NSLayoutConstraint.activate([
separator!.leadingAnchor.constraint(equalTo: cellView.leadingAnchor, constant: 20),
separator!.trailingAnchor.constraint(equalTo: cellView.trailingAnchor, constant: -4),
separator!.heightAnchor.constraint(equalToConstant: 1),
separator!.bottomAnchor.constraint(equalTo: bottomAnchor, constant: 0)
])
} else {
NSLayoutConstraint.activate([
separator!.leadingAnchor.constraint(equalTo: cellView.leadingAnchor, constant: 34),
separator!.trailingAnchor.constraint(equalTo: cellView.trailingAnchor, constant: -28),
separator!.heightAnchor.constraint(equalToConstant: 1),
separator!.bottomAnchor.constraint(equalTo: bottomAnchor, constant: 0)
])
}
NSLayoutConstraint.activate([
separator!.leadingAnchor.constraint(equalTo: cellView.leadingAnchor, constant: 20),
separator!.trailingAnchor.constraint(equalTo: cellView.trailingAnchor, constant: -4),
separator!.heightAnchor.constraint(equalToConstant: 1),
separator!.bottomAnchor.constraint(equalTo: bottomAnchor, constant: 0)
])
}
}

View File

@@ -208,9 +208,7 @@ final class TimelineViewController: NSViewController, UndoableCommandRunner, Unr
tableView.setDraggingSourceOperationMask(.copy, forLocal: false)
tableView.keyboardDelegate = keyboardDelegate
if #available(macOS 11.0, *) {
tableView.style = .inset
}
tableView.style = .inset
if !didRegisterForNotifications {
NotificationCenter.default.addObserver(self, selector: #selector(statusesDidChange(_:)), name: .StatusesDidChange, object: nil)