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

Remember selected sorting options #209

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ struct CommunityView: View
@State var community: APICommunity?
@State var communityDetails: GetCommunityResponse?

@State private var selectedSortingOption: SortingOptions = .hot
@AppStorage("selectedSortingOption") private var selectedSortingOption: SortingOptions = .hot

@State private var isSidebarShown: Bool = false
@State private var isShowingCommunitySearch: Bool = false
Expand All @@ -36,7 +36,7 @@ struct CommunityView: View

@FocusState var isSearchFieldFocused: Bool

@State var feedType: FeedType = .subscribed
@AppStorage("selectedFeedType") var feedType: FeedType = .subscribed
Copy link
Collaborator

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?

Copy link
Contributor Author

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.


@State private var isComposingPost: Bool = false
@State private var newPostTitle: String = ""
Expand Down