mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Fix lint issues.
This commit is contained in:
@@ -30,17 +30,12 @@ final class BuiltinSmartFeedInspectorViewController: NSViewController, Inspector
|
||||
var windowTitle: String = NSLocalizedString("Smart Feed Inspector", comment: "Smart Feed Inspector window title")
|
||||
|
||||
func canInspect(_ objects: [Any]) -> Bool {
|
||||
|
||||
guard let _ = singleSmartFeed(from: objects) else {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
singleSmartFeed(from: objects) != nil
|
||||
}
|
||||
|
||||
// MARK: NSViewController
|
||||
|
||||
override func viewDidLoad() {
|
||||
|
||||
updateUI()
|
||||
}
|
||||
}
|
||||
@@ -57,7 +52,6 @@ private extension BuiltinSmartFeedInspectorViewController {
|
||||
}
|
||||
|
||||
func updateSmartFeed() {
|
||||
|
||||
smartFeed = singleSmartFeed(from: objects)
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ typealias InspectorViewController = Inspector & NSViewController
|
||||
|
||||
final class InspectorWindowController: NSWindowController {
|
||||
|
||||
class var shouldOpenAtStartup: Bool {
|
||||
static var shouldOpenAtStartup: Bool {
|
||||
return UserDefaults.standard.bool(forKey: DefaultsKey.windowIsOpen)
|
||||
}
|
||||
|
||||
|
||||
@@ -272,9 +272,13 @@ class MainWindowController: NSWindowController, NSUserInterfaceValidations {
|
||||
guard let detailViewController = detailViewController else {
|
||||
return
|
||||
}
|
||||
detailViewController.canScrollDown { (canScroll) in
|
||||
detailViewController.canScrollDown { canScroll in
|
||||
NSCursor.setHiddenUntilMouseMoves(true)
|
||||
canScroll ? detailViewController.scrollPageDown(sender) : self.nextUnread(sender)
|
||||
if canScroll {
|
||||
detailViewController.scrollPageDown(sender)
|
||||
} else {
|
||||
self.nextUnread(sender)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -302,10 +302,7 @@ protocol SidebarDelegate: AnyObject {
|
||||
// MARK: - Navigation
|
||||
|
||||
func canGoToNextUnread(wrappingToTop wrapping: Bool = false) -> Bool {
|
||||
if let _ = nextSelectableRowWithUnreadArticle(wrappingToTop: wrapping) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
nextSelectableRowWithUnreadArticle(wrappingToTop: wrapping) != nil
|
||||
}
|
||||
|
||||
func goToNextUnread(wrappingToTop wrapping: Bool = false) {
|
||||
|
||||
@@ -38,7 +38,7 @@ extension Article: @retroactive PasteboardWriterOwner {
|
||||
func writableTypes(for pasteboard: NSPasteboard) -> [NSPasteboard.PasteboardType] {
|
||||
var types = [ArticlePasteboardWriter.articleUTIType]
|
||||
|
||||
if let _ = article.preferredURL {
|
||||
if article.preferredURL != nil {
|
||||
types += [.URL]
|
||||
}
|
||||
types += [.string, .html, ArticlePasteboardWriter.articleUTIInternalType]
|
||||
|
||||
@@ -65,7 +65,7 @@ struct TimelineCellAppearance: Equatable {
|
||||
|
||||
extension NSEdgeInsets: @retroactive Equatable {
|
||||
|
||||
public static func ==(lhs: NSEdgeInsets, rhs: NSEdgeInsets) -> Bool {
|
||||
public static func == (lhs: NSEdgeInsets, rhs: NSEdgeInsets) -> Bool {
|
||||
return lhs.left == rhs.left && lhs.top == rhs.top && lhs.right == rhs.right && lhs.bottom == rhs.bottom
|
||||
}
|
||||
}
|
||||
|
||||
@@ -299,7 +299,11 @@ private extension TimelineTableCellView {
|
||||
}
|
||||
|
||||
func showOrHideView(_ view: NSView, _ shouldHide: Bool) {
|
||||
shouldHide ? hideView(view) : showView(view)
|
||||
if shouldHide {
|
||||
hideView(view)
|
||||
} else {
|
||||
showView(view)
|
||||
}
|
||||
}
|
||||
|
||||
func updateSubviews() {
|
||||
|
||||
@@ -107,7 +107,7 @@ final class TimelineContainerViewController: NSViewController {
|
||||
return false
|
||||
}
|
||||
for object in representedObjects {
|
||||
guard let _ = currentObjects.firstIndex(where: { $0 === object }) else {
|
||||
guard currentObjects.firstIndex(where: { $0 === object }) != nil else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -557,10 +557,7 @@ final class TimelineViewController: NSViewController, UndoableCommandRunner, Unr
|
||||
}
|
||||
|
||||
func canGoToNextUnread(wrappingToTop wrapping: Bool = false) -> Bool {
|
||||
guard let _ = indexOfNextUnreadArticle(wrappingToTop: wrapping) else {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
indexOfNextUnreadArticle(wrappingToTop: wrapping) != nil
|
||||
}
|
||||
|
||||
func indexOfNextUnreadArticle(wrappingToTop wrapping: Bool = false) -> Int? {
|
||||
@@ -913,25 +910,25 @@ extension TimelineViewController: NSTableViewDelegate {
|
||||
}
|
||||
|
||||
switch edge {
|
||||
case .leading:
|
||||
let action = NSTableViewRowAction(style: .regular, title: article.status.read ? "Unread" : "Read") { (_, _) in
|
||||
self.toggleArticleRead(article)
|
||||
tableView.rowActionsVisible = false
|
||||
}
|
||||
action.image = article.status.read ? AppAssets.swipeMarkUnreadImage : AppAssets.swipeMarkReadImage
|
||||
return [action]
|
||||
case .leading:
|
||||
let action = NSTableViewRowAction(style: .regular, title: article.status.read ? "Unread" : "Read") { (_, _) in
|
||||
self.toggleArticleRead(article)
|
||||
tableView.rowActionsVisible = false
|
||||
}
|
||||
action.image = article.status.read ? AppAssets.swipeMarkUnreadImage : AppAssets.swipeMarkReadImage
|
||||
return [action]
|
||||
|
||||
case .trailing:
|
||||
let action = NSTableViewRowAction(style: .regular, title: article.status.starred ? "Unstar" : "Star") { (_, _) in
|
||||
self.toggleArticleStarred(article)
|
||||
tableView.rowActionsVisible = false
|
||||
}
|
||||
action.backgroundColor = AppAssets.starColor
|
||||
action.image = article.status.starred ? AppAssets.swipeMarkUnstarredImage : AppAssets.swipeMarkStarredImage
|
||||
return [action]
|
||||
case .trailing:
|
||||
let action = NSTableViewRowAction(style: .regular, title: article.status.starred ? "Unstar" : "Star") { (_, _) in
|
||||
self.toggleArticleStarred(article)
|
||||
tableView.rowActionsVisible = false
|
||||
}
|
||||
action.backgroundColor = AppAssets.starColor
|
||||
action.image = article.status.starred ? AppAssets.swipeMarkUnstarredImage : AppAssets.swipeMarkStarredImage
|
||||
return [action]
|
||||
|
||||
@unknown default:
|
||||
os_log(.error, "Unknown table row edge: %ld", edge.rawValue)
|
||||
@unknown default:
|
||||
os_log(.error, "Unknown table row edge: %ld", edge.rawValue)
|
||||
}
|
||||
|
||||
return []
|
||||
|
||||
@@ -82,7 +82,7 @@ final class AccountsDetailViewController: NSViewController, NSTextFieldDelegate
|
||||
accountsFeedbinWindowController.account = account
|
||||
accountsFeedbinWindowController.runSheetOnWindow(self.view.window!)
|
||||
accountsWindowController = accountsFeedbinWindowController
|
||||
case .inoreader, .bazQux, .theOldReader, .freshRSS:
|
||||
case .inoreader, .bazQux, .theOldReader, .freshRSS:
|
||||
let accountsReaderAPIWindowController = AccountsReaderAPIWindowController()
|
||||
accountsReaderAPIWindowController.accountType = account.type
|
||||
accountsReaderAPIWindowController.account = account
|
||||
@@ -96,7 +96,5 @@ final class AccountsDetailViewController: NSViewController, NSTextFieldDelegate
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import SwiftUI
|
||||
import RSCore
|
||||
|
||||
// MARK: - AccountsPreferencesAddAccountDelegate
|
||||
protocol AccountsPreferencesAddAccountDelegate {
|
||||
protocol AccountsPreferencesAddAccountDelegate: AnyObject {
|
||||
func presentSheetForAccount(_ accountType: AccountType)
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ final class AccountsPreferencesViewController: NSViewController {
|
||||
@IBOutlet weak var tableView: NSTableView!
|
||||
@IBOutlet weak var detailView: NSView!
|
||||
@IBOutlet weak var deleteButton: NSButton!
|
||||
var addAccountDelegate: AccountsPreferencesAddAccountDelegate?
|
||||
weak var addAccountDelegate: AccountsPreferencesAddAccountDelegate?
|
||||
var addAccountWindowController: NSWindowController?
|
||||
var addAccountsViewController: NSHostingController<AddAccountsView>?
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ import Account
|
||||
struct AddAccountHelpView: View {
|
||||
|
||||
let accountTypes: [AccountType] = AddAccountSections.allOrdered.sectionContent
|
||||
var delegate: AccountsPreferencesAddAccountDelegate?
|
||||
weak var delegate: AccountsPreferencesAddAccountDelegate?
|
||||
var helpText: String
|
||||
@State private var iCloudUnavailableError: Bool = false
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ enum AddAccountSections: Int, CaseIterable {
|
||||
struct AddAccountsView: View {
|
||||
|
||||
weak var parent: NSHostingController<AddAccountsView>? // required because presentationMode.dismiss() doesn't work
|
||||
var addAccountDelegate: AccountsPreferencesAddAccountDelegate?
|
||||
weak var addAccountDelegate: AccountsPreferencesAddAccountDelegate?
|
||||
private let chunkLimit = 4 // use this to control number of accounts in each web account column
|
||||
@State private var selectedAccount: AccountType = .onMyMac
|
||||
|
||||
|
||||
Reference in New Issue
Block a user