-
-
Notifications
You must be signed in to change notification settings - Fork 195
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
feat(greader): sort categories alphabetically during sync #700
Conversation
Related: #535 |
@@ -228,7 +228,7 @@ class GoogleReaderRssService @Inject constructor( | |||
|
|||
// 2. Fetch folder and subscription list | |||
googleReaderAPI.getSubscriptionList() | |||
.subscriptions.groupBy { it.categories?.first() } | |||
.subscriptions.sortedBy { it.categories?.sortedBy { it.label }?.first()?.label }.groupBy { it.categories?.first() } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems a bit complicated for me. Though I don't use Google Reader, I guess we only need the first (and the only) element in categories
here. And we can sort the map after we group the list by the category.
@@ -228,7 +228,7 @@ class GoogleReaderRssService @Inject constructor( | |||
|
|||
// 2. Fetch folder and subscription list | |||
googleReaderAPI.getSubscriptionList() | |||
.subscriptions.groupBy { it.categories?.first() } | |||
.subscriptions.sortedBy { it.categories?.sortedBy { it.label }?.first()?.label }.groupBy { it.categories?.first() } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.subscriptions.sortedBy { it.categories?.sortedBy { it.label }?.first()?.label }.groupBy { it.categories?.first() } | |
.subscriptions.groupBy { it.categories?.first() } | |
.toSortedMap { c1, c2 -> c1?.label.toString().compareTo(c2?.label.toString()) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JunkFood02 Yeah, I like this better. Tested it and it works well. Added! Thanks for the suggestion!
Signed-off-by: Mark Bestavros <markbest@bu.edu>
2205b6e
to
57fd946
Compare
This has been a pet peeve of mine when using the Greader API: categories/folders aren't sorted alphabetically when in the Feeds view. The way the app works today, categories are arranged by whichever category has the feed with the lowest lexicographical order, which is very unintuitive.
As an example, let's say I have the following categories and feeds:
Under the current code, these categories get ordered as:
because
A banana a day keeps the doctor away
is lexicographically beforeFruits of the Day
.While it's true that we should probably implement some way to allow the user to manually reorder feeds, this is a quick fix that requires little effort. Plus, even if we did have manual category sorting, it's still nice to present a sensible lexicographic default.
Tagging @Ashinch and @JunkFood02 for review.