From 782ae1c5cd9f7c87b9dfea0db172af19800e42e9 Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Fri, 3 Jul 2020 01:01:38 -0500 Subject: [PATCH] Removed obsolete AppDefaults values --- Multiplatform/Shared/AppDefaults.swift | 81 ++------------------------ 1 file changed, 5 insertions(+), 76 deletions(-) diff --git a/Multiplatform/Shared/AppDefaults.swift b/Multiplatform/Shared/AppDefaults.swift index 1031c7ef0..9e96f843b 100644 --- a/Multiplatform/Shared/AppDefaults.swift +++ b/Multiplatform/Shared/AppDefaults.swift @@ -26,13 +26,6 @@ enum UserInterfaceColorPalette: Int, CustomStringConvertible, CaseIterable { } } -enum FontSize: Int { - case small = 0 - case medium = 1 - case large = 2 - case veryLarge = 3 -} - final class AppDefaults: ObservableObject { #if os(macOS) @@ -64,24 +57,19 @@ final class AppDefaults: ObservableObject { static let addFolderAccountID = "addFolderAccountID" static let timelineSortDirection = "timelineSortDirection" - // iOS Defaults static let userInterfaceColorPalette = "userInterfaceColorPalette" static let timelineGroupByFeed = "timelineGroupByFeed" - static let refreshClearsReadArticles = "refreshClearsReadArticles" - static let timelineNumberOfLines = "timelineNumberOfLines" static let timelineIconSize = "timelineIconSize" - static let articleFullscreenAvailable = "articleFullscreenAvailable" + static let timelineNumberOfLines = "timelineNumberOfLines" + + // iOS Defaults + static let refreshClearsReadArticles = "refreshClearsReadArticles" + static let articleFullscreenAvailable = "articleFullscreenAvailable" static let articleFullscreenEnabled = "articleFullscreenEnabled" static let confirmMarkAllAsRead = "confirmMarkAllAsRead" // macOS Defaults - static let windowState = "windowState" - static let sidebarFontSize = "sidebarFontSize" - static let timelineFontSize = "timelineFontSize" - static let detailFontSize = "detailFontSize" static let openInBrowserInBackground = "openInBrowserInBackground" - static let importOPMLAccountID = "importOPMLAccountID" - static let exportOPMLAccountID = "exportOPMLAccountID" static let defaultBrowserID = "defaultBrowserID" static let checkForUpdatesAutomatically = "checkForUpdatesAutomatically" static let downloadTestBuilds = "downloadTestBuild" @@ -99,9 +87,6 @@ final class AppDefaults: ObservableObject { } - private static let smallestFontSizeRawValue = FontSize.small.rawValue - private static let largestFontSizeRawValue = FontSize.veryLarge.rawValue - // MARK: Development Builds let isDeveloperBuild: Bool = { if let dev = Bundle.main.object(forInfoDictionaryKey: "DeveloperEntitlements") as? String, dev == "-dev" { @@ -220,64 +205,12 @@ final class AppDefaults: ObservableObject { } // MARK: Window State - var windowState: [AnyHashable : Any]? { - get { - return AppDefaults.store.object(forKey: Key.windowState) as? [AnyHashable : Any] - } - set { - UserDefaults.standard.set(newValue, forKey: Key.windowState) - objectWillChange.send() - } - } - @AppStorage(wrappedValue: false, Key.openInBrowserInBackground, store: store) var openInBrowserInBackground: Bool { didSet { objectWillChange.send() } } - var sidebarFontSize: FontSize { - get { - return fontSize(for: Key.sidebarFontSize) - } - set { - AppDefaults.store.set(newValue.rawValue, forKey: Key.sidebarFontSize) - objectWillChange.send() - } - } - - var timelineFontSize: FontSize { - get { - return fontSize(for: Key.timelineFontSize) - } - set { - AppDefaults.store.set(newValue.rawValue, forKey: Key.timelineFontSize) - objectWillChange.send() - } - } - - var detailFontSize: FontSize { - get { - return fontSize(for: Key.detailFontSize) - } - set { - AppDefaults.store.set(newValue.rawValue, forKey: Key.detailFontSize) - objectWillChange.send() - } - } - - @AppStorage(Key.importOPMLAccountID, store: store) var importOPMLAccountID: String? { - didSet { - objectWillChange.send() - } - } - - @AppStorage(Key.exportOPMLAccountID, store: store) var exportOPMLAccountID: String? { - didSet { - objectWillChange.send() - } - } - @AppStorage(Key.defaultBrowserID, store: store) var defaultBrowserID: String? { didSet { objectWillChange.send() @@ -346,8 +279,4 @@ extension AppDefaults { return true } - func fontSize(for key: String) -> FontSize { - // Punted till after 1.0. - return .medium - } }