Skip to content
This repository was archived by the owner on Oct 11, 2022. It is now read-only.

Conversation

@robertmogos
Copy link
Collaborator

No description provided.

@robertmogos robertmogos requested a review from spinach October 16, 2017 12:59
}

struct Geo {
static let minimalDistance: Double = 250
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ubernit: add // 250 km

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

removeAnnotations(annotations)

let searchParams = userInfo["params"] as? SearchParameters
if searchParams == nil || searchParams?.page == 0 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably an opportunity here to add some helper to check if there are search parameters or not. We can do a better developer experience for geo-search related features (we already discussed this live, maybe it's a good idea to add an Asana task

import MapKit
import InstantSearch
import InstantSearchCore
import AlgoliaSearch
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be best to hide AlgoliaSearch from developers (unless they really want to dig in deep). All "high level" functionalities should be surfaced from InstantSearch (stating the obvious I know...)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

// PRGRoundRangeSlider.swift
// PRGRoundSliderTest
//
// Created by John Spiropoulos on 20/03/2017.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we're keeping those to give credit? not sure here

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's for giving credit


class RadiusController: UIViewController {
@IBOutlet weak var slider: PRGRoundSlider!
let searcher: Searcher
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're sure to have a searcher (or this component does not make sense). So you can force unwrap like you did for the slider

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for force unwrapping since it's initialised in the constructer

slider.value = CGFloat((existingValue - Geo.startRadius) / (Geo.endRadius - Geo.startRadius))
slider.messageForValue = { [weak searcher] value in
let meters = round(Geo.startRadius + Double(value) * (Geo.endRadius - Geo.startRadius))
searcher?.params.aroundRadius = Query.AroundRadius.explicit(UInt(meters))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove the "?" after force unwrapping

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I passed a weak reference to the searcher in the closure, hence the ?.

formatter.string(fromValue: meters, unit: .meter)
}

// Do any additional setup after loading the view.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: remove

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
searcher.search()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't it better to load results everytime the radius finishes changing value, so that we can update the map in realtime?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussed 1:1

newLocation.distance(from: lastSearchLocation!) >= Geo.minimalDistance {
lastSearchLocation = locations.last
updateResultsWithLocation()
return
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: remove return

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@robertmogos robertmogos merged commit 7a20a94 into master Oct 16, 2017
@VladislavFitz VladislavFitz deleted the icebnb_geosearch branch November 8, 2021 08:38
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants