From 8dd1e8805a221917a229431cf930f02fd193663d Mon Sep 17 00:00:00 2001 From: Aleksey Belouosv Date: Wed, 11 Dec 2019 04:26:38 +0300 Subject: [PATCH] [iOS] [refactoring] Add banner to PP, add PP states, polish UI --- .../CoreApi/CoreApi.xcodeproj/project.pbxproj | 20 ++ iphone/CoreApi/CoreApi/CoreApi-swift.h | 1 + .../PlacePageData/Ad/CoreBanner+Core.h | 13 + .../CoreApi/PlacePageData/Ad/CoreBanner.h | 29 ++ .../CoreApi/PlacePageData/Ad/CoreBanner.mm | 50 +++ .../Common/PlacePagePreviewData.h | 3 +- .../Common/PlacePagePreviewData.mm | 9 + .../CoreApi/PlacePageData/PlacePageData.h | 1 + .../CoreApi/PlacePageData/PlacePageData.mm | 1 + iphone/Maps/Bridging-Header.h | 1 - iphone/Maps/Classes/MapViewController.h | 2 + iphone/Maps/Core/Ads/CoreBanner.swift | 23 -- iphone/Maps/Core/Ads/MWMBanner.h | 11 - iphone/Maps/Core/Ads/MWMBannerHelpers.h | 15 +- iphone/Maps/Core/Search/MWMSearch.h | 1 - iphone/Maps/Maps.xcodeproj/project.pbxproj | 26 +- iphone/Maps/UI/Ads/AdBanner.swift | 29 -- iphone/Maps/UI/Ads/AdBannerView.swift | 263 +++++++++++++++ iphone/Maps/UI/Ads/AdBannerView.xib | 300 ++++++++++++++++++ iphone/Maps/UI/PlacePage/MWMPlacePageData.mm | 1 + .../Maps/UI/PlacePage/MWMPlacePageManager.mm | 4 + .../UI/PlacePage/MWMPlacePageManagerHelper.h | 1 + .../UI/PlacePage/MWMPlacePageManagerHelper.mm | 5 + iphone/Maps/UI/PlacePage/PlacePage.storyboard | 126 +++++++- .../PlacePageInfoViewController.swift | 39 ++- .../PlacePage/PlacePageLayout/ContextViews.mm | 29 -- .../{ContextViews.h => CopyLabel.h} | 0 .../UI/PlacePage/PlacePageLayout/CopyLabel.m | 25 ++ .../PlacePagePreviewViewController.swift | 17 +- .../PlacePage/PlacePageViewController.swift | 162 +++++++++- 30 files changed, 1071 insertions(+), 136 deletions(-) create mode 100644 iphone/CoreApi/CoreApi/PlacePageData/Ad/CoreBanner+Core.h create mode 100644 iphone/CoreApi/CoreApi/PlacePageData/Ad/CoreBanner.h create mode 100644 iphone/CoreApi/CoreApi/PlacePageData/Ad/CoreBanner.mm delete mode 100644 iphone/Maps/Core/Ads/CoreBanner.swift delete mode 100644 iphone/Maps/Core/Ads/MWMBanner.h create mode 100644 iphone/Maps/UI/Ads/AdBannerView.swift create mode 100644 iphone/Maps/UI/Ads/AdBannerView.xib delete mode 100755 iphone/Maps/UI/PlacePage/PlacePageLayout/ContextViews.mm rename iphone/Maps/UI/PlacePage/PlacePageLayout/{ContextViews.h => CopyLabel.h} (100%) create mode 100755 iphone/Maps/UI/PlacePage/PlacePageLayout/CopyLabel.m diff --git a/iphone/CoreApi/CoreApi.xcodeproj/project.pbxproj b/iphone/CoreApi/CoreApi.xcodeproj/project.pbxproj index 009bf9ec03..59808184b4 100644 --- a/iphone/CoreApi/CoreApi.xcodeproj/project.pbxproj +++ b/iphone/CoreApi/CoreApi.xcodeproj/project.pbxproj @@ -17,6 +17,9 @@ 471AB98D23AB925D00F56D49 /* MWMMapSearchResult.h in Headers */ = {isa = PBXBuildFile; fileRef = 471AB98B23AB925D00F56D49 /* MWMMapSearchResult.h */; settings = {ATTRIBUTES = (Public, ); }; }; 471AB98E23AB925D00F56D49 /* MWMMapSearchResult.mm in Sources */ = {isa = PBXBuildFile; fileRef = 471AB98C23AB925D00F56D49 /* MWMMapSearchResult.mm */; }; 471AB99123AB931000F56D49 /* MWMMapSearchResult+Core.h in Headers */ = {isa = PBXBuildFile; fileRef = 471AB98F23AB931000F56D49 /* MWMMapSearchResult+Core.h */; }; + 4738A8E0239FACE7007C0F43 /* CoreBanner.h in Headers */ = {isa = PBXBuildFile; fileRef = 4738A8DE239FACE7007C0F43 /* CoreBanner.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 4738A8E1239FACE7007C0F43 /* CoreBanner.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4738A8DF239FACE7007C0F43 /* CoreBanner.mm */; }; + 4738A8E4239FB46E007C0F43 /* CoreBanner+Core.h in Headers */ = {isa = PBXBuildFile; fileRef = 4738A8E2239FB46E007C0F43 /* CoreBanner+Core.h */; }; 475784C22344B422008291A4 /* Framework.h in Headers */ = {isa = PBXBuildFile; fileRef = 475784C02344B421008291A4 /* Framework.h */; settings = {ATTRIBUTES = (Public, ); }; }; 475784C32344B422008291A4 /* Framework.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 475784C12344B422008291A4 /* Framework.cpp */; }; 47938905239A932D006ECACC /* UgcSummaryRatingType.h in Headers */ = {isa = PBXBuildFile; fileRef = 47938904239A92F8006ECACC /* UgcSummaryRatingType.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -133,6 +136,9 @@ 471AB98B23AB925D00F56D49 /* MWMMapSearchResult.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MWMMapSearchResult.h; sourceTree = ""; }; 471AB98C23AB925D00F56D49 /* MWMMapSearchResult.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMMapSearchResult.mm; sourceTree = ""; }; 471AB98F23AB931000F56D49 /* MWMMapSearchResult+Core.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "MWMMapSearchResult+Core.h"; sourceTree = ""; }; + 4738A8DE239FACE7007C0F43 /* CoreBanner.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CoreBanner.h; sourceTree = ""; }; + 4738A8DF239FACE7007C0F43 /* CoreBanner.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = CoreBanner.mm; sourceTree = ""; }; + 4738A8E2239FB46E007C0F43 /* CoreBanner+Core.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "CoreBanner+Core.h"; sourceTree = ""; }; 475784C02344B421008291A4 /* Framework.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Framework.h; sourceTree = ""; }; 475784C12344B422008291A4 /* Framework.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Framework.cpp; sourceTree = ""; }; 47938904239A92F8006ECACC /* UgcSummaryRatingType.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = UgcSummaryRatingType.h; sourceTree = ""; }; @@ -320,6 +326,16 @@ path = NetworkPolicy; sourceTree = ""; }; + 4738A8DD239FAC77007C0F43 /* Ad */ = { + isa = PBXGroup; + children = ( + 4738A8DE239FACE7007C0F43 /* CoreBanner.h */, + 4738A8E2239FB46E007C0F43 /* CoreBanner+Core.h */, + 4738A8DF239FACE7007C0F43 /* CoreBanner.mm */, + ); + path = Ad; + sourceTree = ""; + }; 477C775523435B69001C5B4E /* Framework */ = { isa = PBXGroup; children = ( @@ -391,6 +407,7 @@ children = ( 47942D51237CC3B500DEFAE3 /* PlacePageData.h */, 47942D52237CC3B500DEFAE3 /* PlacePageData.mm */, + 4738A8DD239FAC77007C0F43 /* Ad */, 47942D89237D629D00DEFAE3 /* Catalog */, 47942D5B237CC3B500DEFAE3 /* Common */, 47942D65237CC3B500DEFAE3 /* Booking */, @@ -586,6 +603,7 @@ 47942D74237CC41A00DEFAE3 /* HotelBookingData.h in Headers */, 479F705F234FBB8F00011E2E /* MWMCategory.h in Headers */, 471AB99123AB931000F56D49 /* MWMMapSearchResult+Core.h in Headers */, + 4738A8E0239FACE7007C0F43 /* CoreBanner.h in Headers */, 47942D6D237CC3E300DEFAE3 /* PlacePagePreviewData.h in Headers */, 47A65CAF235008E100DCD85F /* CoreApi-swift.h in Headers */, 9957FACE237AB01400855F48 /* DeepLinkParser.h in Headers */, @@ -615,6 +633,7 @@ 999D3A64237B097C00C5F7A8 /* DeepLinkSubscriptionData.h in Headers */, 47942D7E237CC43000DEFAE3 /* UgcData+Core.h in Headers */, 47942D6E237CC3E800DEFAE3 /* PlacePagePreviewData+Core.h in Headers */, + 4738A8E4239FB46E007C0F43 /* CoreBanner+Core.h in Headers */, 47942D7B237CC41A00DEFAE3 /* HotelRoom+Core.h in Headers */, 47942D94237D673E00DEFAE3 /* CatalogPromoItem.h in Headers */, 470016102342579200EBF03D /* MWMTagGroup.h in Headers */, @@ -729,6 +748,7 @@ 47942D7F237CC43300DEFAE3 /* UgcData.mm in Sources */, 47C637D12354A6FB00E12DE0 /* MWMEye.mm in Sources */, 47942D9D237D927800DEFAE3 /* PlacePageBookmarkData.mm in Sources */, + 4738A8E1239FACE7007C0F43 /* CoreBanner.mm in Sources */, 47942D86237CC55500DEFAE3 /* MWMOpeningHoursCommon.mm in Sources */, 47942D82237CC52A00DEFAE3 /* MWMOpeningHours.mm in Sources */, 47942D73237CC41400DEFAE3 /* OpeningHours.mm in Sources */, diff --git a/iphone/CoreApi/CoreApi/CoreApi-swift.h b/iphone/CoreApi/CoreApi/CoreApi-swift.h index d1f0d5444c..f24414cf13 100644 --- a/iphone/CoreApi/CoreApi/CoreApi-swift.h +++ b/iphone/CoreApi/CoreApi/CoreApi-swift.h @@ -33,6 +33,7 @@ FOUNDATION_EXPORT const unsigned char CoreApiVersionString[]; #pragma mark - Place Page +#import #import #import #import diff --git a/iphone/CoreApi/CoreApi/PlacePageData/Ad/CoreBanner+Core.h b/iphone/CoreApi/CoreApi/PlacePageData/Ad/CoreBanner+Core.h new file mode 100644 index 0000000000..a4a04e33d6 --- /dev/null +++ b/iphone/CoreApi/CoreApi/PlacePageData/Ad/CoreBanner+Core.h @@ -0,0 +1,13 @@ +#import "CoreBanner.h" + +#include + +NS_ASSUME_NONNULL_BEGIN + +@interface CoreBanner (Core) + +- (instancetype)initWithAdBanner:(ads::Banner const &)banner; + +@end + +NS_ASSUME_NONNULL_END diff --git a/iphone/CoreApi/CoreApi/PlacePageData/Ad/CoreBanner.h b/iphone/CoreApi/CoreApi/PlacePageData/Ad/CoreBanner.h new file mode 100644 index 0000000000..40814e02a2 --- /dev/null +++ b/iphone/CoreApi/CoreApi/PlacePageData/Ad/CoreBanner.h @@ -0,0 +1,29 @@ +#import + +typedef NS_ENUM(NSInteger, MWMBannerType) { + MWMBannerTypeNone, + MWMBannerTypeFacebook, + MWMBannerTypeRb, + MWMBannerTypeMopub +}; + +NS_ASSUME_NONNULL_BEGIN + +@protocol MWMBanner + +@property(nonatomic, readonly) enum MWMBannerType mwmType; +@property(nonatomic, readonly) NSString *bannerID; + +@end + +@interface CoreBanner : NSObject + +@property(nonatomic, readonly) MWMBannerType mwmType; +@property(nonatomic, readonly) NSString *bannerID; +@property(nonatomic, readonly) NSString *query; + +- (instancetype)initWithMwmType:(MWMBannerType)type bannerID:(NSString *)bannerID query:(NSString *)query; + +@end + +NS_ASSUME_NONNULL_END diff --git a/iphone/CoreApi/CoreApi/PlacePageData/Ad/CoreBanner.mm b/iphone/CoreApi/CoreApi/PlacePageData/Ad/CoreBanner.mm new file mode 100644 index 0000000000..9035149792 --- /dev/null +++ b/iphone/CoreApi/CoreApi/PlacePageData/Ad/CoreBanner.mm @@ -0,0 +1,50 @@ +#import "CoreBanner+Core.h" + +static MWMBannerType ConvertBannerType(ads::Banner::Type coreType) { + switch (coreType) { + case ads::Banner::Type::None: + return MWMBannerTypeNone; + case ads::Banner::Type::Facebook: + return MWMBannerTypeFacebook; + case ads::Banner::Type::RB: + return MWMBannerTypeRb; + case ads::Banner::Type::Mopub: + return MWMBannerTypeMopub; + } +} + +@interface CoreBanner () + +@property(nonatomic, readwrite) MWMBannerType mwmType; +@property(nonatomic, copy) NSString *bannerID; +@property(nonatomic, copy) NSString *query; + +@end + +@implementation CoreBanner + +- (instancetype)initWithMwmType:(MWMBannerType)type bannerID:(NSString *)bannerID query:(NSString *)query { + self = [super init]; + if (self) { + _mwmType = type; + _bannerID = bannerID; + _query = query; + } + return self; +} + +@end + +@implementation CoreBanner (Core) + +- (instancetype)initWithAdBanner:(ads::Banner const &)banner { + self = [super init]; + if (self) { + _mwmType = ConvertBannerType(banner.m_type); + _bannerID = @(banner.m_bannerId.c_str()); + _query = @""; + } + return self; +} + +@end diff --git a/iphone/CoreApi/CoreApi/PlacePageData/Common/PlacePagePreviewData.h b/iphone/CoreApi/CoreApi/PlacePageData/Common/PlacePagePreviewData.h index 3043887add..4896bc8957 100644 --- a/iphone/CoreApi/CoreApi/PlacePageData/Common/PlacePagePreviewData.h +++ b/iphone/CoreApi/CoreApi/PlacePageData/Common/PlacePagePreviewData.h @@ -2,6 +2,7 @@ @class PlacePageScheduleData; @class UgcSummaryRating; +@class CoreBanner; typedef NS_ENUM(NSInteger, PlacePageDataHotelType) { PlacePageDataHotelTypeHotel, @@ -36,7 +37,7 @@ NS_ASSUME_NONNULL_BEGIN @property(nonatomic, readonly) BOOL isPopular; @property(nonatomic, readonly) BOOL isBookingPlace; @property(nonatomic, readonly) BOOL showUgc; -//@property(nonatomic, readonly, nullable) UgcSummaryRating *ugcSummaryRating; +@property(nonatomic, readonly, nullable) NSArray *banners; @end diff --git a/iphone/CoreApi/CoreApi/PlacePageData/Common/PlacePagePreviewData.mm b/iphone/CoreApi/CoreApi/PlacePageData/Common/PlacePagePreviewData.mm index 83565e6b57..a05da25292 100644 --- a/iphone/CoreApi/CoreApi/PlacePageData/Common/PlacePagePreviewData.mm +++ b/iphone/CoreApi/CoreApi/PlacePageData/Common/PlacePagePreviewData.mm @@ -1,6 +1,7 @@ #import "PlacePagePreviewData+Core.h" #import "UgcSummaryRating.h" +#import "CoreBanner+Core.h" #include "3party/opening_hours/opening_hours.hpp" @@ -73,6 +74,14 @@ static PlacePageDataHotelType convertHotelType(boost::optional | id: <\(bannerID)> | query: <\(query)>" - } -} diff --git a/iphone/Maps/Core/Ads/MWMBanner.h b/iphone/Maps/Core/Ads/MWMBanner.h deleted file mode 100644 index 16e3005332..0000000000 --- a/iphone/Maps/Core/Ads/MWMBanner.h +++ /dev/null @@ -1,11 +0,0 @@ -typedef NS_ENUM(NSInteger, MWMBannerType) { - MWMBannerTypeNone, - MWMBannerTypeFacebook, - MWMBannerTypeRb, - MWMBannerTypeMopub -}; - -@protocol MWMBanner -@property(nonatomic, readonly) enum MWMBannerType mwmType; -@property(copy, nonatomic, readonly) NSString * bannerID; -@end diff --git a/iphone/Maps/Core/Ads/MWMBannerHelpers.h b/iphone/Maps/Core/Ads/MWMBannerHelpers.h index a97c8b6bbf..4aaed9b2c1 100644 --- a/iphone/Maps/Core/Ads/MWMBannerHelpers.h +++ b/iphone/Maps/Core/Ads/MWMBannerHelpers.h @@ -1,5 +1,4 @@ -#import "MWMBanner.h" -#import "SwiftBridge.h" +#import #include "partners_api/banner.hpp" @@ -18,16 +17,16 @@ static inline MWMBannerType MatchBannerType(ads::Banner::Type coreType) } } -static inline MWMCoreBanner * MatchBanner(ads::Banner const & banner, NSString * query) +static inline CoreBanner * MatchBanner(ads::Banner const & banner, NSString * query) { - return [[MWMCoreBanner alloc] initWithMwmType:MatchBannerType(banner.m_type) - bannerID:@(banner.m_bannerId.c_str()) - query:query]; + return [[CoreBanner alloc] initWithMwmType:MatchBannerType(banner.m_type) + bannerID:@(banner.m_bannerId.c_str()) + query:query]; } -static inline NSArray * MatchPriorityBanners(std::vector const & banners, NSString * query = @"") +static inline NSArray * MatchPriorityBanners(std::vector const & banners, NSString * query = @"") { - NSMutableArray * mBanners = [@[] mutableCopy]; + NSMutableArray * mBanners = [@[] mutableCopy]; for (auto const & banner : banners) [mBanners addObject:MatchBanner(banner, query)]; return [mBanners copy]; diff --git a/iphone/Maps/Core/Search/MWMSearch.h b/iphone/Maps/Core/Search/MWMSearch.h index 8aee00436c..c1f357abb4 100644 --- a/iphone/Maps/Core/Search/MWMSearch.h +++ b/iphone/Maps/Core/Search/MWMSearch.h @@ -1,6 +1,5 @@ #import -#import "MWMBanner.h" #import "MWMHotelParams.h" #import "MWMSearchItemType.h" #import "MWMSearchObserver.h" diff --git a/iphone/Maps/Maps.xcodeproj/project.pbxproj b/iphone/Maps/Maps.xcodeproj/project.pbxproj index 93e9877070..22f8a42e69 100644 --- a/iphone/Maps/Maps.xcodeproj/project.pbxproj +++ b/iphone/Maps/Maps.xcodeproj/project.pbxproj @@ -309,7 +309,6 @@ 34F4072C1E9E1AFF00E57AC0 /* Banner.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34F4071D1E9E1AFF00E57AC0 /* Banner.swift */; }; 34F4072F1E9E1AFF00E57AC0 /* BannersCache.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34F4071E1E9E1AFF00E57AC0 /* BannersCache.swift */; }; 34F407321E9E1AFF00E57AC0 /* BannerType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34F4071F1E9E1AFF00E57AC0 /* BannerType.swift */; }; - 34F407351E9E1AFF00E57AC0 /* CoreBanner.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34F407201E9E1AFF00E57AC0 /* CoreBanner.swift */; }; 34F407381E9E1AFF00E57AC0 /* FacebookBanner.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34F407221E9E1AFF00E57AC0 /* FacebookBanner.swift */; }; 34F4073B1E9E1AFF00E57AC0 /* MopubBanner.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34F407241E9E1AFF00E57AC0 /* MopubBanner.swift */; }; 34F4073E1E9E1AFF00E57AC0 /* MPNativeAd+MWM.m in Sources */ = {isa = PBXBuildFile; fileRef = 34F407261E9E1AFF00E57AC0 /* MPNativeAd+MWM.m */; }; @@ -383,6 +382,8 @@ 472E3F4C2147D5700020E412 /* Subscription.swift in Sources */ = {isa = PBXBuildFile; fileRef = 472E3F4B2147D5700020E412 /* Subscription.swift */; }; 473464A7218B0BC000D6AF5B /* MWMPurchaseValidation.mm in Sources */ = {isa = PBXBuildFile; fileRef = 473464A6218B0BC000D6AF5B /* MWMPurchaseValidation.mm */; }; 4735008A23A83CF700661A95 /* DownloadedMapsDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4735008923A83CF700661A95 /* DownloadedMapsDataSource.swift */; }; + 4738A8E7239FC513007C0F43 /* AdBannerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4738A8E6239FC513007C0F43 /* AdBannerView.swift */; }; + 4738A8E9239FC526007C0F43 /* AdBannerView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4738A8E8239FC526007C0F43 /* AdBannerView.xib */; }; 473CBF9B2164DD470059BD54 /* SettingsTableViewSelectableProgressCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 473CBF9A2164DD470059BD54 /* SettingsTableViewSelectableProgressCell.swift */; }; 474AC76C2139E4F2002F9BF9 /* RemoveAdsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 474AC76A2139E4F2002F9BF9 /* RemoveAdsViewController.swift */; }; 474AC76D2139E4F2002F9BF9 /* RemoveAdsViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 474AC76B2139E4F2002F9BF9 /* RemoveAdsViewController.xib */; }; @@ -808,7 +809,7 @@ F6E2FE8B1E097BA00083EBEC /* MWMPlacePageInfoCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = F6E2FCC41E097B9F0083EBEC /* MWMPlacePageInfoCell.xib */; }; F6E2FE8E1E097BA00083EBEC /* MWMPlacePageLinkCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = F6E2FCC51E097B9F0083EBEC /* MWMPlacePageLinkCell.xib */; }; F6E2FE941E097BA00083EBEC /* PlacePageTaxiCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = F6E2FCC91E097B9F0083EBEC /* PlacePageTaxiCell.xib */; }; - F6E2FE971E097BA00083EBEC /* ContextViews.mm in Sources */ = {isa = PBXBuildFile; fileRef = F6E2FCCB1E097B9F0083EBEC /* ContextViews.mm */; }; + F6E2FE971E097BA00083EBEC /* CopyLabel.m in Sources */ = {isa = PBXBuildFile; fileRef = F6E2FCCB1E097B9F0083EBEC /* CopyLabel.m */; }; F6E2FE9A1E097BA00083EBEC /* MWMiPadPlacePageLayoutImpl.mm in Sources */ = {isa = PBXBuildFile; fileRef = F6E2FCCD1E097B9F0083EBEC /* MWMiPadPlacePageLayoutImpl.mm */; }; F6E2FE9D1E097BA00083EBEC /* MWMiPhonePlacePageLayoutImpl.mm in Sources */ = {isa = PBXBuildFile; fileRef = F6E2FCCF1E097B9F0083EBEC /* MWMiPhonePlacePageLayoutImpl.mm */; }; F6E2FEA01E097BA00083EBEC /* MWMPlacePageLayout.mm in Sources */ = {isa = PBXBuildFile; fileRef = F6E2FCD11E097B9F0083EBEC /* MWMPlacePageLayout.mm */; }; @@ -1331,12 +1332,10 @@ 34F4071D1E9E1AFF00E57AC0 /* Banner.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Banner.swift; sourceTree = ""; }; 34F4071E1E9E1AFF00E57AC0 /* BannersCache.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BannersCache.swift; sourceTree = ""; }; 34F4071F1E9E1AFF00E57AC0 /* BannerType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BannerType.swift; sourceTree = ""; }; - 34F407201E9E1AFF00E57AC0 /* CoreBanner.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CoreBanner.swift; sourceTree = ""; }; 34F407221E9E1AFF00E57AC0 /* FacebookBanner.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FacebookBanner.swift; sourceTree = ""; }; 34F407241E9E1AFF00E57AC0 /* MopubBanner.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MopubBanner.swift; sourceTree = ""; }; 34F407251E9E1AFF00E57AC0 /* MPNativeAd+MWM.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "MPNativeAd+MWM.h"; sourceTree = ""; }; 34F407261E9E1AFF00E57AC0 /* MPNativeAd+MWM.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "MPNativeAd+MWM.m"; sourceTree = ""; }; - 34F407271E9E1AFF00E57AC0 /* MWMBanner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMBanner.h; sourceTree = ""; }; 34F407281E9E1AFF00E57AC0 /* MWMBannerHelpers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMBannerHelpers.h; sourceTree = ""; }; 34F4072A1E9E1AFF00E57AC0 /* RBBanner.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RBBanner.swift; sourceTree = ""; }; 34F407581E9E1D7A00E57AC0 /* Mopub.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = Mopub.xcodeproj; path = MoPubSDK/Mopub.xcodeproj; sourceTree = ""; }; @@ -1485,6 +1484,8 @@ 4735008923A83CF700661A95 /* DownloadedMapsDataSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DownloadedMapsDataSource.swift; sourceTree = ""; }; 473500C023A8F81800661A95 /* MWMFrameworkObserver.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MWMFrameworkObserver.h; sourceTree = ""; }; 473500C123A8F85A00661A95 /* MWMFrameworkStorageObserver.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MWMFrameworkStorageObserver.h; sourceTree = ""; }; + 4738A8E6239FC513007C0F43 /* AdBannerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AdBannerView.swift; sourceTree = ""; }; + 4738A8E8239FC526007C0F43 /* AdBannerView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = AdBannerView.xib; sourceTree = ""; }; 473CBF9A2164DD470059BD54 /* SettingsTableViewSelectableProgressCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsTableViewSelectableProgressCell.swift; sourceTree = ""; }; 474902D8224A54EC008D71E0 /* MWMRoutingOptions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MWMRoutingOptions.h; sourceTree = ""; }; 474902D9224A54EC008D71E0 /* MWMRoutingOptions.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMRoutingOptions.mm; sourceTree = ""; }; @@ -2052,8 +2053,8 @@ F6E2FCC41E097B9F0083EBEC /* MWMPlacePageInfoCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MWMPlacePageInfoCell.xib; sourceTree = ""; }; F6E2FCC51E097B9F0083EBEC /* MWMPlacePageLinkCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MWMPlacePageLinkCell.xib; sourceTree = ""; }; F6E2FCC91E097B9F0083EBEC /* PlacePageTaxiCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = PlacePageTaxiCell.xib; sourceTree = ""; }; - F6E2FCCA1E097B9F0083EBEC /* ContextViews.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContextViews.h; sourceTree = ""; }; - F6E2FCCB1E097B9F0083EBEC /* ContextViews.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ContextViews.mm; sourceTree = ""; }; + F6E2FCCA1E097B9F0083EBEC /* CopyLabel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CopyLabel.h; sourceTree = ""; }; + F6E2FCCB1E097B9F0083EBEC /* CopyLabel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CopyLabel.m; sourceTree = ""; }; F6E2FCCC1E097B9F0083EBEC /* MWMiPadPlacePageLayoutImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMiPadPlacePageLayoutImpl.h; sourceTree = ""; }; F6E2FCCD1E097B9F0083EBEC /* MWMiPadPlacePageLayoutImpl.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMiPadPlacePageLayoutImpl.mm; sourceTree = ""; }; F6E2FCCE1E097B9F0083EBEC /* MWMiPhonePlacePageLayoutImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMiPhonePlacePageLayoutImpl.h; sourceTree = ""; }; @@ -2714,6 +2715,8 @@ 3488B0111E9D0AEC0068AFD8 /* AdBanner.xib */, 474AC76A2139E4F2002F9BF9 /* RemoveAdsViewController.swift */, 474AC76B2139E4F2002F9BF9 /* RemoveAdsViewController.xib */, + 4738A8E6239FC513007C0F43 /* AdBannerView.swift */, + 4738A8E8239FC526007C0F43 /* AdBannerView.xib */, ); path = Ads; sourceTree = ""; @@ -3383,10 +3386,8 @@ 34F4071D1E9E1AFF00E57AC0 /* Banner.swift */, 34F4071E1E9E1AFF00E57AC0 /* BannersCache.swift */, 34F4071F1E9E1AFF00E57AC0 /* BannerType.swift */, - 34F407201E9E1AFF00E57AC0 /* CoreBanner.swift */, 34F407211E9E1AFF00E57AC0 /* Facebook */, 34F407231E9E1AFF00E57AC0 /* Mopub */, - 34F407271E9E1AFF00E57AC0 /* MWMBanner.h */, 34F407281E9E1AFF00E57AC0 /* MWMBannerHelpers.h */, 34F407291E9E1AFF00E57AC0 /* RB */, ); @@ -4509,8 +4510,8 @@ children = ( F6E2FC9D1E097B9F0083EBEC /* ActionBar */, F6E2FCA81E097B9F0083EBEC /* Content */, - F6E2FCCA1E097B9F0083EBEC /* ContextViews.h */, - F6E2FCCB1E097B9F0083EBEC /* ContextViews.mm */, + F6E2FCCA1E097B9F0083EBEC /* CopyLabel.h */, + F6E2FCCB1E097B9F0083EBEC /* CopyLabel.m */, F6E2FCCC1E097B9F0083EBEC /* MWMiPadPlacePageLayoutImpl.h */, F6E2FCCD1E097B9F0083EBEC /* MWMiPadPlacePageLayoutImpl.mm */, F6E2FCCE1E097B9F0083EBEC /* MWMiPhonePlacePageLayoutImpl.h */, @@ -5212,6 +5213,7 @@ 33010DB321B7E14700925411 /* MWMPlaceDescriptionCell.xib in Resources */, 4501B1952077C35A001B9173 /* resources-xxxhdpi_dark in Resources */, F6D67CDE2062BBA60032FD38 /* MWMBCCreateCategoryAlert.xib in Resources */, + 4738A8E9239FC526007C0F43 /* AdBannerView.xib in Resources */, 344532511F714FD70059FBCC /* UGCAddReviewController.xib in Resources */, 3490D2E31CE9DD2500D0B838 /* MWMSideButtonsView.xib in Resources */, 346DB82B1E5C4F6700E3123E /* GalleryCell.xib in Resources */, @@ -5449,6 +5451,7 @@ 6741A9B91BF340DE002C974C /* MWMRateAlert.mm in Sources */, 3404F48B202894EA0090E401 /* BMCViewController.swift in Sources */, 472848FB238573EE00176158 /* RatingSummaryViewController.swift in Sources */, + 4738A8E7239FC513007C0F43 /* AdBannerView.swift in Sources */, 349D1ABC1E2D05EF004A2006 /* SearchBar.swift in Sources */, 993F5511237C622700545511 /* DeepLinkCatalogueStrategy.swift in Sources */, 34E50DF81F6FCC96008EED49 /* UGCReviewCell.swift in Sources */, @@ -5547,7 +5550,6 @@ 47868A7B22145A2C000AFC86 /* GuideNameViewController.swift in Sources */, 34AB66501FC5AA330078E451 /* RoutePreviewTaxiCell.swift in Sources */, F6E2FE251E097BA00083EBEC /* MWMOpeningHoursModel.mm in Sources */, - 34F407351E9E1AFF00E57AC0 /* CoreBanner.swift in Sources */, 34C9BD031C6DB693000DC38D /* MWMTableViewController.m in Sources */, F6E2FD8C1E097BA00083EBEC /* MWMNoMapsView.m in Sources */, 34D3B0361E389D05004100F9 /* MWMEditorSelectTableViewCell.m in Sources */, @@ -5823,7 +5825,7 @@ 34D3B0481E389D05004100F9 /* MWMNoteCell.m in Sources */, CD9AD967228067F500EC174A /* MapInfo.swift in Sources */, 47F6E51221F61908004580CA /* CoreNotificationWrapper.mm in Sources */, - F6E2FE971E097BA00083EBEC /* ContextViews.mm in Sources */, + F6E2FE971E097BA00083EBEC /* CopyLabel.m in Sources */, 344532561F7155540059FBCC /* UGCReviewModel.swift in Sources */, 6741AA1D1BF340DE002C974C /* MWMDownloadTransitMapAlert.mm in Sources */, 346B42AC1DD5E3D20094EBEE /* MWMLocationNotFoundAlert.mm in Sources */, diff --git a/iphone/Maps/UI/Ads/AdBanner.swift b/iphone/Maps/UI/Ads/AdBanner.swift index a7e17371c8..686a2c9f6a 100644 --- a/iphone/Maps/UI/Ads/AdBanner.swift +++ b/iphone/Maps/UI/Ads/AdBanner.swift @@ -1,34 +1,5 @@ import FBAudienceNetwork -@objc(MWMAdBannerState) -enum AdBannerState: Int { - case unset - case compact - case detailed - case search - - func config() -> (priority: UILayoutPriority, numberOfTitleLines: Int, numberOfBodyLines: Int) { - switch self { - case .unset: - assert(false) - return (priority: UILayoutPriority(rawValue: 0), numberOfTitleLines: 0, numberOfBodyLines: 0) - case .compact: - return alternative(iPhone: (priority: UILayoutPriority.defaultLow, numberOfTitleLines: 1, numberOfBodyLines: 2), - iPad: (priority: UILayoutPriority.defaultHigh, numberOfTitleLines: 0, numberOfBodyLines: 0)) - case .search: - return (priority: UILayoutPriority.defaultLow, numberOfTitleLines: 2, numberOfBodyLines: 0) - case .detailed: - return (priority: UILayoutPriority.defaultHigh, numberOfTitleLines: 0, numberOfBodyLines: 0) - } - } -} - -@objc(MWMAdBannerContainerType) -enum AdBannerContainerType: Int { - case placePage - case search -} - private func attributedTitle(title: String, indent: CGFloat) -> NSAttributedString { let paragraphStyle = NSMutableParagraphStyle() paragraphStyle.firstLineHeadIndent = indent diff --git a/iphone/Maps/UI/Ads/AdBannerView.swift b/iphone/Maps/UI/Ads/AdBannerView.swift new file mode 100644 index 0000000000..18c0e8d5cb --- /dev/null +++ b/iphone/Maps/UI/Ads/AdBannerView.swift @@ -0,0 +1,263 @@ +import FBAudienceNetwork + +@objc(MWMAdBannerState) +enum AdBannerState: Int { + case unset + case compact + case detailed + case search + + func config() -> (priority: UILayoutPriority, numberOfTitleLines: Int, numberOfBodyLines: Int) { + switch self { + case .unset: + assert(false) + return (priority: UILayoutPriority(rawValue: 0), numberOfTitleLines: 0, numberOfBodyLines: 0) + case .compact: + return alternative(iPhone: (priority: UILayoutPriority.defaultLow, numberOfTitleLines: 1, numberOfBodyLines: 2), + iPad: (priority: UILayoutPriority.defaultHigh, numberOfTitleLines: 0, numberOfBodyLines: 0)) + case .search: + return (priority: UILayoutPriority.defaultLow, numberOfTitleLines: 2, numberOfBodyLines: 0) + case .detailed: + return (priority: UILayoutPriority.defaultHigh, numberOfTitleLines: 0, numberOfBodyLines: 0) + } + } +} + +@objc(MWMAdBannerContainerType) +enum AdBannerContainerType: Int { + case placePage + case search +} + +private func attributedTitle(title: String, indent: CGFloat) -> NSAttributedString { + let paragraphStyle = NSMutableParagraphStyle() + paragraphStyle.firstLineHeadIndent = indent + paragraphStyle.lineBreakMode = .byTruncatingTail + return NSAttributedString(string: title, + attributes: [NSAttributedString.Key.paragraphStyle: paragraphStyle, + NSAttributedString.Key.font: UIFont.bold12(), + NSAttributedString.Key.foregroundColor: UIColor.blackSecondaryText() + ]) +} + +class AdBannerView: UIView { + @IBOutlet private var detailedModeConstraints: [NSLayoutConstraint]! + @IBOutlet private weak var adCallToActionButtonCompactLeading: NSLayoutConstraint! + @IBOutlet private weak var adIconImageView: UIImageView! + @IBOutlet private weak var adTitleLabel: UILabel! + @IBOutlet private weak var adBodyLabel: UILabel! + @IBOutlet private weak var DAAImage: UIImageView! + @IBOutlet private weak var DAAImageWidth: NSLayoutConstraint! + @IBOutlet private weak var adPrivacyImage: UIImageView! + @IBOutlet private weak var adCallToActionButtonCompact: UIButton! + @IBOutlet private weak var adCallToActionButtonDetailed: UIButton! + @IBOutlet private weak var adCallToActionButtonCustom: UIButton! + @IBOutlet private weak var removeAdsSmallButton: UIButton! + @IBOutlet private weak var removeAdsLargeButton: UIButton! + @IBOutlet private weak var removeAdsImage: UIImageView! + @IBOutlet private weak var fallbackAdView: UIView! + @IBOutlet private var nativeAdViewBottom: NSLayoutConstraint! + @IBOutlet private var fallbackAdViewBottom: NSLayoutConstraint! + @IBOutlet private var fallbackAdViewHeight: NSLayoutConstraint! + @IBOutlet private var ctaButtonLeftConstraint: NSLayoutConstraint! + @IBOutlet private weak var nativeAdView: UIView! { + didSet { + nativeAdView.layer.borderColor = UIColor.blackDividers().cgColor + } + } + + @objc var onRemoveAds: MWMVoidBlock? + + @objc static let detailedBannerExcessHeight: Float = 52 + + enum AdType { + case native + case fallback + } + + var adType = AdType.native { + didSet { + let isNative = adType == .native + nativeAdView.isHidden = !isNative + fallbackAdView.isHidden = isNative + + nativeAdViewBottom.isActive = isNative + fallbackAdViewBottom.isActive = !isNative + fallbackAdViewHeight.isActive = !isNative + } + } + + @objc var state = AdBannerState.unset { + didSet { + guard state != .unset else { + adCallToActionButtonCustom.isHidden = true + mpNativeAd = nil + nativeAd = nil + return + } + guard state != oldValue else { return } + let config = state.config() + animateConstraints(animations: { + self.adTitleLabel.numberOfLines = config.numberOfTitleLines + self.adBodyLabel.numberOfLines = config.numberOfBodyLines + self.detailedModeConstraints.forEach { $0.priority = config.priority } + self.refreshBannerIfNeeded() + }) + } + } + + @objc weak var mpNativeAd: MPNativeAd? + + func cancelImageLoading() { + adIconImageView.wi_cancelImageRequest() + adIconImageView.image = nil; + } + + private var nativeAd: Banner? { + willSet { + nativeAd?.unregister() + } + } + + @IBAction + private func privacyAction() { + let url: URL? + if let ad = nativeAd as? FacebookBanner { + url = ad.nativeAd.adChoicesLinkURL + } else if let ad = nativeAd as? MopubBanner, let u = ad.privacyInfoURL { + url = u + } else { + return + } + + UIViewController.topViewController().open(url) + } + + @IBAction + private func removeAction(_ sender: UIButton) { + Statistics.logEvent(kStatInappBannerClose, withParameters: [ + kStatBanner : state == .detailed ? 1 : 0, + kStatButton : sender == removeAdsLargeButton ? 1 : 0]) + onRemoveAds?() + } + + func reset() { + state = .unset + } + + @objc func config(ad: MWMBanner, containerType: AdBannerContainerType, canRemoveAds: Bool, onRemoveAds: (() -> Void)?) { + reset() + switch containerType { + case .placePage: + state = alternative(iPhone: .compact, iPad: .detailed) + case .search: + state = .search + } + + nativeAd = ad as? Banner + switch ad { + case let ad as FacebookBanner: configFBBanner(ad: ad.nativeAd) + case let ad as RBBanner: configRBBanner(ad: ad) + case let ad as MopubBanner: configMopubBanner(ad: ad) + default: assert(false) + } + self.onRemoveAds = onRemoveAds + removeAdsSmallButton.isHidden = !canRemoveAds + removeAdsLargeButton.isHidden = !canRemoveAds + removeAdsImage.isHidden = !canRemoveAds + ctaButtonLeftConstraint.priority = canRemoveAds ? .defaultLow : .defaultHigh + } + + func setHighlighted(_ highlighted: Bool) { + adCallToActionButtonCompact.isHighlighted = highlighted; + adCallToActionButtonDetailed.isHighlighted = highlighted; + } + + private func configFBBanner(ad: FBNativeAd) { + adType = .native + DAAImageWidth.constant = adPrivacyImage.width; + DAAImage.isHidden = false; + + let adCallToActionButtons: [UIView] + if state == .search { + adCallToActionButtons = [self, adCallToActionButtonCompact] + } else { + adCallToActionButtons = [adCallToActionButtonCompact, adCallToActionButtonDetailed] + } + ad.registerView(forInteraction: self, with: nil, withClickableViews: adCallToActionButtons) + + ad.icon?.loadAsync { [weak self] image in + self?.adIconImageView.image = image + } + adTitleLabel.attributedText = attributedTitle(title: ad.title ?? "", + indent: adPrivacyImage.width + DAAImageWidth.constant) + adBodyLabel.text = ad.body ?? "" + let config = state.config() + adTitleLabel.numberOfLines = config.numberOfTitleLines + adBodyLabel.numberOfLines = config.numberOfBodyLines + [adCallToActionButtonCompact, adCallToActionButtonDetailed].forEach { $0.setTitle(ad.callToAction, for: .normal) } + } + + private func configRBBanner(ad: MTRGNativeAd) { + guard let banner = ad.banner else { return } + adType = .native + DAAImageWidth.constant = 0; + DAAImage.isHidden = true; + + MTRGNativeAd.loadImage(banner.icon, to: adIconImageView) + adTitleLabel.attributedText = attributedTitle(title: banner.title, + indent: adPrivacyImage.width + DAAImageWidth.constant) + adBodyLabel.text = banner.descriptionText ?? "" + let config = state.config() + adTitleLabel.numberOfLines = config.numberOfTitleLines + adBodyLabel.numberOfLines = config.numberOfBodyLines + + [adCallToActionButtonCompact, adCallToActionButtonDetailed].forEach { $0.setTitle(banner.ctaText, for: .normal) } + refreshBannerIfNeeded() + } + + private func configMopubBanner(ad: MopubBanner) { + mpNativeAd = ad.nativeAd + adType = .native + + DAAImageWidth.constant = adPrivacyImage.width; + DAAImage.isHidden = false; + + let adCallToActionButtons: [UIButton] + if state == .search { + adCallToActionButtonCustom.isHidden = false + adCallToActionButtons = [adCallToActionButtonCustom, adCallToActionButtonCompact] + } else { + adCallToActionButtons = [adCallToActionButtonCompact, adCallToActionButtonDetailed] + adCallToActionButtons.forEach { $0.setTitle(ad.ctaText, for: .normal) } + } + mpNativeAd?.setAdView(self, actionButtons: adCallToActionButtons) + + adTitleLabel.attributedText = attributedTitle(title: ad.title, + indent: adPrivacyImage.width + DAAImageWidth.constant) + adBodyLabel.text = ad.text + if let url = URL(string: ad.iconURL) { + adIconImageView.wi_setImage(with: url) + } + } + + private func refreshBannerIfNeeded() { + if let ad = nativeAd as? MTRGNativeAd { + let clickableView: UIView + switch state { + case .unset: + assert(false) + clickableView = adCallToActionButtonCompact + case .compact: clickableView = adCallToActionButtonCompact + case .detailed: clickableView = adCallToActionButtonDetailed + case .search: clickableView = self + } + ad.register(clickableView, with: UIViewController.topViewController()) + } + } + + override func willMove(toSuperview newSuperview: UIView?) { + super.willMove(toSuperview: newSuperview) + mpNativeAd?.nativeViewWillMove(toSuperview: newSuperview) + } +} diff --git a/iphone/Maps/UI/Ads/AdBannerView.xib b/iphone/Maps/UI/Ads/AdBannerView.xib new file mode 100644 index 0000000000..781e26432d --- /dev/null +++ b/iphone/Maps/UI/Ads/AdBannerView.xib @@ -0,0 +1,300 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/iphone/Maps/UI/PlacePage/MWMPlacePageData.mm b/iphone/Maps/UI/PlacePage/MWMPlacePageData.mm index 525564ea37..fbd73f4fd2 100644 --- a/iphone/Maps/UI/PlacePage/MWMPlacePageData.mm +++ b/iphone/Maps/UI/PlacePage/MWMPlacePageData.mm @@ -3,6 +3,7 @@ #import "MWMDiscoveryGuideViewModel.h" #import "MWMBannerHelpers.h" #import "MWMUGCViewModel.h" +#import "SwiftBridge.h" #import diff --git a/iphone/Maps/UI/PlacePage/MWMPlacePageManager.mm b/iphone/Maps/UI/PlacePage/MWMPlacePageManager.mm index 7cd9f39974..ae34f391db 100644 --- a/iphone/Maps/UI/PlacePage/MWMPlacePageManager.mm +++ b/iphone/Maps/UI/PlacePage/MWMPlacePageManager.mm @@ -1109,6 +1109,10 @@ void RegisterEventIfPossible(eye::MapObject::Event::Type const type) }]; } +- (void)showRemoveAds { + [[MapViewController sharedController] showRemoveAds]; +} + #pragma mark - AvailableArea / PlacePageArea - (void)updateAvailableArea:(CGRect)frame diff --git a/iphone/Maps/UI/PlacePage/MWMPlacePageManagerHelper.h b/iphone/Maps/UI/PlacePage/MWMPlacePageManagerHelper.h index ff7df10d6c..b9c7392cbb 100644 --- a/iphone/Maps/UI/PlacePage/MWMPlacePageManagerHelper.h +++ b/iphone/Maps/UI/PlacePage/MWMPlacePageManagerHelper.h @@ -38,5 +38,6 @@ + (void)avoidDirty; + (void)avoidFerry; + (void)avoidToll; ++ (void)showRemoveAds; @end diff --git a/iphone/Maps/UI/PlacePage/MWMPlacePageManagerHelper.mm b/iphone/Maps/UI/PlacePage/MWMPlacePageManagerHelper.mm index a92e853560..823ce1048d 100644 --- a/iphone/Maps/UI/PlacePage/MWMPlacePageManagerHelper.mm +++ b/iphone/Maps/UI/PlacePage/MWMPlacePageManagerHelper.mm @@ -41,6 +41,7 @@ - (void)avoidDirty; - (void)avoidFerry; - (void)avoidToll; +- (void)showRemoveAds; @end @@ -174,4 +175,8 @@ [[MWMMapViewControlsManager manager].placePageManager avoidToll]; } ++ (void)showRemoveAds { + [[MWMMapViewControlsManager manager].placePageManager showRemoveAds]; +} + @end diff --git a/iphone/Maps/UI/PlacePage/PlacePage.storyboard b/iphone/Maps/UI/PlacePage/PlacePage.storyboard index e8441e90bd..3e53bbbe4d 100644 --- a/iphone/Maps/UI/PlacePage/PlacePage.storyboard +++ b/iphone/Maps/UI/PlacePage/PlacePage.storyboard @@ -14,7 +14,7 @@ - + @@ -38,6 +38,7 @@ + @@ -47,6 +48,9 @@ + + + @@ -61,6 +65,9 @@ + + + @@ -75,6 +82,9 @@ + + + @@ -169,6 +179,9 @@ + + +