Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/map
diff options
context:
space:
mode:
Diffstat (limited to 'map')
-rw-r--r--map/framework.cpp45
-rw-r--r--map/place_page_info.cpp14
-rw-r--r--map/place_page_info.hpp22
3 files changed, 46 insertions, 35 deletions
diff --git a/map/framework.cpp b/map/framework.cpp
index ed7fe76bb6..32fa8aba04 100644
--- a/map/framework.cpp
+++ b/map/framework.cpp
@@ -6,6 +6,7 @@
#include "map/user_mark.hpp"
#include "defines.hpp"
+#include "private.h"
#include "routing/online_absent_fetcher.hpp"
#include "routing/osrm_router.hpp"
@@ -74,6 +75,8 @@
#include "geometry/rect2d.hpp"
#include "geometry/triangle2d.hpp"
+#include "partners_api/opentable_api.hpp"
+
#include "base/logging.hpp"
#include "base/math.hpp"
#include "base/scope_guard.hpp"
@@ -156,17 +159,6 @@ void CancelQuery(weak_ptr<search::ProcessorHandle> & handle)
queryHandle->Cancel();
handle.reset();
}
-
-class StubSocket final : public platform::Socket
-{
-public:
- // Socket overrides
- bool Open(string const & host, uint16_t port) override { return false; }
- void Close() override {}
- bool Read(uint8_t * data, uint32_t count) override { return false; }
- bool Write(uint8_t const * data, uint32_t count) override { return false; }
- void SetTimeout(uint32_t milliseconds) override {}
-};
} // namespace
pair<MwmSet::MwmId, MwmSet::RegResult> Framework::RegisterMap(
@@ -246,9 +238,9 @@ bool Framework::IsTrackingReporterEnabled() const
if (!m_routingSession.IsOnRoute())
return false;
- bool allowStat = false;
- UNUSED_VALUE(settings::Get(tracking::Reporter::kEnabledSettingsKey, allowStat));
- return allowStat;
+ bool enableTracking = false;
+ UNUSED_VALUE(settings::Get(tracking::Reporter::kEnableTrackingKey, enableTracking));
+ return enableTracking;
}
void Framework::OnUserPositionChanged(m2::PointD const & position)
@@ -341,7 +333,8 @@ Framework::Framework()
, m_storage(platform::migrate::NeedMigrate() ? COUNTRIES_OBSOLETE_FILE : COUNTRIES_FILE)
, m_bmManager(*this)
, m_isRenderingEnabled(true)
- , m_trackingReporter(make_unique<StubSocket>(), tracking::Reporter::kPushDelayMs)
+ , m_trackingReporter(platform::CreateSocket(), TRACKING_REALTIME_HOST, TRACKING_REALTIME_PORT,
+ tracking::Reporter::kPushDelayMs)
, m_displacementModeManager([this](bool show) {
int const mode = show ? dp::displacement::kHotelMode : dp::displacement::kDefaultMode;
CallDrapeFunction(bind(&df::DrapeEngine::SetDisplacementMode, _1, mode));
@@ -790,17 +783,25 @@ void Framework::FillInfoFromFeatureType(FeatureType const & ft, place_page::Info
if (ftypes::IsAddressObjectChecker::Instance()(ft))
info.m_address = GetAddressInfoAtPoint(feature::GetCenter(ft)).FormatHouseAndStreet();
- info.m_isHotel = ftypes::IsHotelChecker::Instance()(ft);
if (ftypes::IsBookingChecker::Instance()(ft))
{
- info.m_isSponsoredHotel = true;
- string const & baseUrl = info.GetMetadata().Get(feature::Metadata::FMD_WEBSITE);
- info.m_sponsoredBookingUrl = GetBookingApi().GetBookingUrl(baseUrl);
+ info.m_sponsoredType = SponsoredType::Booking;
+ auto const & baseUrl = info.GetMetadata().Get(feature::Metadata::FMD_WEBSITE);
+ info.m_sponsoredUrl = GetBookingApi().GetBookHotelUrl(baseUrl);
info.m_sponsoredDescriptionUrl = GetBookingApi().GetDescriptionUrl(baseUrl);
}
+ else if (ftypes::IsOpentableChecker::Instance()(ft))
+ {
+ info.m_sponsoredType = SponsoredType::Opentable;
+ auto const & sponsoredId = info.GetMetadata().Get(feature::Metadata::FMD_SPONSORED_ID);
+ auto const & url = opentable::Api::GetBookTableUrl(sponsoredId);
+ info.m_sponsoredUrl = url;
+ info.m_sponsoredDescriptionUrl = url;
+ }
+
info.m_canEditOrAdd = featureStatus != osm::Editor::FeatureStatus::Obsolete && CanEditMap() &&
- !info.IsSponsoredHotel();
+ !info.IsSponsored();
info.m_localizedWifiString = m_stringsBundle.GetString("wifi");
info.m_localizedRatingString = m_stringsBundle.GetString("place_page_booking_rating");
@@ -1984,7 +1985,7 @@ void Framework::ActivateMapSelection(bool needAnimation, df::SelectionShape::ESe
CallDrapeFunction(bind(&df::DrapeEngine::SelectObject, _1, selectionType, info.GetMercator(), info.GetID(),
needAnimation));
- SetDisplacementMode(DisplacementModeManager::SLOT_MAP_SELECTION, info.IsHotel() /* show */);
+ SetDisplacementMode(DisplacementModeManager::SLOT_MAP_SELECTION, ftypes::IsHotelChecker::Instance()(info.GetTypes()) /* show */);
if (m_activateMapSelectionFn)
m_activateMapSelectionFn(info);
@@ -2060,7 +2061,7 @@ void Framework::OnTapEvent(TapEvent const & tapEvent)
// Older version of statistics used "$GetUserMark" event.
alohalytics::Stats::Instance().LogEvent("$SelectMapObject", kv, alohalytics::Location::FromLatLon(ll.lat, ll.lon));
- if (info.IsHotel())
+ if (info.m_sponsoredType == SponsoredType::Booking)
GetPlatform().SendMarketingEvent("Placepage_Hotel_book", {{"provider", "booking.com"}});
}
diff --git a/map/place_page_info.cpp b/map/place_page_info.cpp
index 8e63bc5803..9cd2997405 100644
--- a/map/place_page_info.cpp
+++ b/map/place_page_info.cpp
@@ -16,8 +16,7 @@ char const * const Info::kPricingSymbol = "$";
bool Info::IsFeature() const { return m_featureID.IsValid(); }
bool Info::IsBookmark() const { return m_bac.IsValid(); }
bool Info::IsMyPosition() const { return m_isMyPosition; }
-bool Info::IsSponsoredHotel() const { return m_isSponsoredHotel; }
-bool Info::IsHotel() const { return m_isHotel; }
+bool Info::IsSponsored() const { return m_sponsoredType != SponsoredType::None; }
bool Info::ShouldShowAddPlace() const
{
auto const isPointOrBuilding = IsPointType() || IsBuilding();
@@ -73,6 +72,11 @@ string Info::GetSubtitle() const
// Type.
values.push_back(GetLocalizedType());
+ // Flats.
+ string const flats = GetFlats();
+ if (!flats.empty())
+ values.push_back(flats);
+
// Cuisines.
for (string const & cuisine : GetLocalizedCuisines())
values.push_back(cuisine);
@@ -116,12 +120,12 @@ BookmarkAndCategory Info::GetBookmarkAndCategory() const { return m_bac; }
string Info::GetBookmarkCategoryName() const { return m_bookmarkCategoryName; }
string const & Info::GetApiUrl() const { return m_apiUrl; }
-string const & Info::GetSponsoredBookingUrl() const { return m_sponsoredBookingUrl; }
+string const & Info::GetSponsoredUrl() const { return m_sponsoredUrl; }
string const & Info::GetSponsoredDescriptionUrl() const {return m_sponsoredDescriptionUrl; }
string Info::GetRatingFormatted() const
{
- if (!IsSponsoredHotel())
+ if (!IsSponsored())
return string();
auto const r = GetMetadata().Get(feature::Metadata::FMD_RATING);
@@ -140,7 +144,7 @@ string Info::GetRatingFormatted() const
string Info::GetApproximatePricing() const
{
- if (!IsSponsoredHotel())
+ if (!IsSponsored())
return string();
int pricing;
diff --git a/map/place_page_info.hpp b/map/place_page_info.hpp
index 2a150f4b43..29f9bc42be 100644
--- a/map/place_page_info.hpp
+++ b/map/place_page_info.hpp
@@ -14,6 +14,14 @@
#include "std/string.hpp"
+enum class SponsoredType
+{
+ None,
+ Booking,
+ Opentable,
+ Geochat
+};
+
namespace place_page
{
class Info : public osm::MapObject
@@ -28,8 +36,7 @@ public:
bool IsFeature() const;
bool IsBookmark() const;
bool IsMyPosition() const;
- bool IsSponsoredHotel() const;
- bool IsHotel() const;
+ bool IsSponsored() const;
bool ShouldShowAddPlace() const;
bool ShouldShowAddBusiness() const;
@@ -62,7 +69,7 @@ public:
string GetBookmarkCategoryName() const;
string const & GetApiUrl() const;
- string const & GetSponsoredBookingUrl() const;
+ string const & GetSponsoredUrl() const;
string const & GetSponsoredDescriptionUrl() const;
/// @returns formatted rating string for booking object, or empty if it isn't booking object
@@ -90,12 +97,11 @@ public:
string m_apiUrl;
/// Formatted feature address.
string m_address;
- /// Feature is a hotel.
- bool m_isHotel = false;
- /// Feature is a sponsored hotel.
- bool m_isSponsoredHotel = false;
+ /// Sponsored type or None.
+ SponsoredType m_sponsoredType = SponsoredType::None;
+
/// Sponsored feature urls.
- string m_sponsoredBookingUrl;
+ string m_sponsoredUrl;
string m_sponsoredDescriptionUrl;
/// Which country this MapObject is in.