forked from organicmaps/organicmaps
[mock] Hotels in discovery manager.
This commit is contained in:
parent
a0ff36bf48
commit
09124f9f55
2 changed files with 17 additions and 6 deletions
|
@ -39,6 +39,19 @@ search::SearchParams Manager::GetSearchParams(Manager::Params const & params, It
|
|||
return p;
|
||||
}
|
||||
|
||||
// static
|
||||
search::SearchParams Manager::GetBookingSearchParamsForTesting()
|
||||
{
|
||||
search::SearchParams p;
|
||||
p.m_query = GetQuery(ItemType::Hotels);
|
||||
p.m_inputLocale = "en";
|
||||
p.m_viewport = {37.568808916849733, 67.451852658402345, 37.632819283150269, 67.515833479171874};
|
||||
p.m_position = {{37.6008141, 67.4838356}};
|
||||
p.m_maxNumResults = 6;
|
||||
p.m_mode = search::Mode::Viewport;
|
||||
return p;
|
||||
}
|
||||
|
||||
std::string Manager::GetViatorUrl(m2::PointD const & point) const
|
||||
{
|
||||
auto const viatorId = GetCityViatorId(point);
|
||||
|
|
|
@ -106,8 +106,9 @@ public:
|
|||
}
|
||||
case ItemType::Attractions: // fallthrough
|
||||
case ItemType::Cafes:
|
||||
case ItemType::Hotels:
|
||||
{
|
||||
auto p = GetSearchParams(params, type);
|
||||
auto p = type == ItemType::Hotels ? GetBookingSearchParamsForTesting() : GetSearchParams(params, type);
|
||||
auto const viewportCenter = params.m_viewportCenter;
|
||||
p.m_onResults = [requestId, onResult, type, viewportCenter](search::Results const & results) {
|
||||
if (!results.IsEndMarker())
|
||||
|
@ -120,11 +121,6 @@ public:
|
|||
m_searchApi.GetEngine().Search(p);
|
||||
break;
|
||||
}
|
||||
case ItemType::Hotels:
|
||||
{
|
||||
ASSERT(false, ("Discovering hotels isn't supported yet."));
|
||||
break;
|
||||
}
|
||||
case ItemType::LocalExperts:
|
||||
{
|
||||
auto const latLon = MercatorBounds::ToLatLon(params.m_viewportCenter);
|
||||
|
@ -153,6 +149,8 @@ public:
|
|||
|
||||
private:
|
||||
static search::SearchParams GetSearchParams(Params const & params, ItemType const type);
|
||||
// TODO: Remove this method when real implementation will be ready.
|
||||
static search::SearchParams GetBookingSearchParamsForTesting();
|
||||
std::string GetCityViatorId(m2::PointD const & point) const;
|
||||
|
||||
Index const & m_index;
|
||||
|
|
Loading…
Add table
Reference in a new issue