Merge pull request #2946 from igrechuhin/MAPSME-873

[ios] Fixed duplicate alerts on disabled location.
This commit is contained in:
Vlad Mihaylenko 2016-04-21 16:16:16 +04:00
commit 7e71ced9c2
3 changed files with 6 additions and 3 deletions

View file

@ -577,9 +577,9 @@ NSString * const kUDViralAlertWasShown = @"ViralAlertWasShown";
[[MapsAppDelegate theApp].locationManager start:self];
break;
case location::NotFollowNoPosition:
//TODO(iOS team): show dialog if it is not first launch
self.disableStandbyOnLocationStateMode = NO;
if (![Alohalytics isFirstSession])
if (![Alohalytics isFirstSession] && [MapsAppDelegate theApp].locationManager.isStarted)
{
[self.alertController presentLocationNotFoundAlertWithOkBlock:^
{
GetFramework().SwitchMyPositionNextMode();
@ -588,6 +588,7 @@ NSString * const kUDViralAlertWasShown = @"ViralAlertWasShown";
{
[[MapsAppDelegate theApp].locationManager stop:self];
}];
}
break;
case location::NotFollow:
self.disableStandbyOnLocationStateMode = NO;

View file

@ -16,6 +16,8 @@
@interface LocationManager : NSObject <CLLocationManagerDelegate>
@property (nonatomic, readonly) BOOL isStarted;
- (void)start:(id <LocationObserver>)observer;
- (void)stop:(id <LocationObserver>)observer;
- (CLLocation *)lastLocation;

View file

@ -25,7 +25,7 @@ static NSString * const kAlohalyticsLocationRequestAlwaysFailed = @"$locationAlw
@property (nonatomic) CLLocationManager * locationManager;
@property (nonatomic) BOOL isStarted;
@property (nonatomic, readwrite) BOOL isStarted;
@property (nonatomic) NSMutableSet * observers;
@property (nonatomic) NSDate * lastLocationTime;