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:
@@ -16,7 +16,7 @@ enum FontSize: Int {
|
||||
}
|
||||
|
||||
final class AppDefaults {
|
||||
|
||||
|
||||
static let defaultThemeName = "Default"
|
||||
|
||||
static let shared = AppDefaults()
|
||||
@@ -49,11 +49,11 @@ final class AppDefaults {
|
||||
static let showTitleOnMainWindow = "KafasisTitleMode"
|
||||
static let feedDoubleClickMarkAsRead = "GruberFeedDoubleClickMarkAsRead"
|
||||
static let suppressSyncOnLaunch = "DevroeSuppressSyncOnLaunch"
|
||||
|
||||
|
||||
static let webInspectorEnabled = "WebInspectorEnabled"
|
||||
static let webInspectorStartsAttached = "__WebInspectorPageGroupLevel1__.WebKit2InspectorStartsAttached"
|
||||
}
|
||||
|
||||
|
||||
private static let smallestFontSizeRawValue = FontSize.small.rawValue
|
||||
private static let largestFontSizeRawValue = FontSize.veryLarge.rawValue
|
||||
|
||||
@@ -63,7 +63,7 @@ final class AppDefaults {
|
||||
}
|
||||
return false
|
||||
}()
|
||||
|
||||
|
||||
var isFirstRun: Bool = {
|
||||
if let _ = UserDefaults.standard.object(forKey: Key.firstRunDate) as? Date {
|
||||
return false
|
||||
@@ -71,16 +71,16 @@ final class AppDefaults {
|
||||
firstRunDate = Date()
|
||||
return true
|
||||
}()
|
||||
|
||||
var windowState: [AnyHashable : Any]? {
|
||||
|
||||
var windowState: [AnyHashable: Any]? {
|
||||
get {
|
||||
return UserDefaults.standard.object(forKey: Key.windowState) as? [AnyHashable : Any]
|
||||
return UserDefaults.standard.object(forKey: Key.windowState) as? [AnyHashable: Any]
|
||||
}
|
||||
set {
|
||||
UserDefaults.standard.set(newValue, forKey: Key.windowState)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var lastImageCacheFlushDate: Date? {
|
||||
get {
|
||||
return AppDefaults.date(for: Key.lastImageCacheFlushDate)
|
||||
@@ -89,7 +89,7 @@ final class AppDefaults {
|
||||
AppDefaults.setDate(for: Key.lastImageCacheFlushDate, newValue)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var openInBrowserInBackground: Bool {
|
||||
get {
|
||||
return AppDefaults.bool(for: Key.openInBrowserInBackground)
|
||||
@@ -105,8 +105,7 @@ final class AppDefaults {
|
||||
if let appGroupID = Bundle.main.object(forInfoDictionaryKey: "AppGroup") as? String,
|
||||
let appGroupDefaults = UserDefaults(suiteName: appGroupID) {
|
||||
return appGroupDefaults
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return UserDefaults.standard
|
||||
}
|
||||
}
|
||||
@@ -155,7 +154,7 @@ final class AppDefaults {
|
||||
AppDefaults.setString(for: Key.addFeedAccountID, newValue)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var addFeedFolderName: String? {
|
||||
get {
|
||||
return AppDefaults.string(for: Key.addFeedFolderName)
|
||||
@@ -173,7 +172,7 @@ final class AppDefaults {
|
||||
AppDefaults.setString(for: Key.addFolderAccountID, newValue)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var importOPMLAccountID: String? {
|
||||
get {
|
||||
return AppDefaults.string(for: Key.importOPMLAccountID)
|
||||
@@ -182,7 +181,7 @@ final class AppDefaults {
|
||||
AppDefaults.setString(for: Key.importOPMLAccountID, newValue)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var exportOPMLAccountID: String? {
|
||||
get {
|
||||
return AppDefaults.string(for: Key.exportOPMLAccountID)
|
||||
@@ -200,7 +199,7 @@ final class AppDefaults {
|
||||
AppDefaults.setString(for: Key.defaultBrowserID, newValue)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var currentThemeName: String? {
|
||||
get {
|
||||
return AppDefaults.string(for: Key.currentThemeName)
|
||||
@@ -209,7 +208,7 @@ final class AppDefaults {
|
||||
AppDefaults.setString(for: Key.currentThemeName, newValue)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var showTitleOnMainWindow: Bool {
|
||||
return AppDefaults.bool(for: Key.showTitleOnMainWindow)
|
||||
}
|
||||
@@ -235,7 +234,7 @@ final class AppDefaults {
|
||||
AppDefaults.setBool(for: Key.suppressSyncOnLaunch, newValue)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var webInspectorEnabled: Bool {
|
||||
get {
|
||||
return AppDefaults.bool(for: Key.webInspectorEnabled)
|
||||
@@ -244,7 +243,7 @@ final class AppDefaults {
|
||||
AppDefaults.setBool(for: Key.webInspectorEnabled, newValue)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var webInspectorStartsAttached: Bool {
|
||||
get {
|
||||
return AppDefaults.bool(for: Key.webInspectorStartsAttached)
|
||||
@@ -253,7 +252,7 @@ final class AppDefaults {
|
||||
AppDefaults.setBool(for: Key.webInspectorStartsAttached, newValue)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var timelineSortDirection: ComparisonResult {
|
||||
get {
|
||||
return AppDefaults.sortDirection(for: Key.timelineSortDirection)
|
||||
@@ -262,7 +261,7 @@ final class AppDefaults {
|
||||
AppDefaults.setSortDirection(for: Key.timelineSortDirection, newValue)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var timelineGroupByFeed: Bool {
|
||||
get {
|
||||
return AppDefaults.bool(for: Key.timelineGroupByFeed)
|
||||
@@ -271,7 +270,7 @@ final class AppDefaults {
|
||||
AppDefaults.setBool(for: Key.timelineGroupByFeed, newValue)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var timelineShowsSeparators: Bool {
|
||||
return AppDefaults.bool(for: Key.timelineShowsSeparators)
|
||||
}
|
||||
@@ -312,7 +311,7 @@ final class AppDefaults {
|
||||
let showDebugMenu = false
|
||||
#endif
|
||||
|
||||
let defaults: [String : Any] = [
|
||||
let defaults: [String: Any] = [
|
||||
Key.sidebarFontSize: FontSize.medium.rawValue,
|
||||
Key.timelineFontSize: FontSize.medium.rawValue,
|
||||
Key.detailFontSize: FontSize.medium.rawValue,
|
||||
@@ -379,19 +378,19 @@ private extension AppDefaults {
|
||||
// }
|
||||
// return FontSize(rawValue: rawFontSize)!
|
||||
}
|
||||
|
||||
|
||||
static func setFontSize(for key: String, _ fontSize: FontSize) {
|
||||
setInt(for: key, fontSize.rawValue)
|
||||
}
|
||||
|
||||
|
||||
static func string(for key: String) -> String? {
|
||||
return UserDefaults.standard.string(forKey: key)
|
||||
}
|
||||
|
||||
|
||||
static func setString(for key: String, _ value: String?) {
|
||||
UserDefaults.standard.set(value, forKey: key)
|
||||
}
|
||||
|
||||
|
||||
static func bool(for key: String) -> Bool {
|
||||
return UserDefaults.standard.bool(forKey: key)
|
||||
}
|
||||
@@ -403,11 +402,11 @@ private extension AppDefaults {
|
||||
static func int(for key: String) -> Int {
|
||||
return UserDefaults.standard.integer(forKey: key)
|
||||
}
|
||||
|
||||
|
||||
static func setInt(for key: String, _ x: Int) {
|
||||
UserDefaults.standard.set(x, forKey: key)
|
||||
}
|
||||
|
||||
|
||||
static func date(for key: String) -> Date? {
|
||||
return UserDefaults.standard.object(forKey: key) as? Date
|
||||
}
|
||||
@@ -416,7 +415,7 @@ private extension AppDefaults {
|
||||
UserDefaults.standard.set(date, forKey: key)
|
||||
}
|
||||
|
||||
static func sortDirection(for key:String) -> ComparisonResult {
|
||||
static func sortDirection(for key: String) -> ComparisonResult {
|
||||
let rawInt = int(for: key)
|
||||
if rawInt == ComparisonResult.orderedAscending.rawValue {
|
||||
return .orderedAscending
|
||||
@@ -427,8 +426,7 @@ private extension AppDefaults {
|
||||
static func setSortDirection(for key: String, _ value: ComparisonResult) {
|
||||
if value == .orderedAscending {
|
||||
setInt(for: key, ComparisonResult.orderedAscending.rawValue)
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
setInt(for: key, ComparisonResult.orderedDescending.rawValue)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user