mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2025-02-06 05:43:32 +01:00
Fix lint issues.
This commit is contained in:
parent
ae2b017ae0
commit
4b1b285d0b
@ -1,6 +1,7 @@
|
||||
identifier_name:
|
||||
min_length: 1
|
||||
max_length: 50
|
||||
allowed_symbols: "_"
|
||||
|
||||
line_length:
|
||||
warning: 200
|
||||
@ -18,6 +19,8 @@ disabled_rules:
|
||||
- file_length
|
||||
- force_cast
|
||||
- force_try
|
||||
- cyclomatic_complexity
|
||||
- generic_type_name
|
||||
|
||||
excluded:
|
||||
- Modules/Secrets/Sources/Secrets/SecretKey.swift
|
||||
|
@ -65,10 +65,10 @@ final class AppDefaults {
|
||||
}()
|
||||
|
||||
var isFirstRun: Bool = {
|
||||
if let _ = UserDefaults.standard.object(forKey: Key.firstRunDate) as? Date {
|
||||
return false
|
||||
if UserDefaults.standard.object(forKey: Key.firstRunDate) as? Date == nil {
|
||||
firstRunDate = Date()
|
||||
return true
|
||||
}
|
||||
firstRunDate = Date()
|
||||
return true
|
||||
}()
|
||||
|
||||
|
@ -23,6 +23,7 @@ class ShareViewController: NSViewController {
|
||||
return NSNib.Name("ShareViewController")
|
||||
}
|
||||
|
||||
// swiftlint:disable:next function_body_length
|
||||
override func loadView() {
|
||||
super.loadView()
|
||||
|
||||
|
@ -264,7 +264,6 @@ private extension ArticleRenderer {
|
||||
return d
|
||||
}
|
||||
|
||||
// swiftlint:disable:next cyclomatic_complexity
|
||||
func byline() -> String {
|
||||
guard let authors = article?.authors ?? article?.feed?.authors, !authors.isEmpty else {
|
||||
return ""
|
||||
|
@ -138,7 +138,6 @@ extension Article {
|
||||
}
|
||||
}
|
||||
|
||||
// swiftlint:disable:next cyclomatic_complexity
|
||||
func byline() -> String {
|
||||
guard let authors = authors ?? feed?.authors, !authors.isEmpty else {
|
||||
return ""
|
||||
|
@ -10,13 +10,13 @@ import UIKit
|
||||
import RSCore
|
||||
import Account
|
||||
|
||||
protocol AddFeedFolderViewControllerDelegate {
|
||||
protocol AddFeedFolderViewControllerDelegate: AnyObject {
|
||||
func didSelect(container: Container)
|
||||
}
|
||||
|
||||
class AddFeedFolderViewController: UITableViewController {
|
||||
|
||||
var delegate: AddFeedFolderViewControllerDelegate?
|
||||
weak var delegate: AddFeedFolderViewControllerDelegate?
|
||||
var initialContainer: Container?
|
||||
|
||||
var containers = [Container]()
|
||||
|
@ -68,11 +68,11 @@ final class AppDefaults {
|
||||
}()
|
||||
|
||||
let isFirstRun: Bool = {
|
||||
if let _ = AppDefaults.store.object(forKey: Key.firstRunDate) as? Date {
|
||||
return false
|
||||
if AppDefaults.store.object(forKey: Key.firstRunDate) as? Date == nil {
|
||||
firstRunDate = Date()
|
||||
return true
|
||||
}
|
||||
firstRunDate = Date()
|
||||
return true
|
||||
return false
|
||||
}()
|
||||
|
||||
static var userInterfaceColorPalette: UserInterfaceColorPalette {
|
||||
|
@ -96,7 +96,10 @@ class AccountInspectorViewController: UITableViewController {
|
||||
let message: String = {
|
||||
switch account.type {
|
||||
case .feedly:
|
||||
return NSLocalizedString("Are you sure you want to remove this account? NetNewsWire will no longer be able to access articles and feeds unless the account is added again.", comment: "Log Out and Remove Account")
|
||||
return NSLocalizedString(
|
||||
"Are you sure you want to remove this account? NetNewsWire will no longer be able to access articles and feeds unless the account is added again.",
|
||||
comment: "Log Out and Remove Account"
|
||||
)
|
||||
default:
|
||||
return NSLocalizedString("Are you sure you want to remove this account? This cannot be undone.", comment: "Remove Account")
|
||||
}
|
||||
|
@ -767,7 +767,15 @@ private extension MainFeedViewController {
|
||||
let unreadCountView = MainFeedUnreadCountView()
|
||||
unreadCountView.unreadCount = 10
|
||||
|
||||
let layout = MainFeedTableViewCellLayout(cellWidth: tableView.bounds.size.width, insets: tableView.safeAreaInsets, label: titleLabel, unreadCountView: unreadCountView, showingEditingControl: false, indent: false, shouldShowDisclosure: false)
|
||||
let layout = MainFeedTableViewCellLayout(
|
||||
cellWidth: tableView.bounds.size.width,
|
||||
insets: tableView.safeAreaInsets,
|
||||
label: titleLabel,
|
||||
unreadCountView: unreadCountView,
|
||||
showingEditingControl: false,
|
||||
indent: false,
|
||||
shouldShowDisclosure: false
|
||||
)
|
||||
tableView.estimatedRowHeight = layout.height
|
||||
}
|
||||
|
||||
|
@ -65,11 +65,4 @@ struct ShadowTableChanges {
|
||||
var inserts: Set<Int>?
|
||||
var moves: Set<Move>?
|
||||
var rowChanges: [RowChanges]?
|
||||
|
||||
init(deletes: Set<Int>?, inserts: Set<Int>?, moves: Set<Move>?, rowChanges: [RowChanges]?) {
|
||||
self.deletes = deletes
|
||||
self.inserts = inserts
|
||||
self.moves = moves
|
||||
self.rowChanges = rowChanges
|
||||
}
|
||||
}
|
||||
|
@ -293,7 +293,11 @@ private extension MainTimelineTableViewCell {
|
||||
}
|
||||
|
||||
func showOrHideView(_ view: UIView, _ shouldHide: Bool) {
|
||||
shouldHide ? hideView(view) : showView(view)
|
||||
if shouldHide {
|
||||
hideView(view)
|
||||
} else {
|
||||
showView(view)
|
||||
}
|
||||
}
|
||||
|
||||
func updateSubviews() {
|
||||
|
@ -8,10 +8,10 @@
|
||||
|
||||
import UIKit
|
||||
|
||||
// swiftlint:disable:next line_length
|
||||
class MainTimelineDataSource<SectionIdentifierType, ItemIdentifierType>: UITableViewDiffableDataSource<SectionIdentifierType, ItemIdentifierType> where SectionIdentifierType: Hashable, ItemIdentifierType: Hashable {
|
||||
|
||||
override func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
|
||||
return true
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -19,7 +19,6 @@ class MainTimelineTitleView: UIView {
|
||||
}()
|
||||
|
||||
override var accessibilityLabel: String? {
|
||||
set { }
|
||||
get {
|
||||
if let name = label.text {
|
||||
let unreadLabel = NSLocalizedString("unread", comment: "Unread label for accessibility")
|
||||
@ -28,6 +27,8 @@ class MainTimelineTitleView: UIView {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
set {
|
||||
}
|
||||
}
|
||||
|
||||
func buttonize() {
|
||||
@ -47,8 +48,8 @@ extension MainTimelineTitleView: UIPointerInteractionDelegate {
|
||||
|
||||
func pointerInteraction(_ interaction: UIPointerInteraction, styleFor region: UIPointerRegion) -> UIPointerStyle? {
|
||||
var rect = self.frame
|
||||
rect.origin.x = rect.origin.x - 10
|
||||
rect.size.width = rect.width + 20
|
||||
rect.origin.x -= 10
|
||||
rect.size.width += 20
|
||||
|
||||
return UIPointerStyle(effect: .automatic(UITargetedPreview(view: self)), shape: .roundedRect(rect))
|
||||
}
|
||||
|
@ -16,12 +16,14 @@ extension UIBarButtonItem: MarkAsReadAlertControllerSourceType {}
|
||||
|
||||
struct MarkAsReadAlertController {
|
||||
|
||||
static func confirm<T>(_ controller: UIViewController?,
|
||||
coordinator: SceneCoordinator?,
|
||||
confirmTitle: String,
|
||||
sourceType: T,
|
||||
cancelCompletion: (() -> Void)? = nil,
|
||||
completion: @escaping () -> Void) where T: MarkAsReadAlertControllerSourceType {
|
||||
static func confirm<T>(
|
||||
_ controller: UIViewController?,
|
||||
coordinator: SceneCoordinator?,
|
||||
confirmTitle: String,
|
||||
sourceType: T,
|
||||
cancelCompletion: (() -> Void)? = nil,
|
||||
completion: @escaping () -> Void
|
||||
) where T: MarkAsReadAlertControllerSourceType {
|
||||
|
||||
guard let controller = controller, let coordinator = coordinator else {
|
||||
completion()
|
||||
@ -38,11 +40,13 @@ struct MarkAsReadAlertController {
|
||||
}
|
||||
}
|
||||
|
||||
private static func alert<T>(coordinator: SceneCoordinator,
|
||||
confirmTitle: String,
|
||||
cancelCompletion: (() -> Void)?,
|
||||
sourceType: T,
|
||||
completion: @escaping (UIAlertAction) -> Void) -> UIAlertController where T: MarkAsReadAlertControllerSourceType {
|
||||
private static func alert<T>(
|
||||
coordinator: SceneCoordinator,
|
||||
confirmTitle: String,
|
||||
cancelCompletion: (() -> Void)?,
|
||||
sourceType: T,
|
||||
completion: @escaping (UIAlertAction) -> Void
|
||||
) -> UIAlertController where T: MarkAsReadAlertControllerSourceType {
|
||||
|
||||
let title = NSLocalizedString("Mark As Read", comment: "Mark As Read")
|
||||
let message = NSLocalizedString("You can turn this confirmation off in Settings.",
|
||||
|
@ -563,7 +563,23 @@ class TimelineViewController: UITableViewController, UndoableCommandRunner {
|
||||
|
||||
let prototypeID = "prototype"
|
||||
let status = ArticleStatus(articleID: prototypeID, read: false, starred: false, dateArrived: Date())
|
||||
let prototypeArticle = Article(accountID: prototypeID, articleID: prototypeID, feedID: prototypeID, uniqueID: prototypeID, title: Constants.prototypeText, contentHTML: nil, contentText: nil, url: nil, externalURL: nil, summary: nil, imageURL: nil, datePublished: nil, dateModified: nil, authors: nil, status: status)
|
||||
let prototypeArticle = Article(
|
||||
accountID: prototypeID,
|
||||
articleID: prototypeID,
|
||||
feedID: prototypeID,
|
||||
uniqueID: prototypeID,
|
||||
title: Constants.prototypeText,
|
||||
contentHTML: nil,
|
||||
contentText: nil,
|
||||
url: nil,
|
||||
externalURL: nil,
|
||||
summary: nil,
|
||||
imageURL: nil,
|
||||
datePublished: nil,
|
||||
dateModified: nil,
|
||||
authors: nil,
|
||||
status: status
|
||||
)
|
||||
|
||||
let prototypeCellData = MainTimelineCellData(article: prototypeArticle, showFeedName: .feed, feedName: "Prototype Feed Name", byline: nil, iconImage: nil, showIcon: false, numberOfLines: numberOfTextLines, iconSize: iconSize)
|
||||
|
||||
@ -574,9 +590,7 @@ class TimelineViewController: UITableViewController, UndoableCommandRunner {
|
||||
let layout = MainTimelineDefaultCellLayout(width: tableView.bounds.width, insets: tableView.safeAreaInsets, cellData: prototypeCellData)
|
||||
tableView.estimatedRowHeight = layout.height
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// MARK: Searching
|
||||
|
@ -10,6 +10,7 @@ import Account
|
||||
import UIKit
|
||||
import RSCore
|
||||
|
||||
// swiftlint:disable:next class_delegate_protocol
|
||||
protocol AddAccountDismissDelegate: UIViewController {
|
||||
func dismiss()
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ import SafariServices
|
||||
import SwiftUI
|
||||
import UniformTypeIdentifiers
|
||||
|
||||
// swiftlint:disable:next type_body_length
|
||||
class SettingsViewController: UITableViewController {
|
||||
|
||||
private weak var opmlAccount: Account?
|
||||
@ -155,6 +156,7 @@ class SettingsViewController: UITableViewController {
|
||||
return cell
|
||||
}
|
||||
|
||||
// swiftlint:disable:next function_body_length
|
||||
override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
|
||||
|
||||
switch indexPath.section {
|
||||
|
@ -63,15 +63,37 @@ class TimelinePreviewTableViewController: UIViewController, UITableViewDelegate,
|
||||
private extension TimelinePreviewTableViewController {
|
||||
|
||||
var prototypeCellData: MainTimelineCellData {
|
||||
let longTitle = "Enim ut tellus elementum sagittis vitae et. Nibh praesent tristique magna sit amet purus gravida quis blandit. Neque volutpat ac tincidunt vitae semper quis lectus nulla. Massa id neque aliquam vestibulum morbi blandit. Ultrices vitae auctor eu augue. Enim eu turpis egestas pretium aenean pharetra magna. Eget gravida cum sociis natoque. Sit amet consectetur adipiscing elit. Auctor eu augue ut lectus arcu bibendum. Maecenas volutpat blandit aliquam etiam erat velit. Ut pharetra sit amet aliquam id diam maecenas ultricies. In hac habitasse platea dictumst quisque sagittis purus sit amet."
|
||||
let longTitle = Constants.prototypeText
|
||||
|
||||
let prototypeID = "prototype"
|
||||
let status = ArticleStatus(articleID: prototypeID, read: false, starred: false, dateArrived: Date())
|
||||
let prototypeArticle = Article(accountID: prototypeID, articleID: prototypeID, feedID: prototypeID, uniqueID: prototypeID, title: longTitle, contentHTML: nil, contentText: nil, url: nil, externalURL: nil, summary: nil, imageURL: nil, datePublished: nil, dateModified: nil, authors: nil, status: status)
|
||||
let prototypeArticle = Article(
|
||||
accountID: prototypeID,
|
||||
articleID: prototypeID,
|
||||
feedID: prototypeID,
|
||||
uniqueID: prototypeID,
|
||||
title: longTitle, contentHTML: nil,
|
||||
contentText: nil,
|
||||
url: nil,
|
||||
externalURL: nil,
|
||||
summary: nil,
|
||||
imageURL: nil,
|
||||
datePublished: nil,
|
||||
dateModified: nil,
|
||||
authors: nil,
|
||||
status: status
|
||||
)
|
||||
|
||||
let iconImage = IconImage(AppAssets.faviconTemplateImage.withTintColor(AppAssets.secondaryAccentColor))
|
||||
|
||||
return MainTimelineCellData(article: prototypeArticle, showFeedName: .feed, feedName: "Feed Name", byline: nil, iconImage: iconImage, showIcon: true, numberOfLines: AppDefaults.shared.timelineNumberOfLines, iconSize: AppDefaults.shared.timelineIconSize)
|
||||
return MainTimelineCellData(
|
||||
article: prototypeArticle,
|
||||
showFeedName: .feed,
|
||||
feedName: "Feed Name",
|
||||
byline: nil, iconImage: iconImage,
|
||||
showIcon: true,
|
||||
numberOfLines: AppDefaults.shared.timelineNumberOfLines,
|
||||
iconSize: AppDefaults.shared.timelineIconSize
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ class ShareViewController: SLComposeServiceViewController, ShareFolderPickerCont
|
||||
private var selectedContainer: ExtensionContainer?
|
||||
private var folderItem: SLComposeSheetConfigurationItem!
|
||||
|
||||
// swiftlint:disable:next function_body_length
|
||||
override func viewDidLoad() {
|
||||
|
||||
extensionContainers = ExtensionContainersFile.read()
|
||||
|
Loading…
x
Reference in New Issue
Block a user