mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
Converts AppDefaults to singleton
This commit is contained in:
@@ -71,9 +71,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
|
||||
}
|
||||
|
||||
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
|
||||
AppDefaults.registerDefaults()
|
||||
//AppDefaults.registerDefaults()
|
||||
|
||||
let isFirstRun = AppDefaults.isFirstRun
|
||||
let isFirstRun = AppDefaults.shared.isFirstRun()
|
||||
if isFirstRun {
|
||||
os_log("Is first run.", log: log, type: .info)
|
||||
}
|
||||
@@ -139,7 +139,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
|
||||
}
|
||||
|
||||
@objc func accountRefreshDidFinish(_ note: Notification) {
|
||||
AppDefaults.lastRefresh = Date()
|
||||
AppDefaults.shared.lastRefresh = Date()
|
||||
}
|
||||
|
||||
// MARK: - API
|
||||
@@ -163,7 +163,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
|
||||
// extensionFeedAddRequestFile.resume()
|
||||
syncTimer?.update()
|
||||
|
||||
if let lastRefresh = AppDefaults.lastRefresh {
|
||||
if let lastRefresh = AppDefaults.shared.lastRefresh {
|
||||
if Date() > lastRefresh.addingTimeInterval(15 * 60) {
|
||||
AccountManager.shared.refreshAll(errorHandler: ErrorHandler.log)
|
||||
} else {
|
||||
|
||||
@@ -57,7 +57,7 @@ struct SettingsView: View {
|
||||
@Environment(\.presentationMode) var presentationMode
|
||||
|
||||
@StateObject private var viewModel = SettingsViewModel()
|
||||
@StateObject private var settings = AppSettings.shared
|
||||
@StateObject private var settings = AppDefaults.shared
|
||||
|
||||
var body: some View {
|
||||
NavigationView {
|
||||
|
||||
@@ -10,7 +10,7 @@ import SwiftUI
|
||||
|
||||
struct TimelineLayoutView: View {
|
||||
|
||||
@EnvironmentObject private var appSettings: AppSettings
|
||||
@EnvironmentObject private var appSettings: AppDefaults
|
||||
|
||||
private let sampleTitle = "Lorem dolor sed viverra ipsum. Gravida rutrum quisque non tellus. Rutrum tellus pellentesque eu tincidunt tortor. Sed blandit libero volutpat sed cras ornare. Et netus et malesuada fames ac. Ultrices eros in cursus turpis massa tincidunt dui ut ornare. Lacus sed viverra tellus in. Sollicitudin ac orci phasellus egestas. Purus in mollis nunc sed. Sollicitudin ac orci phasellus egestas tellus rutrum tellus pellentesque. Interdum consectetur libero id faucibus nisl tincidunt eget."
|
||||
|
||||
@@ -33,7 +33,7 @@ struct TimelineLayoutView: View {
|
||||
}
|
||||
|
||||
var iconSize: some View {
|
||||
Slider(value: $appSettings.timelineIconSize, in: 20...60, minimumValueLabel: Text("Small"), maximumValueLabel: Text("Large"), label: {
|
||||
Slider(value: $appSettings.timelineIconSize, in: 20...60, step: 10, minimumValueLabel: Text("Small"), maximumValueLabel: Text("Large"), label: {
|
||||
Text(String(appSettings.timelineIconSize))
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user