From 4e15406cc2e14b94f32fc0a033e5732a0dc07d14 Mon Sep 17 00:00:00 2001 From: "r.kuznetsov" Date: Fri, 13 Oct 2017 17:40:53 +0300 Subject: [PATCH] Added Halloween sponsored objects --- .../com/mapswithme/maps/widget/placepage/PlacePageView.java | 3 ++- .../src/com/mapswithme/maps/widget/placepage/Sponsored.java | 3 ++- android/src/com/mapswithme/util/statistics/Statistics.java | 4 ++++ indexer/ftypes_sponsored.hpp | 1 + iphone/Maps/Common/Statistics/StatisticsStrings.h | 1 + iphone/Maps/UI/PlacePage/MWMPlacePageData.h | 1 + iphone/Maps/UI/PlacePage/MWMPlacePageData.mm | 1 + iphone/Maps/UI/PlacePage/MWMPlacePageManager.mm | 2 ++ map/framework.cpp | 5 +++++ map/place_page_info.hpp | 3 ++- 10 files changed, 21 insertions(+), 3 deletions(-) diff --git a/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java b/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java index 827624ef64..a696881643 100644 --- a/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java +++ b/android/src/com/mapswithme/maps/widget/placepage/PlacePageView.java @@ -1478,7 +1478,8 @@ public class PlacePageView extends RelativeLayout mTvSponsoredPrice.setText(mSponsoredPrice); UiUtils.showIf(!isPriceEmpty, mTvSponsoredPrice); UiUtils.showIf((!isRatingEmpty || !isPriceEmpty) && - mSponsored.getType() != Sponsored.TYPE_THOR, mPreviewRatingInfo); + mSponsored.getType() != Sponsored.TYPE_THOR && + mSponsored.getType() != Sponsored.TYPE_HALLOWEEN, mPreviewRatingInfo); } } diff --git a/android/src/com/mapswithme/maps/widget/placepage/Sponsored.java b/android/src/com/mapswithme/maps/widget/placepage/Sponsored.java index 793991bcb0..223daf83b8 100644 --- a/android/src/com/mapswithme/maps/widget/placepage/Sponsored.java +++ b/android/src/com/mapswithme/maps/widget/placepage/Sponsored.java @@ -29,10 +29,11 @@ public final class Sponsored public static final int TYPE_VIATOR = 4; public static final int TYPE_CIAN = 5; public static final int TYPE_THOR = 6; + public static final int TYPE_HALLOWEEN = 7; @Retention(RetentionPolicy.SOURCE) @IntDef({ TYPE_NONE, TYPE_BOOKING, TYPE_OPENTABLE, TYPE_GEOCHAT, - TYPE_VIATOR, TYPE_CIAN, TYPE_THOR }) + TYPE_VIATOR, TYPE_CIAN, TYPE_THOR, TYPE_HALLOWEEN }) public @interface SponsoredType {} private static class Price diff --git a/android/src/com/mapswithme/util/statistics/Statistics.java b/android/src/com/mapswithme/util/statistics/Statistics.java index a69acf6d3e..79c758e489 100644 --- a/android/src/com/mapswithme/util/statistics/Statistics.java +++ b/android/src/com/mapswithme/util/statistics/Statistics.java @@ -95,6 +95,7 @@ import static com.mapswithme.util.statistics.Statistics.ParamValue.GEOCHAT; import static com.mapswithme.util.statistics.Statistics.ParamValue.OPENTABLE; import static com.mapswithme.util.statistics.Statistics.ParamValue.SEARCH_BOOKING_COM; import static com.mapswithme.util.statistics.Statistics.ParamValue.THOR; +import static com.mapswithme.util.statistics.Statistics.ParamValue.HALLOWEEN; import static com.mapswithme.util.statistics.Statistics.ParamValue.VIATOR; public enum Statistics @@ -368,6 +369,7 @@ public enum Statistics public static final String GEOCHAT = "Geochat"; public static final String CIAN = "Cian.Ru"; public static final String THOR = "Thor"; + public static final String HALLOWEEN = "Halloween"; public static final String NO_PRODUCTS = "no_products"; public static final String ADD = "add"; public static final String EDIT = "edit"; @@ -811,6 +813,8 @@ public enum Statistics return CIAN; case Sponsored.TYPE_THOR: return THOR; + case Sponsored.TYPE_HALLOWEEN: + return HALLOWEEN; case Sponsored.TYPE_NONE: return "N/A"; default: diff --git a/indexer/ftypes_sponsored.hpp b/indexer/ftypes_sponsored.hpp index b126b57ee8..7e814cf8c0 100644 --- a/indexer/ftypes_sponsored.hpp +++ b/indexer/ftypes_sponsored.hpp @@ -22,6 +22,7 @@ SPONSORED_CHECKER(IsBookingChecker, "booking"); SPONSORED_CHECKER(IsOpentableChecker, "opentable"); SPONSORED_CHECKER(IsViatorChecker, "viator"); SPONSORED_CHECKER(IsThorChecker, "thor"); +SPONSORED_CHECKER(IsHalloweenChecker, "halloween"); #undef SPONSORED_CHECKER } // namespace ftypes diff --git a/iphone/Maps/Common/Statistics/StatisticsStrings.h b/iphone/Maps/Common/Statistics/StatisticsStrings.h index 3e32df8af2..e505d11125 100644 --- a/iphone/Maps/Common/Statistics/StatisticsStrings.h +++ b/iphone/Maps/Common/Statistics/StatisticsStrings.h @@ -116,6 +116,7 @@ static NSString * const kStatFromLocation = @"from_location"; static NSString * const kStatFromMyPosition = @"From my position"; static NSString * const kStatGo = @"Go"; static NSString * const kStatGoogle = @"Google"; +static NSString * const kStatHalloween = @"Halloween"; static NSString * const kStatHelp = @"Help"; static NSString * const kStatHidden = @"Hidden"; static NSString * const kStatHistory = @"History"; diff --git a/iphone/Maps/UI/PlacePage/MWMPlacePageData.h b/iphone/Maps/UI/PlacePage/MWMPlacePageData.h index ed5c8d7f12..be7d0f0afc 100644 --- a/iphone/Maps/UI/PlacePage/MWMPlacePageData.h +++ b/iphone/Maps/UI/PlacePage/MWMPlacePageData.h @@ -247,6 +247,7 @@ using CianIsReady = void (^)(NSArray * items); - (BOOL)isViator; - (BOOL)isCian; - (BOOL)isThor; +- (BOOL)isHalloween; - (BOOL)isBookingSearch; - (BOOL)isHTMLDescription; - (BOOL)isMyPosition; diff --git a/iphone/Maps/UI/PlacePage/MWMPlacePageData.mm b/iphone/Maps/UI/PlacePage/MWMPlacePageData.mm index 4eee96608a..f6344794df 100644 --- a/iphone/Maps/UI/PlacePage/MWMPlacePageData.mm +++ b/iphone/Maps/UI/PlacePage/MWMPlacePageData.mm @@ -766,6 +766,7 @@ using namespace place_page; - (BOOL)isViator { return m_info.GetSponsoredType() == SponsoredType::Viator; } - (BOOL)isCian { return m_info.GetSponsoredType() == SponsoredType::Cian; } - (BOOL)isThor { return m_info.GetSponsoredType() == SponsoredType::Thor; } +- (BOOL)isHalloween { return m_info.GetSponsoredType() == SponsoredType::Halloween; } - (BOOL)isBookingSearch { return !m_info.GetBookingSearchUrl().empty(); } - (BOOL)isMyPosition { return m_info.IsMyPosition(); } - (BOOL)isHTMLDescription { return strings::IsHTML(m_info.GetBookmarkData().GetDescription()); } diff --git a/iphone/Maps/UI/PlacePage/MWMPlacePageManager.mm b/iphone/Maps/UI/PlacePage/MWMPlacePageManager.mm index a9626c0800..9bf87d70bf 100644 --- a/iphone/Maps/UI/PlacePage/MWMPlacePageManager.mm +++ b/iphone/Maps/UI/PlacePage/MWMPlacePageManager.mm @@ -254,6 +254,8 @@ void logSponsoredEvent(MWMPlacePageData * data, NSString * eventName) parameters[kStatProvider] = kStatCian; else if (data.isThor) parameters[kStatProvider] = kStatThor; + else if (data.isHalloween) + parameters[kStatProvider] = kStatHalloween; switch (Platform::ConnectionStatus()) { case Platform::EConnectionType::CONNECTION_NONE: diff --git a/map/framework.cpp b/map/framework.cpp index d8c9a3c1cc..b1f1604f0a 100644 --- a/map/framework.cpp +++ b/map/framework.cpp @@ -916,6 +916,11 @@ void Framework::FillInfoFromFeatureType(FeatureType const & ft, place_page::Info info.SetSponsoredDescriptionUrl(url); GetPlatform().GetMarketingService().SendPushWooshTag(marketing::kSponsoredThorDiscovered); } + else if (ftypes::IsHalloweenChecker::Instance()(ft) && + !info.GetMetadata().Get(feature::Metadata::FMD_RATING).empty()) + { + info.SetSponsoredType(place_page::SponsoredType::Halloween); + } FillLocalExperts(ft, info); diff --git a/map/place_page_info.hpp b/map/place_page_info.hpp index bb56da78ec..9e2f87fe1b 100644 --- a/map/place_page_info.hpp +++ b/map/place_page_info.hpp @@ -39,7 +39,8 @@ enum class SponsoredType Geochat, Viator, Cian, - Thor + Thor, + Halloween }; enum class LocalAdsStatus