Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show all sorting options for episode #2175

Merged
merged 3 commits into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
7.74
-----

- Add Title episode sort options to iPhone app [2175](https://github.com/Automattic/pocket-casts-ios/pull/2175)

7.73
-----
Expand Down
37 changes: 4 additions & 33 deletions podcasts/EpisodeListSearchController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -249,42 +249,13 @@ class EpisodeListSearchController: SimpleNotificationsViewController, UISearchBa

let sortOrder = podcast.podcastSortOrder

if FeatureFlag.newSettingsStorage.enabled {
PodcastEpisodeSortOrder.allCases.forEach { order in
let newestToOldestAction = OptionAction(label: order.description, selected: sortOrder == order) { [weak self] in
self?.setSortSetting(order)
Analytics.track(.podcastsScreenSortOrderChanged, properties: ["sort_by": order])
}

optionPicker.addAction(action: newestToOldestAction)
}
} else {
let newestToOldestAction = OptionAction(label: PodcastEpisodeSortOrder.newestToOldest.description, selected: sortOrder == PodcastEpisodeSortOrder.newestToOldest) { [weak self] in
self?.setSortSetting(.newestToOldest)
Analytics.track(.podcastsScreenSortOrderChanged, properties: ["sort_by": PodcastEpisodeSortOrder.newestToOldest])
PodcastEpisodeSortOrder.allCases.forEach { order in
let newestToOldestAction = OptionAction(label: order.description, selected: sortOrder == order) { [weak self] in
self?.setSortSetting(order)
Analytics.track(.podcastsScreenSortOrderChanged, properties: ["sort_by": order])
}

optionPicker.addAction(action: newestToOldestAction)

let oldestToNewestAction = OptionAction(label: PodcastEpisodeSortOrder.oldestToNewest.description, selected: sortOrder == PodcastEpisodeSortOrder.oldestToNewest) { [weak self] in
self?.setSortSetting(.oldestToNewest)
Analytics.track(.podcastsScreenSortOrderChanged, properties: ["sort_by": PodcastEpisodeSortOrder.oldestToNewest])
}
optionPicker.addAction(action: oldestToNewestAction)

let shortestToLongestAction = OptionAction(label: PodcastEpisodeSortOrder.shortestToLongest.description, selected: sortOrder == PodcastEpisodeSortOrder.shortestToLongest) { [weak self] in
self?.setSortSetting(.shortestToLongest)
Analytics.track(.podcastsScreenSortOrderChanged, properties: ["sort_by": PodcastEpisodeSortOrder.shortestToLongest])

}
optionPicker.addAction(action: shortestToLongestAction)

let longestToShortestAction = OptionAction(label: PodcastEpisodeSortOrder.longestToShortest.description, selected: sortOrder == PodcastEpisodeSortOrder.longestToShortest) { [weak self] in
self?.setSortSetting(.longestToShortest)
Analytics.track(.podcastsScreenSortOrderChanged, properties: ["sort_by": PodcastEpisodeSortOrder.longestToShortest])

}
optionPicker.addAction(action: longestToShortestAction)
}

optionPicker.show(statusBarStyle: preferredStatusBarStyle)
Expand Down