forked from organicmaps/organicmaps
[ios] Added add business button and removed report problem button.
This commit is contained in:
parent
2decb8a249
commit
d3ca3a4c23
11 changed files with 72 additions and 20 deletions
|
@ -359,6 +359,12 @@ extern NSString * const kAlohalyticsTapEventKey;
|
|||
}
|
||||
}
|
||||
|
||||
- (void)addBusinessToPoint:(m2::PointD const &)point
|
||||
{
|
||||
GetFramework().SetViewportCenter(point);
|
||||
[self addPlace];
|
||||
}
|
||||
|
||||
- (void)updateStatusBarStyle
|
||||
{
|
||||
[self.ownerController updateStatusBarStyle];
|
||||
|
|
|
@ -46,6 +46,7 @@ vector<MWMPlacePageCellType> const kSectionMetadataCellTypes {
|
|||
|
||||
vector<MWMPlacePageCellType> const kSectionEditingCellTypes {
|
||||
MWMPlacePageCellTypeEditButton,
|
||||
MWMPlacePageCellTypeAddBusinessButton,
|
||||
MWMPlacePageCellTypeReportButton
|
||||
};
|
||||
|
||||
|
@ -68,6 +69,7 @@ MWMPlacePageCellTypeValueMap const kCellType2ReuseIdentifier{
|
|||
{MWMPlacePageCellTypeOpenHours, "MWMPlacePageOpeningHoursCell"},
|
||||
{MWMPlacePageCellTypeBookmark, "PlacePageBookmarkCell"},
|
||||
{MWMPlacePageCellTypeEditButton, "MWMPlacePageButtonCell"},
|
||||
{MWMPlacePageCellTypeAddBusinessButton, "MWMPlacePageButtonCell"},
|
||||
{MWMPlacePageCellTypeReportButton, "MWMPlacePageButtonCell"}};
|
||||
|
||||
NSString * reuseIdentifier(MWMPlacePageCellType cellType)
|
||||
|
@ -401,11 +403,6 @@ enum class AttributePosition
|
|||
[CATransaction commit];
|
||||
}
|
||||
|
||||
- (void)editPlace
|
||||
{
|
||||
[self.ownerPlacePage editPlace];
|
||||
}
|
||||
|
||||
- (UITableViewCell *)offscreenCellForIdentifier:(NSString *)reuseIdentifier
|
||||
{
|
||||
UITableViewCell * cell = self.offscreenCells[reuseIdentifier];
|
||||
|
@ -438,9 +435,6 @@ enum class AttributePosition
|
|||
MWMPlacePageCellType const cellType = [self cellTypeForIndexPath:indexPath];
|
||||
switch (cellType)
|
||||
{
|
||||
case MWMPlacePageCellTypeReportButton:
|
||||
[static_cast<MWMPlacePageButtonCell *>(cell) config:self.ownerPlacePage isReport:YES];
|
||||
break;
|
||||
case MWMPlacePageCellTypeBookmark:
|
||||
[(MWMPlacePageBookmarkCell *)cell config:self.ownerPlacePage forHeight:NO];
|
||||
break;
|
||||
|
@ -448,7 +442,9 @@ enum class AttributePosition
|
|||
[(MWMPlacePageOpeningHoursCell *)cell configWithDelegate:self info:[entity getCellValue:cellType]];
|
||||
break;
|
||||
case MWMPlacePageCellTypeEditButton:
|
||||
[static_cast<MWMPlacePageButtonCell *>(cell) config:self.ownerPlacePage isReport:NO];
|
||||
case MWMPlacePageCellTypeAddBusinessButton:
|
||||
case MWMPlacePageCellTypeReportButton:
|
||||
[static_cast<MWMPlacePageButtonCell *>(cell) config:self.ownerPlacePage forType:cellType];
|
||||
break;
|
||||
default:
|
||||
{
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
- (void)changeBookmarkCategory;
|
||||
- (void)changeBookmarkDescription;
|
||||
- (void)editPlace;
|
||||
- (void)addBusiness;
|
||||
- (void)reportProblem;
|
||||
- (void)share;
|
||||
- (void)route;
|
||||
|
|
|
@ -138,6 +138,11 @@ static NSString * const kPlacePageViewCenterKeyPath = @"center";
|
|||
[self.manager editPlace];
|
||||
}
|
||||
|
||||
- (void)addBusiness
|
||||
{
|
||||
[self.manager addBusiness];
|
||||
}
|
||||
|
||||
- (void)reportProblem
|
||||
{
|
||||
[self.manager reportProblem];
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
#import "MWMTableViewCell.h"
|
||||
#import "MWMPlacePageEntity.h"
|
||||
|
||||
@class MWMPlacePage;
|
||||
|
||||
@interface MWMPlacePageButtonCell : MWMTableViewCell
|
||||
|
||||
- (void)config:(MWMPlacePage *)placePage isReport:(BOOL)isReport;
|
||||
- (void)config:(MWMPlacePage *)placePage forType:(MWMPlacePageCellType)type;
|
||||
|
||||
@end
|
||||
|
|
|
@ -8,27 +8,58 @@
|
|||
|
||||
@property (weak, nonatomic) MWMPlacePage * placePage;
|
||||
@property (weak, nonatomic) IBOutlet UIButton * titleButton;
|
||||
@property (nonatomic) BOOL isReport;
|
||||
@property (nonatomic) MWMPlacePageCellType type;
|
||||
|
||||
@end
|
||||
|
||||
@implementation MWMPlacePageButtonCell
|
||||
|
||||
- (void)config:(MWMPlacePage *)placePage isReport:(BOOL)isReport
|
||||
- (void)config:(MWMPlacePage *)placePage forType:(MWMPlacePageCellType)type
|
||||
{
|
||||
self.placePage = placePage;
|
||||
self.isReport = isReport;
|
||||
[self.titleButton setTitleColor:isReport ? [UIColor red] : [UIColor linkBlue] forState:UIControlStateNormal];
|
||||
[self.titleButton setTitle:isReport ? L(@"placepage_report_problem_button") : L(@"edit_place") forState:UIControlStateNormal];
|
||||
switch (type)
|
||||
{
|
||||
case MWMPlacePageCellTypeAddBusinessButton:
|
||||
[self.titleButton setTitleColor:[UIColor linkBlue] forState:UIControlStateNormal];
|
||||
[self.titleButton setTitle:L(@"add_business_button") forState:UIControlStateNormal];
|
||||
break;
|
||||
case MWMPlacePageCellTypeReportButton:
|
||||
[self.titleButton setTitleColor:[UIColor red] forState:UIControlStateNormal];
|
||||
[self.titleButton setTitle:L(@"placepage_report_problem_button") forState:UIControlStateNormal];
|
||||
break;
|
||||
case MWMPlacePageCellTypeEditButton:
|
||||
[self.titleButton setTitleColor:[UIColor linkBlue] forState:UIControlStateNormal];
|
||||
[self.titleButton setTitle:L(@"edit_place") forState:UIControlStateNormal];
|
||||
break;
|
||||
default:
|
||||
NSAssert(false, @"Invalid place page cell type!");
|
||||
break;
|
||||
}
|
||||
self.type = type;
|
||||
}
|
||||
|
||||
- (IBAction)buttonTap
|
||||
{
|
||||
[Statistics logEvent:kStatEventName(kStatPlacePage, self.isReport ? kStatReport : kStatEdit)];
|
||||
if (self.isReport)
|
||||
[self.placePage reportProblem];
|
||||
else
|
||||
NSString * key = nil;
|
||||
switch (self.type)
|
||||
{
|
||||
case MWMPlacePageCellTypeEditButton:
|
||||
key = kStatEdit;
|
||||
[self.placePage editPlace];
|
||||
break;
|
||||
case MWMPlacePageCellTypeAddBusinessButton:
|
||||
key = kStatAddPlace;
|
||||
[self.placePage addBusiness];
|
||||
break;
|
||||
case MWMPlacePageCellTypeReportButton:
|
||||
key = kStatReport;
|
||||
[self.placePage reportProblem];
|
||||
break;
|
||||
default:
|
||||
NSAssert(false, @"Incorrect cell type!");
|
||||
break;
|
||||
}
|
||||
[Statistics logEvent:kStatEventName(kStatPlacePage, key)];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -14,6 +14,7 @@ typedef NS_ENUM(NSUInteger, MWMPlacePageCellType)
|
|||
MWMPlacePageCellTypeCoordinate,
|
||||
MWMPlacePageCellTypeBookmark,
|
||||
MWMPlacePageCellTypeEditButton,
|
||||
MWMPlacePageCellTypeAddBusinessButton,
|
||||
MWMPlacePageCellTypeReportButton,
|
||||
MWMPlacePageCellTypeCategory,
|
||||
MWMPlacePageCellTypeName,
|
||||
|
|
|
@ -153,7 +153,9 @@ void initFieldsMap()
|
|||
// TODO(Vlad): It's a really strange way to "display" cell if returned text is not nil.
|
||||
return m_info.IsEditable() && isNewMWM ? @"" : nil;
|
||||
case MWMPlacePageCellTypeReportButton:
|
||||
return m_info.IsFeature() && isNewMWM ? @"" : nil;
|
||||
return /* m_info.IsFeature() && isNewMWM ? @"" : */nil;
|
||||
case MWMPlacePageCellTypeAddBusinessButton:
|
||||
return m_info.IsBuilding() ? @"" : nil;
|
||||
default:
|
||||
{
|
||||
auto const it = m_values.find(cellType);
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
- (void)routeTo;
|
||||
- (void)share;
|
||||
- (void)editPlace;
|
||||
- (void)addBusiness;
|
||||
- (void)reportProblem;
|
||||
- (void)addBookmark;
|
||||
- (void)removeBookmark;
|
||||
|
|
|
@ -258,6 +258,11 @@ extern NSString * const kBookmarksChangedNotification;
|
|||
[(MapViewController *)self.ownerViewController openEditor];
|
||||
}
|
||||
|
||||
- (void)addBusiness
|
||||
{
|
||||
[self.delegate addBusinessToPoint:self.entity.mercator];
|
||||
}
|
||||
|
||||
- (void)reportProblem
|
||||
{
|
||||
[static_cast<MapViewController *>(self.ownerViewController) showReportController];
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#import "MWMRoutingProtocol.h"
|
||||
|
||||
#include "geometry/point2d.hpp"
|
||||
|
||||
@protocol MWMPlacePageViewManagerProtocol <MWMRoutingProtocol>
|
||||
|
||||
- (void)dragPlacePage:(CGRect)frame;
|
||||
|
@ -7,5 +9,6 @@
|
|||
- (void)updateStatusBarStyle;
|
||||
- (void)apiBack;
|
||||
- (void)placePageDidClose;
|
||||
- (void)addBusinessToPoint:(m2::PointD const &)point;
|
||||
|
||||
@end
|
Loading…
Add table
Reference in a new issue