-
Notifications
You must be signed in to change notification settings - Fork 7
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
configure default map filter mode #420
base: master
Are you sure you want to change the base?
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.
This code has to be moved to the app repo now, since Charcoal has been moved there 😄
case .radius: | ||
selectedViewController = mapRadiusFilterViewController | ||
} | ||
|
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.
hmm, this ended up being more complicated than it needs to be because of the computed property and needing to call the same function also later in the setup function. Right now we set the default view controller 3 times.
What if we change things a bit.
We can simply do one single thing in init: set the selectedViewController
to whatever is defaultMapMode
.
We can remove defaultMapMode
variable in the class, there's no need to change it later.
Then in setup
, we can simply change the default view controller to whatever filter is selected, but if no filter is selected, do nothing. If we do nothing there, the default view controller will still be selected. So we don't need an else there. (then we can also delete the setMapViewToDefaultMode
function)
Does this make sense to you? 😄
So we only need to have this logic in one place where it is needed, and that is in init.
|
||
public init(title: String, latitudeFilter: Filter, longitudeFilter: Filter, radiusFilter: Filter, | ||
locationNameFilter: Filter, bboxFilter: Filter?, polygonFilter: Filter?, selectionStore: FilterSelectionStore) { | ||
locationNameFilter: Filter, bboxFilter: Filter?, polygonFilter: Filter?, defaultMode: MapFilterMode = .radius, selectionStore: FilterSelectionStore) { |
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.
Can we change the param name to defaultMapMode
so it's easy to see what it means on caller side?
Why?
we would like to have polygon search as the default, so adding the possibility to configure the default map filter mode.
also see https://github.schibsted.io/finn/ios-app/pull/6200 for context
What?
added an enum to the initialiser and removed a function in setup that seemed redundant.
Show me