-
Notifications
You must be signed in to change notification settings - Fork 1
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
Remember selected sorting options #209
base: master
Are you sure you want to change the base?
Remember selected sorting options #209
Conversation
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.
IMO this should be a user setting, and this is also a UX change
certainly a UX change, IMO three ways to do it:
If a user setting is required it may make sense to have the default value of Last Used |
@@ -36,7 +36,7 @@ struct CommunityView: View | |||
|
|||
@FocusState var isSearchFieldFocused: Bool | |||
|
|||
@State var feedType: FeedType = .subscribed | |||
@AppStorage("selectedFeedType") var feedType: FeedType = .subscribed |
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.
does this still work when the caller is manually setting the feed type?
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.
following up; no, my implementation of selectedFeedType does not work correctly when manually setting the type (such as when viewing posts from a specific community rather than the main feed). In all cases it will use the value in AppStorage.
under Settings -> General ( |
FWIW I feel like at some point we should save this setting per feed type like Apollo. Some communities I like to sort by new, some by hot, etc. |
Heya @cdstamper, we have a new repo at https://github.com/mlemgroup/mlem, due to some shuffling around we couldn't get it migrated properly, but if you could reopen this PR there, and link it back here, then it can continue to be considered ^^ |
Checklist
Choose one of the following two options:
Choose one of the following two options:
Pull Request Information
About this Pull Request
This is a simple change to persist across app launches, using AppStorage:
SortingOptions
for the feed andFeedType
(All Posts, Subscribed, etc)Before this PR, each app launch will result in the feed resetting to the default Subscribed feed sorted by Hot. After this PR, the app will remember your last selected
FeedType
andSortingOptions
.Screenshots and Videos
There are no UI changes, it's completely transparent to the user.
Additional Context
This change was inspired by the last few days of using Mlem. As a new Lemmy user who hasn't subscribed to many communities, I prefer to browse the All Posts feed. The default Hot sort is not very useful in this case, as the content is essentially unchanged for the last several days. Remembering my last selected
FeedType
andSortingOptions
lets me get right into the app and start browsing.I considered adding a sort preference in Settings (to match the Default Comment Sort option that already exists). However I hesitate to add two different UIs for a single preference; it seems to me that allowing the user to pick their preferred sort in context makes a lot of sense, and it's reasonable to expect that the app would remember this preference. Happy to adjust the implementation if an explicit setting is preferred.
Similar for FeedType -- it just makes sense that the app would remember which feed you browse.
A note on NSUserDefault keys: it may be useful to consider scoping the preferences a bit more specifically. For example in the future it may be best to persist sort options (for example) for each applicable screen; user feeds may have a different preferred sort than the post feed. Or taking it a step further, users may expect All Posts to sort differently than Subscribed or Local feeds. I suggest a reverse-domain approach.