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:
authorArsentiy Milchakov <milcars@mapswithme.com>2016-10-18 15:12:04 +0300
committerArsentiy Milchakov <milcars@mapswithme.com>2016-10-21 20:27:37 +0300
commit6837b685335a30ab3861370926c17436d9e434c3 (patch)
tree7193f2f5ee489823a3713301b8b07ef3c0aca668 /map
parentf179d5cd0dd33c5dbe33f178ada3d0bbd111f0b5 (diff)
opentable is added into placepage
Diffstat (limited to 'map')
-rw-r--r--map/framework.cpp17
-rw-r--r--map/place_page_info.cpp9
-rw-r--r--map/place_page_info.hpp22
3 files changed, 29 insertions, 19 deletions
diff --git a/map/framework.cpp b/map/framework.cpp
index 110352c18a..2429def14d 100644
--- a/map/framework.cpp
+++ b/map/framework.cpp
@@ -789,17 +789,22 @@ 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;
+ info.m_sponsoredType = SponsoredType::Booking;
string const & baseUrl = info.GetMetadata().Get(feature::Metadata::FMD_WEBSITE);
- info.m_sponsoredBookingUrl = GetBookingApi().GetBookingUrl(baseUrl);
+ info.m_sponsoredUrl = GetBookingApi().GetBookingUrl(baseUrl);
info.m_sponsoredDescriptionUrl = GetBookingApi().GetDescriptionUrl(baseUrl);
}
+ else if (ftypes::IsOpentableChecker::Instance()(ft))
+ {
+ info.m_sponsoredType = SponsoredType::Opentable;
+ info.m_sponsoredUrl = info.GetMetadata().Get(feature::Metadata::FMD_WEBSITE);
+ }
+
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");
@@ -1979,7 +1984,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);
@@ -2055,7 +2060,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..2d5e30b1bf 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();
@@ -116,12 +115,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 +139,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.