forked from organicmaps/organicmaps
[booking] Add methods for getting sponsored urls for place page
This commit is contained in:
parent
7e9b9d9682
commit
79da2f91d1
3 changed files with 14 additions and 0 deletions
|
@ -744,7 +744,12 @@ void Framework::FillInfoFromFeatureType(FeatureType const & ft, place_page::Info
|
|||
info.m_address = GetAddressInfoAtPoint(feature::GetCenter(ft)).FormatHouseAndStreet();
|
||||
|
||||
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_sponsoredDescriptionUrl = GetBookingApi().GetDescriptionUrl(baseUrl);
|
||||
}
|
||||
|
||||
info.m_isEditable = featureStatus != osm::Editor::FeatureStatus::Obsolete &&
|
||||
!info.IsSponsoredHotel();
|
||||
|
|
|
@ -101,6 +101,9 @@ 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::GetSponsoredDescriptionUrl() const {return m_sponsoredDescriptionUrl; }
|
||||
|
||||
string Info::GetRatingFormatted() const
|
||||
{
|
||||
if (!IsSponsoredHotel())
|
||||
|
|
|
@ -56,6 +56,9 @@ public:
|
|||
string GetBookmarkCategoryName() const;
|
||||
string const & GetApiUrl() const;
|
||||
|
||||
string const & GetSponsoredBookingUrl() const;
|
||||
string const & GetSponsoredDescriptionUrl() const;
|
||||
|
||||
/// @returns formatted rating string for booking object, or empty if it isn't booking object
|
||||
string GetRatingFormatted() const;
|
||||
/// @returns string with |kPricingSymbol| signs or empty string if it isn't booking object
|
||||
|
@ -77,6 +80,9 @@ public:
|
|||
string m_address;
|
||||
/// Feature is a sponsored hotel.
|
||||
bool m_isSponsoredHotel = false;
|
||||
/// Sponsored feature urls.
|
||||
string m_sponsoredBookingUrl;
|
||||
string m_sponsoredDescriptionUrl;
|
||||
|
||||
/// Which country this MapObject is in.
|
||||
/// For a country point it will be set to topmost node for country.
|
||||
|
|
Loading…
Add table
Reference in a new issue