Removed duplicate sort parameter change handling functions
This commit is contained in:
parent
8a6e3c9f37
commit
cc6767e0f6
|
@ -126,14 +126,14 @@ final class TimelineViewController: NSViewController, UndoableCommandRunner, Unr
|
|||
private var sortDirection = AppDefaults.timelineSortDirection {
|
||||
didSet {
|
||||
if sortDirection != oldValue {
|
||||
sortDirectionDidChange()
|
||||
sortParametersDidChange()
|
||||
}
|
||||
}
|
||||
}
|
||||
private var groupByFeed = AppDefaults.timelineGroupByFeed {
|
||||
didSet {
|
||||
if groupByFeed != oldValue {
|
||||
groupByFeedDidChange()
|
||||
sortParametersDidChange()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -884,20 +884,13 @@ private extension TimelineViewController {
|
|||
}
|
||||
}
|
||||
|
||||
func sortDirectionDidChange() {
|
||||
func sortParametersDidChange() {
|
||||
performBlockAndRestoreSelection {
|
||||
let unsortedArticles = Set(articles)
|
||||
replaceArticles(with: unsortedArticles)
|
||||
}
|
||||
}
|
||||
|
||||
func groupByFeedDidChange() {
|
||||
performBlockAndRestoreSelection {
|
||||
let unsortedArticles = Set(articles)
|
||||
replaceArticles(with: unsortedArticles)
|
||||
}
|
||||
}
|
||||
|
||||
func selectedArticleIDs() -> [String] {
|
||||
|
||||
return selectedArticles.articleIDs()
|
||||
|
|
|
@ -66,14 +66,14 @@ class SceneCoordinator: NSObject, UndoableCommandRunner, UnreadCountProvider {
|
|||
private(set) var sortDirection = AppDefaults.timelineSortDirection {
|
||||
didSet {
|
||||
if sortDirection != oldValue {
|
||||
sortDirectionDidChange()
|
||||
sortParametersDidChange()
|
||||
}
|
||||
}
|
||||
}
|
||||
private(set) var groupByFeed = AppDefaults.timelineGroupByFeed {
|
||||
didSet {
|
||||
if groupByFeed != oldValue {
|
||||
groupByFeedDidChange()
|
||||
sortParametersDidChange()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1234,14 +1234,10 @@ private extension SceneCoordinator {
|
|||
}
|
||||
}
|
||||
|
||||
func sortDirectionDidChange() {
|
||||
func sortParametersDidChange() {
|
||||
replaceArticles(with: Set(articles), animate: true)
|
||||
}
|
||||
|
||||
func groupByFeedDidChange() {
|
||||
replaceArticles(with: Set(articles), animate: true)
|
||||
}
|
||||
|
||||
|
||||
func replaceArticles(with unsortedArticles: Set<Article>, animate: Bool) {
|
||||
let sortedArticles = Array(unsortedArticles).sortedByDate(sortDirection, groupByFeed: groupByFeed)
|
||||
|
||||
|
|
Loading…
Reference in New Issue