From e60778fd037bdfc1b33e88b81471ee9eddbc32d3 Mon Sep 17 00:00:00 2001 From: VladiMihaylenko Date: Fri, 18 Nov 2016 17:03:39 +0300 Subject: [PATCH] [ios] Banners in place page. --- iphone/Maps/Classes/MWMPPPreviewBannerCell.h | 11 ++ iphone/Maps/Classes/MWMPPPreviewBannerCell.mm | 124 ++++++++++++++++++ .../Maps/Classes/MWMPPPreviewBannerCell.xib | 116 ++++++++++++++++ .../Maps/Classes/MWMPPPreviewLayoutHelper.h | 4 +- .../Maps/Classes/MWMPPPreviewLayoutHelper.mm | 61 +++++++-- iphone/Maps/Classes/MWMPlacePageData.h | 7 +- iphone/Maps/Classes/MWMPlacePageData.mm | 22 ++++ iphone/Maps/Classes/MWMPlacePageLayout.mm | 4 + iphone/Maps/Classes/MWMPlacePageLayoutImpl.h | 2 + .../Classes/MWMiPhonePlacePageLayoutImpl.mm | 12 +- iphone/Maps/Classes/_MWMPPPSpace.xib | 5 +- iphone/Maps/Maps.xcodeproj/project.pbxproj | 22 ++++ iphone/Maps/UIColor+MapsMeColor.h | 1 + iphone/Maps/UIColor+MapsMeColor.mm | 11 +- 14 files changed, 381 insertions(+), 21 deletions(-) create mode 100644 iphone/Maps/Classes/MWMPPPreviewBannerCell.h create mode 100644 iphone/Maps/Classes/MWMPPPreviewBannerCell.mm create mode 100644 iphone/Maps/Classes/MWMPPPreviewBannerCell.xib diff --git a/iphone/Maps/Classes/MWMPPPreviewBannerCell.h b/iphone/Maps/Classes/MWMPPPreviewBannerCell.h new file mode 100644 index 0000000000..f39d936eda --- /dev/null +++ b/iphone/Maps/Classes/MWMPPPreviewBannerCell.h @@ -0,0 +1,11 @@ +@interface MWMPPPreviewBannerCell : UITableViewCell + +- (void)configWithTitle:(NSString *)title + content:(NSString *)content + adURL:(NSURL *)adURL + imageURL:(NSURL *)imageURL; + +- (void)configImageInOpenState; +- (void)configImageInPreviewState; + +@end diff --git a/iphone/Maps/Classes/MWMPPPreviewBannerCell.mm b/iphone/Maps/Classes/MWMPPPreviewBannerCell.mm new file mode 100644 index 0000000000..79217810b2 --- /dev/null +++ b/iphone/Maps/Classes/MWMPPPreviewBannerCell.mm @@ -0,0 +1,124 @@ +#import "MWMPPPreviewBannerCell.h" +#import "Common.h" +#import "MapViewController.h" +#import "UIColor+MapsMeColor.h" +#import "UIFont+MapsMeFonts.h" + +namespace +{ +CGFloat const kDefaultBodyLeftOffset = 16; +CGFloat const kPreviewWithImageBodyLeftOffset = 47; +CGFloat const kOpenBodyLeftOffset = 60; +CGFloat const kPreviewImageSide = 20; +CGFloat const kOpenImageSide = 28; +CGFloat const kPreviewImageTopOffset = 8; +CGFloat const kOpenImageTopOffset = 12; +} // namespace + +@interface MWMPPPreviewBannerCell () + +@property(weak, nonatomic) IBOutlet UIImageView * icon; +@property(weak, nonatomic) IBOutlet UILabel * body; +@property(weak, nonatomic) IBOutlet UIButton * button; +@property(nonatomic) NSURL * adURL; + +@property(weak, nonatomic) IBOutlet NSLayoutConstraint * imageWidth; +@property(weak, nonatomic) IBOutlet NSLayoutConstraint * imageHeight; +@property(weak, nonatomic) IBOutlet NSLayoutConstraint * imageTopOffset; +@property(weak, nonatomic) IBOutlet NSLayoutConstraint * bodyLeftOffset; + +@end + +@implementation MWMPPPreviewBannerCell + +- (void)configWithTitle:(NSString *)title + content:(NSString *)content + adURL:(NSURL *)adURL + imageURL:(NSURL *)imageURL +{ + NSAssert(title.length, @"Title must be not empty!"); + self.adURL = adURL; + auto full = [[NSMutableAttributedString alloc] initWithString:title attributes: + @{NSForegroundColorAttributeName : [UIColor blackPrimaryText], + NSFontAttributeName : [UIFont medium16]}]; + [full appendAttributedString:[[NSAttributedString alloc] initWithString:@"\n"]]; + + if (content.length) + { + auto attrContent = [[NSAttributedString alloc] initWithString:content attributes: + @{NSForegroundColorAttributeName : [UIColor blackSecondaryText], + NSFontAttributeName : [UIFont regular13]}]; + + [full appendAttributedString:attrContent]; + } + + auto paragraphStyle = [[NSMutableParagraphStyle alloc] init]; + paragraphStyle.paragraphSpacing = 10; + paragraphStyle.lineSpacing = 6; + paragraphStyle.headIndent = 0; + + [full addAttributes:@{NSParagraphStyleAttributeName : paragraphStyle} range:{0, full.length}]; + + self.body.attributedText = full; + + self.icon.hidden = YES; + self.bodyLeftOffset.constant = kDefaultBodyLeftOffset; + self.button.hidden = !IPAD; + + if (!imageURL) + return; + + [self downloadAssingImageWithURL:imageURL completion:^ + { + if (IPAD) + [self configImageInOpenState]; + else + [self configImageInPreviewState]; + + [self setNeedsLayout]; + [UIView animateWithDuration:kDefaultAnimationDuration animations:^{ [self layoutIfNeeded]; }]; + }]; +} + +- (void)downloadAssingImageWithURL:(NSURL *)URL completion:(TMWMVoidBlock)completion +{ + dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ + UIImage * image = [UIImage imageWithData:[NSData dataWithContentsOfURL:URL]]; + dispatch_async(dispatch_get_main_queue(), ^{ + self.icon.image = image; + if (image) + self.icon.hidden = NO; + completion(); + }); + }); +} + +- (void)configImageInPreviewState +{ + self.button.hidden = YES; + if (self.icon.hidden) + return; + + self.bodyLeftOffset.constant = kPreviewWithImageBodyLeftOffset; + self.imageWidth.constant = self.imageHeight.constant = kPreviewImageSide; + self.imageTopOffset.constant = kPreviewImageTopOffset; +} + +- (void)configImageInOpenState +{ + self.button.hidden = NO; + if (self.icon.hidden) + return; + + self.bodyLeftOffset.constant = kOpenBodyLeftOffset; + self.imageWidth.constant = self.imageHeight.constant = kOpenImageSide; + self.imageTopOffset.constant = kOpenImageTopOffset; +} + +- (IBAction)tap +{ + if (self.adURL) + [[MapViewController controller] openUrl:self.adURL]; +} + +@end diff --git a/iphone/Maps/Classes/MWMPPPreviewBannerCell.xib b/iphone/Maps/Classes/MWMPPPreviewBannerCell.xib new file mode 100644 index 0000000000..c21cf4819c --- /dev/null +++ b/iphone/Maps/Classes/MWMPPPreviewBannerCell.xib @@ -0,0 +1,116 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/iphone/Maps/Classes/MWMPPPreviewLayoutHelper.h b/iphone/Maps/Classes/MWMPPPreviewLayoutHelper.h index 580237abf0..1fb29b2882 100644 --- a/iphone/Maps/Classes/MWMPPPreviewLayoutHelper.h +++ b/iphone/Maps/Classes/MWMPPPreviewLayoutHelper.h @@ -3,11 +3,13 @@ @interface MWMPPPreviewLayoutHelper : NSObject - (instancetype)initWithTableView:(UITableView *)tableView; +- (void)configWithData:(MWMPlacePageData *)data; - (UITableViewCell *)cellForRowAtIndexPath:(NSIndexPath *)indexPath withData:(MWMPlacePageData *)data; - - (void)rotateDirectionArrowToAngle:(CGFloat)angle; - (void)setDistanceToObject:(NSString *)distance; - (CGFloat)height; +- (void)layoutInOpenState:(BOOL)isOpen; + @end diff --git a/iphone/Maps/Classes/MWMPPPreviewLayoutHelper.mm b/iphone/Maps/Classes/MWMPPPreviewLayoutHelper.mm index e2b821a724..c32eb7b2a3 100644 --- a/iphone/Maps/Classes/MWMPPPreviewLayoutHelper.mm +++ b/iphone/Maps/Classes/MWMPPPreviewLayoutHelper.mm @@ -2,6 +2,7 @@ #import "Common.h" #import "MWMDirectionView.h" #import "MWMPlacePageData.h" +#import "MWMPPPreviewBannerCell.h" #import "MWMTableViewCell.h" #import "UIColor+MapsmeColor.h" @@ -9,8 +10,8 @@ namespace { -array const kPreviewCells = {{@"_MWMPPPTitle", @"_MWMPPPExternalTitle", @"_MWMPPPSubtitle", - @"_MWMPPPSchedule", @"_MWMPPPBooking", @"_MWMPPPAddress", @"_MWMPPPSpace"}}; +array const kPreviewCells = {{@"_MWMPPPTitle", @"_MWMPPPExternalTitle", @"_MWMPPPSubtitle", + @"_MWMPPPSchedule", @"_MWMPPPBooking", @"_MWMPPPAddress", @"_MWMPPPSpace", @"MWMPPPreviewBannerCell"}}; } // namespace #pragma mark - Base @@ -118,6 +119,12 @@ array const kPreviewCells = {{@"_MWMPPPTitle", @"_MWMPPPExternalT @implementation _MWMPPPAddress @end +@interface _MWMPPPSpace : _MWMPPPCellBase +@end + +@implementation _MWMPPPSpace +@end + @interface MWMPPPreviewLayoutHelper () @property(weak, nonatomic) UITableView * tableView; @@ -130,6 +137,11 @@ array const kPreviewCells = {{@"_MWMPPPTitle", @"_MWMPPPExternalT @property(copy, nonatomic) NSString * distance; @property(weak, nonatomic) UIImageView * compass; @property(nonatomic) NSIndexPath * lastCellIndexPath; +@property(nonatomic) BOOL lastCellIsBanner; +@property(nonatomic) NSUInteger distanceRow; + +@property(weak, nonatomic) MWMPPPreviewBannerCell * cachedBannerCell; + @end @implementation MWMPPPreviewLayoutHelper @@ -152,6 +164,17 @@ array const kPreviewCells = {{@"_MWMPPPTitle", @"_MWMPPPExternalT [self.tableView registerNib:[UINib nibWithNibName:name bundle:nil] forCellReuseIdentifier:name]; } +- (void)configWithData:(MWMPlacePageData *)data +{ + auto const & previewRows = data.previewRows; + using place_page::PreviewRows; + self.lastCellIsBanner = previewRows.back() == PreviewRows::Banner; + self.lastCellIndexPath = [NSIndexPath indexPathForRow:previewRows.size() - 1 inSection:0]; + auto it = find(previewRows.begin(), previewRows.end(), PreviewRows::Space); + if (it != previewRows.end()) + self.distanceRow = distance(previewRows.begin(), it) - 1; +} + - (UITableViewCell *)cellForRowAtIndexPath:(NSIndexPath *)indexPath withData:(MWMPlacePageData *)data { using namespace place_page; @@ -159,9 +182,6 @@ array const kPreviewCells = {{@"_MWMPPPTitle", @"_MWMPPPExternalT auto const row = data.previewRows[indexPath.row]; auto cellName = kPreviewCells[static_cast(row)]; - // -2 because last cell is always the spacer cell. - BOOL const isNeedToShowDistance = (indexPath.row == data.previewRows.size() - 2); - auto * c = [tableView dequeueReusableCellWithIdentifier:cellName]; switch(row) { @@ -200,21 +220,27 @@ array const kPreviewCells = {{@"_MWMPPPTitle", @"_MWMPPPExternalT auto bookingCell = static_cast<_MWMPPPBooking *>(c); [bookingCell configWithRating:data.bookingRating pricing:data.bookingApproximatePricing]; [data assignOnlinePriceToLabel:bookingCell.pricing]; - return c; + return bookingCell; } case PreviewRows::Address: static_cast<_MWMPPPAddress *>(c).address.text = data.address; break; case PreviewRows::Space: return c; + case PreviewRows::Banner: + auto bannerCell = static_cast(c); + [bannerCell configWithTitle:data.bannerTitle + content:data.bannerContent + adURL:data.bannerURL + imageURL:data.bannerIconURL]; + self.cachedBannerCell = bannerCell; + return bannerCell; } auto baseCell = static_cast<_MWMPPPCellBase *>(c); - if (isNeedToShowDistance) - { + + if (indexPath.row == self.distanceRow) [self showDistanceOnCell:baseCell withData:data]; - self.lastCellIndexPath = indexPath; - } else [self hideDistanceOnCell:baseCell]; @@ -265,8 +291,21 @@ array const kPreviewCells = {{@"_MWMPPPTitle", @"_MWMPPPExternalT - (CGFloat)height { + CGFloat constexpr bannerDefaultHeight = 45; auto const rect = [self.tableView rectForRowAtIndexPath:self.lastCellIndexPath]; - return rect.origin.y + rect.size.height; + return rect.origin.y + (self.lastCellIsBanner ? bannerDefaultHeight : rect.size.height); +} + +- (void)layoutInOpenState:(BOOL)isOpen +{ + if (IPAD) + return; + + auto cell = self.cachedBannerCell; + if (isOpen) + [cell configImageInOpenState]; + else + [cell configImageInPreviewState]; } - (MWMDirectionView *)directionView diff --git a/iphone/Maps/Classes/MWMPlacePageData.h b/iphone/Maps/Classes/MWMPlacePageData.h index 8f5d112cd8..4c1b6ef4af 100644 --- a/iphone/Maps/Classes/MWMPlacePageData.h +++ b/iphone/Maps/Classes/MWMPlacePageData.h @@ -20,7 +20,8 @@ enum class PreviewRows Schedule, Booking, Address, - Space + Space, + Banner }; enum class MetainfoRows @@ -79,6 +80,10 @@ enum class OpeningHours - (NSURL *)sponsoredURL; - (NSURL *)sponsoredDescriptionURL; - (NSString *)sponsoredId; +- (NSString *)bannerTitle; +- (NSString *)bannerContent; +- (NSURL *)bannerIconURL; +- (NSURL *)bannerURL; - (void)assignOnlinePriceToLabel:(UILabel *)label; // API diff --git a/iphone/Maps/Classes/MWMPlacePageData.mm b/iphone/Maps/Classes/MWMPlacePageData.mm index 0b3942765b..7474ae9bf3 100644 --- a/iphone/Maps/Classes/MWMPlacePageData.mm +++ b/iphone/Maps/Classes/MWMPlacePageData.mm @@ -74,6 +74,8 @@ using namespace place_page; NSAssert(!m_previewRows.empty(), @"Preview row's can't be empty!"); m_previewRows.push_back(PreviewRows::Space); +// Uncomment when implementation will not dummy. +// if (m_info.HasBanner()) m_previewRows.push_back(PreviewRows::Banner); } - (void)fillMetaInfoSection @@ -221,6 +223,26 @@ using namespace place_page; : nil; } +- (NSString *)bannerTitle +{ + return m_info.HasBanner() ? @(m_info.GetBannerTitleId().c_str()) : nil; +} + +- (NSString *)bannerContent +{ + return m_info.HasBanner() ? @(m_info.GetBannerMessageId().c_str()) : nil; +} + +- (NSURL *)bannerIconURL +{ + return m_info.HasBanner() ? [NSURL URLWithString:@(m_info.GetBannerIconId().c_str())] : nil; +} + +- (NSURL *)bannerURL +{ + return m_info.HasBanner() ? [NSURL URLWithString:@(m_info.GetBannerUrl().c_str())] : nil; +} + - (void)assignOnlinePriceToLabel:(UILabel *)label { NSAssert(self.isBooking, @"Online price must be assigned to booking object!"); diff --git a/iphone/Maps/Classes/MWMPlacePageLayout.mm b/iphone/Maps/Classes/MWMPlacePageLayout.mm index 1369b11295..a3c157bb40 100644 --- a/iphone/Maps/Classes/MWMPlacePageLayout.mm +++ b/iphone/Maps/Classes/MWMPlacePageLayout.mm @@ -124,7 +124,11 @@ array const kButtonsCells = {{@"MWMPlacePageButtonCell"}}; [self.layoutImpl onShow]; [self.actionBar configureWithData:static_cast>(data)]; + [self.previewLayoutHelper configWithData:data]; [self.openingHoursLayoutHelper configWithData:data]; + if ([self.layoutImpl respondsToSelector:@selector(setPreviewLayoutHelper:)]) + [self.layoutImpl setPreviewLayoutHelper:self.previewLayoutHelper]; + [self.placePageView.tableView reloadData]; dispatch_async(dispatch_get_main_queue(), ^{ diff --git a/iphone/Maps/Classes/MWMPlacePageLayoutImpl.h b/iphone/Maps/Classes/MWMPlacePageLayoutImpl.h index 1d6e014215..a54fd041b6 100644 --- a/iphone/Maps/Classes/MWMPlacePageLayoutImpl.h +++ b/iphone/Maps/Classes/MWMPlacePageLayoutImpl.h @@ -21,6 +21,7 @@ inline void animate(TMWMVoidBlock animate, TMWMVoidBlock completion = nil) } // namepsace place_page_layout @protocol MWMPlacePageLayoutDelegate; +@class MWMPPPreviewLayoutHelper; @protocol MWMPlacePageLayoutImpl @@ -43,5 +44,6 @@ inline void animate(TMWMVoidBlock animate, TMWMVoidBlock completion = nil) - (void)updateLayoutWithTopBound:(CGFloat)topBound; - (void)updateLayoutWithLeftBound:(CGFloat)leftBound; - (void)setInitialTopBound:(CGFloat)topBound leftBound:(CGFloat)leftBound; +- (void)setPreviewLayoutHelper:(MWMPPPreviewLayoutHelper *)layoutHelper; @end diff --git a/iphone/Maps/Classes/MWMiPhonePlacePageLayoutImpl.mm b/iphone/Maps/Classes/MWMiPhonePlacePageLayoutImpl.mm index cd9f37845b..96467a2b79 100644 --- a/iphone/Maps/Classes/MWMiPhonePlacePageLayoutImpl.mm +++ b/iphone/Maps/Classes/MWMiPhonePlacePageLayoutImpl.mm @@ -1,5 +1,6 @@ #import "MWMPlacePageLayout.h" #import "MWMiPhonePlacePageLayoutImpl.h" +#import "MWMPPPreviewLayoutHelper.h" namespace { @@ -31,6 +32,7 @@ CGFloat const kLuftDraggingOffset = 30; @property(nonatomic) CGFloat landscapeOpenContentOffset; @property(nonatomic) CGFloat lastContentOffset; @property(nonatomic) CGFloat expandedContentOffset; +@property(weak, nonatomic) MWMPPPreviewLayoutHelper * previewLayoutHelper; @end @@ -117,10 +119,7 @@ CGFloat const kLuftDraggingOffset = 30; auto actionBar = self.actionBar; actionBar.minY = actionBar.superview.height - actionBar.height; - // We decrease expanded offset for 2 pixels because it looks more clear. - CGFloat constexpr designOffset = 2; - self.expandedContentOffset = height + actionBar.height - designOffset; - + self.expandedContentOffset = height + actionBar.height - ppView.top.height; auto const targetOffset = self.state == State::Bottom ? self.expandedContentOffset : self.topContentOffset; [self.scrollView setContentOffset:{ 0, targetOffset } animated:YES]; }); @@ -252,8 +251,10 @@ CGFloat const kLuftDraggingOffset = 30; - (void)setState:(State)state { _state = state; - self.placePageView.anchorImage.transform = state == State::Top ? CGAffineTransformMakeRotation(M_PI) + BOOL const isTop = state == State::Top; + self.placePageView.anchorImage.transform = isTop ? CGAffineTransformMakeRotation(M_PI) : CGAffineTransformIdentity; + [self.previewLayoutHelper layoutInOpenState:isTop]; } #pragma mark - UITableViewDelegate @@ -274,6 +275,7 @@ CGFloat const kLuftDraggingOffset = 30; self.state = State::Top; offset = self.topContentOffset; } + place_page_layout::animate(^{ [self.scrollView setContentOffset:{0, offset} animated:YES]; }); } diff --git a/iphone/Maps/Classes/_MWMPPPSpace.xib b/iphone/Maps/Classes/_MWMPPPSpace.xib index fba715cf93..cdd336490e 100644 --- a/iphone/Maps/Classes/_MWMPPPSpace.xib +++ b/iphone/Maps/Classes/_MWMPPPSpace.xib @@ -8,7 +8,7 @@ - + @@ -20,6 +20,9 @@ + + + diff --git a/iphone/Maps/Maps.xcodeproj/project.pbxproj b/iphone/Maps/Maps.xcodeproj/project.pbxproj index 2dcf89fa1b..c82f47eed8 100644 --- a/iphone/Maps/Maps.xcodeproj/project.pbxproj +++ b/iphone/Maps/Maps.xcodeproj/project.pbxproj @@ -826,6 +826,10 @@ F6B2E61F1C3D5F31005562DF /* MWMNightModeController.mm in Sources */ = {isa = PBXBuildFile; fileRef = F6B2E61E1C3D5F31005562DF /* MWMNightModeController.mm */; }; F6B870161DDCA03600BE8D94 /* MWMPlacePageEntity.mm in Sources */ = {isa = PBXBuildFile; fileRef = F6B870151DDCA03600BE8D94 /* MWMPlacePageEntity.mm */; }; F6B870171DDCA03600BE8D94 /* MWMPlacePageEntity.mm in Sources */ = {isa = PBXBuildFile; fileRef = F6B870151DDCA03600BE8D94 /* MWMPlacePageEntity.mm */; }; + F6B8701D1DDCB2F400BE8D94 /* MWMPPPreviewBannerCell.mm in Sources */ = {isa = PBXBuildFile; fileRef = F6B8701B1DDCB2F400BE8D94 /* MWMPPPreviewBannerCell.mm */; }; + F6B8701E1DDCB2F400BE8D94 /* MWMPPPreviewBannerCell.mm in Sources */ = {isa = PBXBuildFile; fileRef = F6B8701B1DDCB2F400BE8D94 /* MWMPPPreviewBannerCell.mm */; }; + F6B8701F1DDCB2F400BE8D94 /* MWMPPPreviewBannerCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = F6B8701C1DDCB2F400BE8D94 /* MWMPPPreviewBannerCell.xib */; }; + F6B870201DDCB2F400BE8D94 /* MWMPPPreviewBannerCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = F6B8701C1DDCB2F400BE8D94 /* MWMPPPreviewBannerCell.xib */; }; F6B97B261CD0CA990009B612 /* MWMBookmarkNameCell.mm in Sources */ = {isa = PBXBuildFile; fileRef = F6B97B251CD0CA990009B612 /* MWMBookmarkNameCell.mm */; }; F6B97B271CD0CA990009B612 /* MWMBookmarkNameCell.mm in Sources */ = {isa = PBXBuildFile; fileRef = F6B97B251CD0CA990009B612 /* MWMBookmarkNameCell.mm */; }; F6B97B291CD0CB170009B612 /* MWMBookmarkNameCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = F6B97B281CD0CB170009B612 /* MWMBookmarkNameCell.xib */; }; @@ -1614,6 +1618,9 @@ F6B2E61E1C3D5F31005562DF /* MWMNightModeController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMNightModeController.mm; sourceTree = ""; }; F6B870141DDCA03600BE8D94 /* MWMPlacePageEntity.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMPlacePageEntity.h; sourceTree = ""; }; F6B870151DDCA03600BE8D94 /* MWMPlacePageEntity.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMPlacePageEntity.mm; sourceTree = ""; }; + F6B8701A1DDCB2F400BE8D94 /* MWMPPPreviewBannerCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMPPPreviewBannerCell.h; sourceTree = ""; }; + F6B8701B1DDCB2F400BE8D94 /* MWMPPPreviewBannerCell.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMPPPreviewBannerCell.mm; sourceTree = ""; }; + F6B8701C1DDCB2F400BE8D94 /* MWMPPPreviewBannerCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MWMPPPreviewBannerCell.xib; sourceTree = ""; }; F6B97B241CD0CA990009B612 /* MWMBookmarkNameCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMBookmarkNameCell.h; sourceTree = ""; }; F6B97B251CD0CA990009B612 /* MWMBookmarkNameCell.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMBookmarkNameCell.mm; sourceTree = ""; }; F6B97B281CD0CB170009B612 /* MWMBookmarkNameCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MWMBookmarkNameCell.xib; sourceTree = ""; }; @@ -2890,6 +2897,7 @@ F645B64B1D6C52F600A69989 /* MWMPlacePageProtocol.h */, F645B6471D6C482400A69989 /* MWMPlacePageManager.h */, F645B6481D6C482400A69989 /* MWMPlacePageManager.mm */, + F6B870191DDCB2B200BE8D94 /* Banners */, F6E2B0061D9E816D00793C36 /* Data */, F6E2B0051D9E815100793C36 /* Layout */, F634C8EE1D787A8F00BE04E2 /* Preview */, @@ -3079,6 +3087,16 @@ name = OpenningHours; sourceTree = ""; }; + F6B870191DDCB2B200BE8D94 /* Banners */ = { + isa = PBXGroup; + children = ( + F6B8701A1DDCB2F400BE8D94 /* MWMPPPreviewBannerCell.h */, + F6B8701B1DDCB2F400BE8D94 /* MWMPPPreviewBannerCell.mm */, + F6B8701C1DDCB2F400BE8D94 /* MWMPPPreviewBannerCell.xib */, + ); + name = Banners; + sourceTree = ""; + }; F6BBF2C31B4FFB56000CF8E2 /* LocationAlert */ = { isa = PBXGroup; children = ( @@ -3600,6 +3618,7 @@ 34BAB6EE1BB2DFCE00DB941B /* MWMBottomMenuCollectionViewPortraitCell.xib in Resources */, F6BD1D231CA412E30047B8E8 /* MWMOsmAuthAlert.xib in Resources */, 3401CD7F1C3CF1BE0028C6F8 /* MWMEditorSwitchTableViewCell.xib in Resources */, + F6B8701F1DDCB2F400BE8D94 /* MWMPPPreviewBannerCell.xib in Resources */, 3442B29F1D92C56500CA9291 /* MWMMapDownloaderAdsTableViewCell.xib in Resources */, 9DA46A121C47E95700EF52BA /* drules_proto_legacy.bin in Resources */, 4A23D15B1B8B4DD700D4EB6F /* drules_proto_clear.bin in Resources */, @@ -3759,6 +3778,7 @@ 341F99E41C6B1165001C67B8 /* MWMMapDownloaderTableViewCell.xib in Resources */, 6741A9821BF340DE002C974C /* MWMBottomMenuCollectionViewLandscapeCell.xib in Resources */, 6741A9831BF340DE002C974C /* Mapsme.storyboard in Resources */, + F6B870201DDCB2F400BE8D94 /* MWMPPPreviewBannerCell.xib in Resources */, 6741A9841BF340DE002C974C /* MWMSearchShowOnMapCell.xib in Resources */, 6741A9851BF340DE002C974C /* MWMBottomMenuCollectionViewPortraitCell.xib in Resources */, 9DA46A131C47E95700EF52BA /* drules_proto_legacy.bin in Resources */, @@ -3910,6 +3930,7 @@ 34257D111DC9FB0D00DC5BB9 /* MWMSearchFilterTransitioning.mm in Sources */, 34A759CF1DC795140078C3AE /* MWMWhatsNewNightModeController.mm in Sources */, F6BBF2C61B4FFB72000CF8E2 /* MWMLocationAlert.mm in Sources */, + F6B8701D1DDCB2F400BE8D94 /* MWMPPPreviewBannerCell.mm in Sources */, F6FE3C381CC50FFD00A73196 /* MWMPlaceDoesntExistAlert.mm in Sources */, F64F19991AB81A00006EAF7E /* MWMAlertViewController.mm in Sources */, 341223BB1BEB58FA007227E9 /* MWMBaseMapDownloaderViewController.mm in Sources */, @@ -4157,6 +4178,7 @@ 34257D121DC9FB0D00DC5BB9 /* MWMSearchFilterTransitioning.mm in Sources */, 34ABA6171C2D185C00FE1BEC /* MWMAuthorizationOSMLoginViewController.mm in Sources */, 3492CC131C6DF00F0057D8E8 /* (null) in Sources */, + F6B8701E1DDCB2F400BE8D94 /* MWMPPPreviewBannerCell.mm in Sources */, 34E0EECF1CC51B1D008E4919 /* MWMMapDownloaderButtonTableViewCell.mm in Sources */, 3476B8CC1BFDCB6700874594 /* MWMTTSSettingsViewController.mm in Sources */, 6741A9D41BF340DE002C974C /* MWMAlertViewController.mm in Sources */, diff --git a/iphone/Maps/UIColor+MapsMeColor.h b/iphone/Maps/UIColor+MapsMeColor.h index 5c0c4810b7..f832ee74a5 100644 --- a/iphone/Maps/UIColor+MapsMeColor.h +++ b/iphone/Maps/UIColor+MapsMeColor.h @@ -34,6 +34,7 @@ + (UIColor *)blackOpaque; + (UIColor *)bookingBackground; + (UIColor *)opentableBackground; ++ (UIColor *)bannerBackground; + (UIColor *)colorWithName:(NSString *)colorName; diff --git a/iphone/Maps/UIColor+MapsMeColor.mm b/iphone/Maps/UIColor+MapsMeColor.mm index 71945169c5..e67674f588 100644 --- a/iphone/Maps/UIColor+MapsMeColor.mm +++ b/iphone/Maps/UIColor+MapsMeColor.mm @@ -63,7 +63,8 @@ NSDictionary * night = @{ [UIColor colorWithRed:scaled(255.) green:scaled(230.) blue:scaled(140.) alpha:alpha30], @"alertBackground" : [UIColor colorWithRed:scaled(60.) green:scaled(64.) blue:scaled(68.) alpha:alpha90], - @"blackOpaque" : [UIColor colorWithWhite:1. alpha:alpha04] + @"blackOpaque" : [UIColor colorWithWhite:1. alpha:alpha04], + @"bannerBackground" : [UIColor colorWithRed:scaled(85.) green:scaled(90.) blue:scaled(90.) alpha:alpha100] }; NSDictionary * day = @{ @@ -107,7 +108,8 @@ NSDictionary * day = @{ @"buttonDisabledBlueText" : [UIColor colorWithRed:scaled(3.) green:scaled(122.) blue:scaled(255.) alpha:alpha26], @"alertBackground" : [UIColor colorWithWhite:1. alpha:alpha90], - @"blackOpaque" : [UIColor colorWithWhite:0. alpha:alpha04] + @"blackOpaque" : [UIColor colorWithWhite:0. alpha:alpha04], + @"bannerBackground" : [UIColor colorWithRed:scaled(255.) green:scaled(248.) blue:scaled(225.) alpha:alpha100] }; UIColor * color(SEL cmd) @@ -302,6 +304,11 @@ UIColor * color(SEL cmd) return [UIColor colorWithRed:scaled(218.) green:scaled(55) blue:scaled(67) alpha:alpha100]; } ++ (UIColor *)bannerBackground +{ + return color(_cmd); +} + + (UIColor *)colorWithName:(NSString *)colorName { #pragma clang diagnostic push