[core] banners dummy implementation

This commit is contained in:
Arsentiy Milchakov 2016-11-18 12:46:41 +03:00
parent 9838af3d45
commit 932f8e799e
4 changed files with 51 additions and 4 deletions

View file

@ -229,8 +229,8 @@ void initFieldsMap()
- (BOOL)isMyPosition { return m_info.IsMyPosition(); }
- (BOOL)isBookmark { return m_info.IsBookmark(); }
- (BOOL)isApi { return m_info.HasApiUrl(); }
- (BOOL)isBooking { return m_info.m_sponsoredType == SponsoredType::Booking; }
- (BOOL)isOpentable { return m_info.m_sponsoredType == SponsoredType::Opentable; }
- (BOOL)isBooking { return m_info.m_sponsoredType == place_page::SponsoredType::Booking; }
- (BOOL)isOpentable { return m_info.m_sponsoredType == place_page::SponsoredType::Opentable; }
- (BOOL)isSponsored { return m_info.IsSponsored(); }
- (NSString *)sponsoredId
{

View file

@ -784,6 +784,7 @@ void Framework::FillPointInfo(m2::PointD const & mercator, string const & custom
void Framework::FillInfoFromFeatureType(FeatureType const & ft, place_page::Info & info) const
{
using place_page::SponsoredType;
auto const featureStatus = osm::Editor::Instance().GetFeatureStatus(ft.GetID());
ASSERT_NOT_EQUAL(featureStatus, osm::Editor::FeatureStatus::Deleted,
("Deleted features cannot be selected from UI."));
@ -2042,6 +2043,7 @@ void Framework::InvalidateUserMarks()
void Framework::OnTapEvent(TapEvent const & tapEvent)
{
using place_page::SponsoredType;
auto const & tapInfo = tapEvent.m_info;
bool const somethingWasAlreadySelected = (m_lastTapEvent != nullptr);

View file

@ -36,6 +36,16 @@ bool Info::ShouldShowEditPlace() const
bool Info::HasApiUrl() const { return !m_apiUrl.empty(); }
bool Info::HasWifi() const { return GetInternet() == osm::Internet::Wlan; }
bool Info::HasBanner() const
{
// Dummy implementation.
// auto const now = time(nullptr);
// auto const bannerStartTime = strings::to_uint(m_metadata.Get(feature::Metadata::FMD_BANNER_FROM));
// auto const bannerEndTime = strings::to_uint(m_metadata.Get(feature::Metadata::FMD_BANNER_TO));
// return !(now < bannerStartTime || now > bannerEndTime);
return true;
}
string Info::FormatNewBookmarkName() const
{
string const title = GetTitle();
@ -162,5 +172,33 @@ string Info::GetApproximatePricing() const
return result;
}
string Info::GetBannerTitleId() const
{
// Dummy implementation.
//return m_metadata.Get(feature::Metadata::FMD_BANNER_ID) + "title";
return "title";
}
string Info::GetBannerMessageId() const
{
// Dummy implementation.
//return m_metadata.Get(feature::Metadata::FMD_BANNER_ID) + "message";
return "message";
}
string Info::GetBannerIconId() const
{
// Dummy implementation.
//return m_metadata.Get(feature::Metadata::FMD_BANNER_ID) + "icon";
return "icon";
}
string Info::GetBannerUrl() const
{
// Dummy implementation.
//return m_metadata.Get(feature::Metadata::FMD_BANNER_URL);
return "url";
}
void Info::SetMercator(m2::PointD const & mercator) { m_mercator = mercator; }
} // namespace place_page

View file

@ -14,6 +14,8 @@
#include "std/string.hpp"
namespace place_page
{
enum class SponsoredType
{
None,
@ -22,8 +24,6 @@ enum class SponsoredType
Geochat
};
namespace place_page
{
class Info : public osm::MapObject
{
public:
@ -77,6 +77,13 @@ public:
/// @returns string with |kPricingSymbol| signs or empty string if it isn't booking object
string GetApproximatePricing() const;
/// Returns true, if the current time is within the working range of the banner.
bool HasBanner() const;
string GetBannerTitleId() const;
string GetBannerMessageId() const;
string GetBannerIconId() const;
string GetBannerUrl() const;
void SetMercator(m2::PointD const & mercator);
/// Comes from API, shared links etc.