Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorigrechuhin <i.grechuhin@gmail.com>2016-05-19 14:17:32 +0300
committerigrechuhin <i.grechuhin@gmail.com>2016-05-19 14:17:32 +0300
commitfbd0f35cd944bce5ed08f31c5622a1cb9951b956 (patch)
tree1e9d24c6aff38ec93709e6816c13d798a397b4be
parent2b68d82c97abfdb1e499b9d8e755fdd86dd0f1a0 (diff)
parent666dbe720eb36bea18b73eb799280e6ea7043ba3 (diff)
Merge pull request #3268 from VladiMihaylenko/dev
[ios] Fixed bookmark adding and removing.
-rw-r--r--iphone/Maps/Classes/MWMPlacePage.h3
-rw-r--r--iphone/Maps/Classes/MWMPlacePage.mm21
-rw-r--r--iphone/Maps/Classes/MWMPlacePageActionBar.h8
-rw-r--r--iphone/Maps/Classes/MWMPlacePageActionBar.mm30
-rw-r--r--iphone/Maps/Classes/MWMPlacePageViewManager.mm1
5 files changed, 22 insertions, 41 deletions
diff --git a/iphone/Maps/Classes/MWMPlacePage.h b/iphone/Maps/Classes/MWMPlacePage.h
index df1eb476b2..fb691778b1 100644
--- a/iphone/Maps/Classes/MWMPlacePage.h
+++ b/iphone/Maps/Classes/MWMPlacePage.h
@@ -28,10 +28,7 @@
- (void)editPlace;
- (void)addBusiness;
- (void)addPlace;
-- (void)share;
-- (void)route;
- (void)reloadBookmark;
-- (void)apiBack;
- (void)addPlacePageShadowToView:(UIView *)view offset:(CGSize)offset;
- (IBAction)didTap:(UITapGestureRecognizer *)sender;
diff --git a/iphone/Maps/Classes/MWMPlacePage.mm b/iphone/Maps/Classes/MWMPlacePage.mm
index 49b2ca3c02..f9b1480cb9 100644
--- a/iphone/Maps/Classes/MWMPlacePage.mm
+++ b/iphone/Maps/Classes/MWMPlacePage.mm
@@ -62,12 +62,12 @@ extern NSString * const kPP2BookmarkEditingIPADSegue = @"PP2BookmarkEditingIPAD"
BOOL const isPrepareRouteMode = MapsAppDelegate.theApp.routingPlaneMode != MWMRoutingPlaneModeNone;
if (self.actionBar.isPrepareRouteMode == isPrepareRouteMode)
{
- [self.actionBar configureWithPlacePage:self];
+ [self.actionBar configureWithPlacePageManager:self.manager];
}
else
{
[self.actionBar removeFromSuperview];
- self.actionBar = [MWMPlacePageActionBar actionBarForPlacePage:self];
+ self.actionBar = [MWMPlacePageActionBar actionBarForPlacePageManager:self.manager];
}
}
@@ -89,14 +89,9 @@ extern NSString * const kPP2BookmarkEditingIPADSegue = @"PP2BookmarkEditingIPAD"
}
#pragma mark - Actions
-- (void)apiBack
-{
- [self.manager apiBack];
-}
- (void)addBookmark
{
- [self.manager addBookmark];
[self.basePlacePageView addBookmark];
}
@@ -121,16 +116,6 @@ extern NSString * const kPP2BookmarkEditingIPADSegue = @"PP2BookmarkEditingIPAD"
[self.manager addPlace];
}
-- (void)share
-{
- [self.manager share];
-}
-
-- (void)route
-{
- [self.manager buildRoute];
-}
-
- (void)addPlacePageShadowToView:(UIView *)view offset:(CGSize)offset
{
CALayer * layer = view.layer;
@@ -189,7 +174,7 @@ extern NSString * const kPP2BookmarkEditingIPADSegue = @"PP2BookmarkEditingIPAD"
- (MWMPlacePageActionBar *)actionBar
{
if (!_actionBar)
- _actionBar = [MWMPlacePageActionBar actionBarForPlacePage:self];
+ _actionBar = [MWMPlacePageActionBar actionBarForPlacePageManager:self.manager];
return _actionBar;
}
diff --git a/iphone/Maps/Classes/MWMPlacePageActionBar.h b/iphone/Maps/Classes/MWMPlacePageActionBar.h
index a18cc99271..f63cf4eb23 100644
--- a/iphone/Maps/Classes/MWMPlacePageActionBar.h
+++ b/iphone/Maps/Classes/MWMPlacePageActionBar.h
@@ -1,6 +1,4 @@
-#import <UIKit/UIKit.h>
-
-@class MWMPlacePage;
+@class MWMPlacePageViewManager;
@interface MWMPlacePageActionBar : SolidTouchView
@@ -9,8 +7,8 @@
@property (weak, nonatomic) IBOutlet UIButton * shareButton;
-+ (MWMPlacePageActionBar *)actionBarForPlacePage:(MWMPlacePage *)placePage;
-- (void)configureWithPlacePage:(MWMPlacePage *)placePage;
++ (MWMPlacePageActionBar *)actionBarForPlacePageManager:(MWMPlacePageViewManager *)placePageManager;
+- (void)configureWithPlacePageManager:(MWMPlacePageViewManager *)placePageManager;
- (instancetype)init __attribute__((unavailable("call actionBarForPlacePage: instead")));
- (instancetype)initWithCoder:(NSCoder *)aDecoder __attribute__((unavailable("call actionBarForPlacePage: instead")));
diff --git a/iphone/Maps/Classes/MWMPlacePageActionBar.mm b/iphone/Maps/Classes/MWMPlacePageActionBar.mm
index dff4409221..c5e9e9af43 100644
--- a/iphone/Maps/Classes/MWMPlacePageActionBar.mm
+++ b/iphone/Maps/Classes/MWMPlacePageActionBar.mm
@@ -15,7 +15,7 @@ static NSString * const kPlacePageActionBarNibName = @"PlacePageActionBar";
@interface MWMPlacePageActionBar ()
-@property (weak, nonatomic) MWMPlacePage * placePage;
+@property (weak, nonatomic) MWMPlacePageViewManager * placePageManager;
@property (weak, nonatomic) IBOutlet UIButton * apiBackButton;
@property (weak, nonatomic) IBOutlet UIButton * bookmarkButton;
@property (weak, nonatomic) IBOutlet UIButton * routeButton;
@@ -28,7 +28,7 @@ static NSString * const kPlacePageActionBarNibName = @"PlacePageActionBar";
@implementation MWMPlacePageActionBar
-+ (MWMPlacePageActionBar *)actionBarForPlacePage:(MWMPlacePage *)placePage
++ (MWMPlacePageActionBar *)actionBarForPlacePageManager:(MWMPlacePageViewManager *)placePageManager
{
BOOL const isPrepareRouteMode = MapsAppDelegate.theApp.routingPlaneMode != MWMRoutingPlaneModeNone;
NSUInteger const i = isPrepareRouteMode ? 1 : 0;
@@ -36,19 +36,19 @@ static NSString * const kPlacePageActionBarNibName = @"PlacePageActionBar";
loadNibNamed:kPlacePageActionBarNibName owner:nil options:nil][i];
NSAssert(i == bar.tag, @"Incorrect view!");
bar.isPrepareRouteMode = isPrepareRouteMode;
- bar.placePage = placePage;
+ bar.placePageManager = placePageManager;
if (isPrepareRouteMode)
return bar;
[bar setupBookmarkButton];
- [bar configureWithPlacePage:placePage];
+ [bar configureWithPlacePageManager:placePageManager];
return bar;
}
-- (void)configureWithPlacePage:(MWMPlacePage *)placePage
+- (void)configureWithPlacePageManager:(MWMPlacePageViewManager *)placePageManager
{
- self.placePage = placePage;
- MWMPlacePageEntity * entity = placePage.manager.entity;
+ self.placePageManager = placePageManager;
+ MWMPlacePageEntity * entity = self.placePageManager.entity;
if (entity.isApi)
[self setupApiBar];
// TODO(Vlad): API point can be a bookmark too. Probably "else if" shoud be replaced by "if".
@@ -130,12 +130,12 @@ static NSString * const kPlacePageActionBarNibName = @"PlacePageActionBar";
- (IBAction)fromTap
{
- [self.placePage.manager routeFrom];
+ [self.placePageManager routeFrom];
}
- (IBAction)toTap
{
- [self.placePage.manager routeTo];
+ [self.placePageManager routeTo];
}
- (IBAction)bookmarkTap:(UIButton *)sender
@@ -145,12 +145,12 @@ static NSString * const kPlacePageActionBarNibName = @"PlacePageActionBar";
if (self.isBookmark)
{
[sender.imageView startAnimating];
- [self.placePage addBookmark];
+ [self.placePageManager addBookmark];
[eventName appendString:@"Add"];
}
else
{
- [self.placePage removeBookmark];
+ [self.placePageManager removeBookmark];
[eventName appendString:@"Delete"];
}
[Alohalytics logEvent:kAlohalyticsTapEventKey withValue:eventName];
@@ -163,7 +163,7 @@ static NSString * const kPlacePageActionBarNibName = @"PlacePageActionBar";
CGFloat const maximumWidth = 360.;
CGFloat const screenWidth = MIN(size.height, size.width);
CGFloat const actualWidth = IPAD ? maximumWidth : (size.height < size.width ? MIN(screenWidth, maximumWidth) : screenWidth);
- MWMPlacePageEntity * entity = self.placePage.manager.entity;
+ MWMPlacePageEntity * entity = self.placePageManager.entity;
if (entity.isApi)
{
CGFloat const boxWidth = 4 * buttonWidth;
@@ -196,17 +196,17 @@ static NSString * const kPlacePageActionBarNibName = @"PlacePageActionBar";
- (IBAction)shareTap
{
- [self.placePage share];
+ [self.placePageManager share];
}
- (IBAction)routeTap
{
- [self.placePage route];
+ [self.placePageManager buildRoute];
}
- (IBAction)backTap
{
- [self.placePage apiBack];
+ [self.placePageManager apiBack];
}
#pragma mark - Properties
diff --git a/iphone/Maps/Classes/MWMPlacePageViewManager.mm b/iphone/Maps/Classes/MWMPlacePageViewManager.mm
index fd1db566d5..583b2846d0 100644
--- a/iphone/Maps/Classes/MWMPlacePageViewManager.mm
+++ b/iphone/Maps/Classes/MWMPlacePageViewManager.mm
@@ -283,6 +283,7 @@ extern NSString * const kBookmarksChangedNotification;
object:nil
userInfo:nil];
[self updateDistance];
+ [self.placePage addBookmark];
}
- (void)removeBookmark