Skip to content
Snippets Groups Projects
Commit de6514ce authored by Emircan Duman's avatar Emircan Duman
Browse files

#52 put new function sortArticlesByShowInMain, sortArticlesByShownInMain get...

#52 put new function sortArticlesByShowInMain, sortArticlesByShownInMain get called when toggle is used on FeedEditSettingsView, fixed small bugs
parent 9aed92b1
No related branches found
No related tags found
No related merge requests found
......@@ -47,15 +47,24 @@ struct FeedEditSettingsView: View {
HStack{
Toggle("Show in Main Feed", isOn: $show_in_main)
.onAppear(){
show_in_main = feed.show_in_main
}
.onChange(of: show_in_main){value in
feed.show_in_main = value
print("Called toggle Show in Main Feed = \(feed.show_in_main)")
}
.onDisappear(){
Model.shared.sortArticlesByShowInMain()
}
.padding(.horizontal,20.0)
}
HStack{
Toggle("Use Filters",isOn: $use_filters)
.onAppear(){
show_in_main = feed.show_in_main
}
.onChange(of: use_filters){value in
feed.use_filters = value
print("Called toggle User Filters = \(feed.use_filters)")
......
......@@ -102,6 +102,16 @@ final class Model: ObservableObject {
}
}
/**
Sorts @filtered_article_data by the show_in_main value in feeds and updates the @filtered_article_data list
*/
func sortArticlesByShowInMain(){
sortArticlesByDate()
filtered_article_data.removeAll{
$0.parent_feeds[0].show_in_main == false
}
}
/**
Adds new feed to the model
- Parameter url: The URL of the feed thats supposed to be added
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment