Removed duplicate sort parameter change handling functions

This commit is contained in:
Phil Viso 2019-09-13 08:29:56 -05:00
parent 8a6e3c9f37
commit cc6767e0f6
2 changed files with 7 additions and 18 deletions

View File

@ -126,14 +126,14 @@ final class TimelineViewController: NSViewController, UndoableCommandRunner, Unr
private var sortDirection = AppDefaults.timelineSortDirection { private var sortDirection = AppDefaults.timelineSortDirection {
didSet { didSet {
if sortDirection != oldValue { if sortDirection != oldValue {
sortDirectionDidChange() sortParametersDidChange()
} }
} }
} }
private var groupByFeed = AppDefaults.timelineGroupByFeed { private var groupByFeed = AppDefaults.timelineGroupByFeed {
didSet { didSet {
if groupByFeed != oldValue { if groupByFeed != oldValue {
groupByFeedDidChange() sortParametersDidChange()
} }
} }
} }
@ -884,14 +884,7 @@ private extension TimelineViewController {
} }
} }
func sortDirectionDidChange() { func sortParametersDidChange() {
performBlockAndRestoreSelection {
let unsortedArticles = Set(articles)
replaceArticles(with: unsortedArticles)
}
}
func groupByFeedDidChange() {
performBlockAndRestoreSelection { performBlockAndRestoreSelection {
let unsortedArticles = Set(articles) let unsortedArticles = Set(articles)
replaceArticles(with: unsortedArticles) replaceArticles(with: unsortedArticles)

View File

@ -66,14 +66,14 @@ class SceneCoordinator: NSObject, UndoableCommandRunner, UnreadCountProvider {
private(set) var sortDirection = AppDefaults.timelineSortDirection { private(set) var sortDirection = AppDefaults.timelineSortDirection {
didSet { didSet {
if sortDirection != oldValue { if sortDirection != oldValue {
sortDirectionDidChange() sortParametersDidChange()
} }
} }
} }
private(set) var groupByFeed = AppDefaults.timelineGroupByFeed { private(set) var groupByFeed = AppDefaults.timelineGroupByFeed {
didSet { didSet {
if groupByFeed != oldValue { if groupByFeed != oldValue {
groupByFeedDidChange() sortParametersDidChange()
} }
} }
} }
@ -1234,11 +1234,7 @@ private extension SceneCoordinator {
} }
} }
func sortDirectionDidChange() { func sortParametersDidChange() {
replaceArticles(with: Set(articles), animate: true)
}
func groupByFeedDidChange() {
replaceArticles(with: Set(articles), animate: true) replaceArticles(with: Set(articles), animate: true)
} }