diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/MWMMapViewControlsManager.mm b/iphone/Maps/Classes/CustomViews/MapViewControls/MWMMapViewControlsManager.mm index 89db371326..dc9298bce9 100644 --- a/iphone/Maps/Classes/CustomViews/MapViewControls/MWMMapViewControlsManager.mm +++ b/iphone/Maps/Classes/CustomViews/MapViewControls/MWMMapViewControlsManager.mm @@ -297,6 +297,14 @@ extern NSString * const kAlohalyticsTapEventKey; #pragma mark - MWMBottomMenuControllerProtocol +- (void)didFinishAddingPlace +{ + self.menuState = MWMBottomMenuStateInactive; + static_cast(self.ownerController.view).widgetsManager.fullScreen = NO; +} + +#pragma mark - MWMBottomMenuControllerProtocol && MWMPlacePageViewManagerProtocol + - (void)addPlace { self.menuState = MWMBottomMenuStateHidden; @@ -321,12 +329,6 @@ extern NSString * const kAlohalyticsTapEventKey; }]; } -- (void)didFinishAddingPlace -{ - self.menuState = MWMBottomMenuStateInactive; - static_cast(self.ownerController.view).widgetsManager.fullScreen = NO; -} - #pragma mark - MWMPlacePageViewManagerDelegate - (void)dragPlacePage:(CGRect)frame diff --git a/iphone/Maps/Classes/MWMBasePlacePageView.mm b/iphone/Maps/Classes/MWMBasePlacePageView.mm index 004867a4e5..cc6e6ca692 100644 --- a/iphone/Maps/Classes/MWMBasePlacePageView.mm +++ b/iphone/Maps/Classes/MWMBasePlacePageView.mm @@ -47,6 +47,7 @@ vector const kSectionMetadataCellTypes { vector const kSectionEditingCellTypes { MWMPlacePageCellTypeEditButton, MWMPlacePageCellTypeAddBusinessButton, + MWMPlacePageCellTypeAddPlaceButton }; using TCellTypesSectionMap = pair, PlacePageSection>; @@ -68,7 +69,8 @@ MWMPlacePageCellTypeValueMap const kCellType2ReuseIdentifier{ {MWMPlacePageCellTypeOpenHours, "MWMPlacePageOpeningHoursCell"}, {MWMPlacePageCellTypeBookmark, "PlacePageBookmarkCell"}, {MWMPlacePageCellTypeEditButton, "MWMPlacePageButtonCell"}, - {MWMPlacePageCellTypeAddBusinessButton, "MWMPlacePageButtonCell"}}; + {MWMPlacePageCellTypeAddBusinessButton, "MWMPlacePageButtonCell"}, + {MWMPlacePageCellTypeAddPlaceButton, "MWMPlacePageButtonCell"}}; NSString * reuseIdentifier(MWMPlacePageCellType cellType) { @@ -441,6 +443,7 @@ enum class AttributePosition break; case MWMPlacePageCellTypeEditButton: case MWMPlacePageCellTypeAddBusinessButton: + case MWMPlacePageCellTypeAddPlaceButton: [static_cast(cell) config:self.ownerPlacePage forType:cellType]; break; default: diff --git a/iphone/Maps/Classes/MWMPlacePage.h b/iphone/Maps/Classes/MWMPlacePage.h index 35839f9520..9d1cdaf3ba 100644 --- a/iphone/Maps/Classes/MWMPlacePage.h +++ b/iphone/Maps/Classes/MWMPlacePage.h @@ -29,6 +29,7 @@ - (void)changeBookmarkDescription; - (void)editPlace; - (void)addBusiness; +- (void)addPlace; - (void)share; - (void)route; - (void)reloadBookmark; diff --git a/iphone/Maps/Classes/MWMPlacePage.mm b/iphone/Maps/Classes/MWMPlacePage.mm index fd334e53f7..5654fdff4b 100644 --- a/iphone/Maps/Classes/MWMPlacePage.mm +++ b/iphone/Maps/Classes/MWMPlacePage.mm @@ -143,6 +143,11 @@ static NSString * const kPlacePageViewCenterKeyPath = @"center"; [self.manager addBusiness]; } +- (void)addPlace +{ + [self.manager addPlace]; +} + - (void)share { [self.manager share]; diff --git a/iphone/Maps/Classes/MWMPlacePageButtonCell.mm b/iphone/Maps/Classes/MWMPlacePageButtonCell.mm index 2efa03a0a9..63ad16b978 100644 --- a/iphone/Maps/Classes/MWMPlacePageButtonCell.mm +++ b/iphone/Maps/Classes/MWMPlacePageButtonCell.mm @@ -25,6 +25,9 @@ case MWMPlacePageCellTypeEditButton: [self.titleButton setTitle:L(@"edit_place") forState:UIControlStateNormal]; break; + case MWMPlacePageCellTypeAddPlaceButton: + [self.titleButton setTitle:L(@"placepage_add_place_button") forState:UIControlStateNormal]; + break; default: NSAssert(false, @"Invalid place page cell type!"); break; @@ -44,6 +47,9 @@ [Statistics logEvent:kStatEditorAddClick withParameters:@{kStatValue : kStatPlacePage}]; [self.placePage addBusiness]; break; + case MWMPlacePageCellTypeAddPlaceButton: + [self.placePage addPlace]; + break; default: NSAssert(false, @"Incorrect cell type!"); break; diff --git a/iphone/Maps/Classes/MWMPlacePageEntity.h b/iphone/Maps/Classes/MWMPlacePageEntity.h index a989d9049d..f2844bfcc5 100644 --- a/iphone/Maps/Classes/MWMPlacePageEntity.h +++ b/iphone/Maps/Classes/MWMPlacePageEntity.h @@ -16,6 +16,7 @@ typedef NS_ENUM(NSUInteger, MWMPlacePageCellType) MWMPlacePageCellTypeBookmark, MWMPlacePageCellTypeEditButton, MWMPlacePageCellTypeAddBusinessButton, + MWMPlacePageCellTypeAddPlaceButton, MWMPlacePageCellTypeReportButton, MWMPlacePageCellTypeCategory, MWMPlacePageCellTypeName, diff --git a/iphone/Maps/Classes/MWMPlacePageEntity.mm b/iphone/Maps/Classes/MWMPlacePageEntity.mm index 60f6903334..272df0e853 100644 --- a/iphone/Maps/Classes/MWMPlacePageEntity.mm +++ b/iphone/Maps/Classes/MWMPlacePageEntity.mm @@ -147,11 +147,13 @@ void initFieldsMap() return self.title; case MWMPlacePageCellTypeCoordinate: return [self coordinate]; + case MWMPlacePageCellTypeAddPlaceButton: + return m_info.ShouldShowAddPlace() && isNewMWM ? @"" : nil; case MWMPlacePageCellTypeBookmark: return m_info.IsBookmark() ? @"" : nil; case MWMPlacePageCellTypeEditButton: // TODO(Vlad): It's a really strange way to "display" cell if returned text is not nil. - return isNewMWM ? @"": nil; + return isNewMWM && !m_info.IsMyPosition() && m_info.IsFeature() ? @"": nil; case MWMPlacePageCellTypeAddBusinessButton: return m_info.IsBuilding() ? @"" : nil; default: diff --git a/iphone/Maps/Classes/MWMPlacePageViewManager.h b/iphone/Maps/Classes/MWMPlacePageViewManager.h index 08c23b7c2e..3b20ef3a37 100644 --- a/iphone/Maps/Classes/MWMPlacePageViewManager.h +++ b/iphone/Maps/Classes/MWMPlacePageViewManager.h @@ -26,6 +26,7 @@ - (void)share; - (void)editPlace; - (void)addBusiness; +- (void)addPlace; - (void)addBookmark; - (void)removeBookmark; - (void)apiBack; diff --git a/iphone/Maps/Classes/MWMPlacePageViewManager.mm b/iphone/Maps/Classes/MWMPlacePageViewManager.mm index 273043d99b..325e244df2 100644 --- a/iphone/Maps/Classes/MWMPlacePageViewManager.mm +++ b/iphone/Maps/Classes/MWMPlacePageViewManager.mm @@ -263,6 +263,11 @@ extern NSString * const kBookmarksChangedNotification; [self.delegate addBusinessToPoint:self.entity.mercator]; } +- (void)addPlace +{ + [self.delegate addPlace]; +} + - (void)addBookmark { [Statistics logEvent:kStatEventName(kStatPlacePage, kStatBookmarks) diff --git a/iphone/Maps/Classes/MWMPlacePageViewManagerDelegate.h b/iphone/Maps/Classes/MWMPlacePageViewManagerDelegate.h index d219cfbf89..104d40707b 100644 --- a/iphone/Maps/Classes/MWMPlacePageViewManagerDelegate.h +++ b/iphone/Maps/Classes/MWMPlacePageViewManagerDelegate.h @@ -10,5 +10,6 @@ - (void)apiBack; - (void)placePageDidClose; - (void)addBusinessToPoint:(m2::PointD const &)point; +- (void)addPlace; @end \ No newline at end of file diff --git a/map/place_page_info.cpp b/map/place_page_info.cpp index 648626f87a..3297a1548b 100644 --- a/map/place_page_info.cpp +++ b/map/place_page_info.cpp @@ -16,6 +16,7 @@ bool Info::IsMyPosition() const { return m_isMyPosition; } bool Info::HasApiUrl() const { return !m_apiUrl.empty(); } bool Info::IsEditable() const { return m_isEditable; } bool Info::HasWifi() const { return GetInternet() == osm::Internet::Wlan; } +bool Info::ShouldShowAddPlace() const { return !IsFeature() || (!IsPointType() && !IsBuilding()); } string Info::FormatNewBookmarkName() const { diff --git a/map/place_page_info.hpp b/map/place_page_info.hpp index 313e7c3721..29bef416a4 100644 --- a/map/place_page_info.hpp +++ b/map/place_page_info.hpp @@ -24,6 +24,7 @@ public: bool IsFeature() const; bool IsBookmark() const; bool IsMyPosition() const; + bool ShouldShowAddPlace() const; /// @returns true if Back API button should be displayed. bool HasApiUrl() const; /// @returns true if Edit Place button should be displayed.