mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
NetNewsWire-iOS AppDefaults is now a singleton
This commit is contained in:
@@ -152,7 +152,7 @@ private extension AddAccountViewController {
|
||||
}
|
||||
}
|
||||
|
||||
if AppDefaults.isDeveloperBuild {
|
||||
if AppDefaults.shared.isDeveloperBuild {
|
||||
removeAccountType(.cloudKit)
|
||||
removeAccountType(.feedly)
|
||||
removeAccountType(.feedWrangler)
|
||||
|
||||
@@ -46,31 +46,31 @@ class SettingsViewController: UITableViewController {
|
||||
override func viewWillAppear(_ animated: Bool) {
|
||||
super.viewWillAppear(animated)
|
||||
|
||||
if AppDefaults.timelineSortDirection == .orderedAscending {
|
||||
if AppDefaults.shared.timelineSortDirection == .orderedAscending {
|
||||
timelineSortOrderSwitch.isOn = true
|
||||
} else {
|
||||
timelineSortOrderSwitch.isOn = false
|
||||
}
|
||||
|
||||
if AppDefaults.timelineGroupByFeed {
|
||||
if AppDefaults.shared.timelineGroupByFeed {
|
||||
groupByFeedSwitch.isOn = true
|
||||
} else {
|
||||
groupByFeedSwitch.isOn = false
|
||||
}
|
||||
|
||||
if AppDefaults.refreshClearsReadArticles {
|
||||
if AppDefaults.shared.refreshClearsReadArticles {
|
||||
refreshClearsReadArticlesSwitch.isOn = true
|
||||
} else {
|
||||
refreshClearsReadArticlesSwitch.isOn = false
|
||||
}
|
||||
|
||||
if AppDefaults.confirmMarkAllAsRead {
|
||||
if AppDefaults.shared.confirmMarkAllAsRead {
|
||||
confirmMarkAllAsReadSwitch.isOn = true
|
||||
} else {
|
||||
confirmMarkAllAsReadSwitch.isOn = false
|
||||
}
|
||||
|
||||
if AppDefaults.articleFullscreenAvailable {
|
||||
if AppDefaults.shared.articleFullscreenAvailable {
|
||||
showFullscreenArticlesSwitch.isOn = true
|
||||
} else {
|
||||
showFullscreenArticlesSwitch.isOn = false
|
||||
@@ -286,41 +286,41 @@ class SettingsViewController: UITableViewController {
|
||||
|
||||
@IBAction func switchTimelineOrder(_ sender: Any) {
|
||||
if timelineSortOrderSwitch.isOn {
|
||||
AppDefaults.timelineSortDirection = .orderedAscending
|
||||
AppDefaults.shared.timelineSortDirection = .orderedAscending
|
||||
} else {
|
||||
AppDefaults.timelineSortDirection = .orderedDescending
|
||||
AppDefaults.shared.timelineSortDirection = .orderedDescending
|
||||
}
|
||||
}
|
||||
|
||||
@IBAction func switchGroupByFeed(_ sender: Any) {
|
||||
if groupByFeedSwitch.isOn {
|
||||
AppDefaults.timelineGroupByFeed = true
|
||||
AppDefaults.shared.timelineGroupByFeed = true
|
||||
} else {
|
||||
AppDefaults.timelineGroupByFeed = false
|
||||
AppDefaults.shared.timelineGroupByFeed = false
|
||||
}
|
||||
}
|
||||
|
||||
@IBAction func switchClearsReadArticles(_ sender: Any) {
|
||||
if refreshClearsReadArticlesSwitch.isOn {
|
||||
AppDefaults.refreshClearsReadArticles = true
|
||||
AppDefaults.shared.refreshClearsReadArticles = true
|
||||
} else {
|
||||
AppDefaults.refreshClearsReadArticles = false
|
||||
AppDefaults.shared.refreshClearsReadArticles = false
|
||||
}
|
||||
}
|
||||
|
||||
@IBAction func switchConfirmMarkAllAsRead(_ sender: Any) {
|
||||
if confirmMarkAllAsReadSwitch.isOn {
|
||||
AppDefaults.confirmMarkAllAsRead = true
|
||||
AppDefaults.shared.confirmMarkAllAsRead = true
|
||||
} else {
|
||||
AppDefaults.confirmMarkAllAsRead = false
|
||||
AppDefaults.shared.confirmMarkAllAsRead = false
|
||||
}
|
||||
}
|
||||
|
||||
@IBAction func switchFullscreenArticles(_ sender: Any) {
|
||||
if showFullscreenArticlesSwitch.isOn {
|
||||
AppDefaults.articleFullscreenAvailable = true
|
||||
AppDefaults.shared.articleFullscreenAvailable = true
|
||||
} else {
|
||||
AppDefaults.articleFullscreenAvailable = false
|
||||
AppDefaults.shared.articleFullscreenAvailable = false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,11 +27,11 @@ class TimelineCustomizerViewController: UIViewController {
|
||||
super.viewDidLoad()
|
||||
|
||||
iconSizeSliderContainerView.layer.cornerRadius = 10
|
||||
iconSizeSlider.value = Float(AppDefaults.timelineIconSize.rawValue)
|
||||
iconSizeSlider.value = Float(AppDefaults.shared.timelineIconSize.rawValue)
|
||||
iconSizeSlider.addTickMarks()
|
||||
|
||||
numberOfLinesSliderContainerView.layer.cornerRadius = 10
|
||||
numberOfLinesSlider.value = Float(AppDefaults.timelineNumberOfLines)
|
||||
numberOfLinesSlider.value = Float(AppDefaults.shared.timelineNumberOfLines)
|
||||
numberOfLinesSlider.addTickMarks()
|
||||
}
|
||||
|
||||
@@ -48,12 +48,12 @@ class TimelineCustomizerViewController: UIViewController {
|
||||
|
||||
@IBAction func iconSizeChanged(_ sender: Any) {
|
||||
guard let iconSize = IconSize(rawValue: Int(iconSizeSlider.value.rounded())) else { return }
|
||||
AppDefaults.timelineIconSize = iconSize
|
||||
AppDefaults.shared.timelineIconSize = iconSize
|
||||
updatePreview()
|
||||
}
|
||||
|
||||
@IBAction func numberOfLinesChanged(_ sender: Any) {
|
||||
AppDefaults.timelineNumberOfLines = Int(numberOfLinesSlider.value.rounded())
|
||||
AppDefaults.shared.timelineNumberOfLines = Int(numberOfLinesSlider.value.rounded())
|
||||
updatePreview()
|
||||
}
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ private extension TimelinePreviewTableViewController {
|
||||
|
||||
let iconImage = IconImage(AppAssets.faviconTemplateImage.withTintColor(AppAssets.secondaryAccentColor))
|
||||
|
||||
return MasterTimelineCellData(article: prototypeArticle, showFeedName: .feed, feedName: "Feed Name", byline: nil, iconImage: iconImage, showIcon: true, featuredImage: nil, numberOfLines: AppDefaults.timelineNumberOfLines, iconSize: AppDefaults.timelineIconSize)
|
||||
return MasterTimelineCellData(article: prototypeArticle, showFeedName: .feed, feedName: "Feed Name", byline: nil, iconImage: iconImage, showIcon: true, featuredImage: nil, numberOfLines: AppDefaults.shared.timelineNumberOfLines, iconSize: AppDefaults.shared.timelineIconSize)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user