forked from organicmaps/organicmaps
[iOS] Disable isolines on error
https://jira.mail.ru/browse/MAPSME-13295 https://jira.mail.ru/browse/MAPSME-13459
This commit is contained in:
parent
6b0b4049d6
commit
b05dc63f19
3 changed files with 27 additions and 9 deletions
|
@ -42,6 +42,7 @@
|
|||
- (void)presentSearchNoResultsAlert;
|
||||
- (void)presentMobileInternetAlertWithBlock:(nonnull MWMMobileInternetAlertCompletionBlock)block;
|
||||
- (void)presentInfoAlert:(nonnull NSString *)title text:(nonnull NSString *)text;
|
||||
- (void)presentInfoAlert:(nonnull NSString *)title;
|
||||
- (void)presentCreateBookmarkCategoryAlertWithMaxCharacterNum:(NSUInteger)max
|
||||
minCharacterNum:(NSUInteger)min
|
||||
callback:(nonnull MWMCheckStringBlock)callback;
|
||||
|
|
|
@ -189,6 +189,10 @@ static NSString *const kAlertControllerNibIdentifier = @"MWMAlertViewController"
|
|||
[self displayAlert:[MWMAlert infoAlert:title text:text]];
|
||||
}
|
||||
|
||||
- (void)presentInfoAlert:(nonnull NSString *)title {
|
||||
[self displayAlert:[MWMAlert infoAlert:title text:nil]];
|
||||
}
|
||||
|
||||
- (void)presentEditorViralAlert {
|
||||
[self displayAlert:[MWMAlert editorViralAlert]];
|
||||
}
|
||||
|
|
|
@ -149,6 +149,27 @@ NSArray<UIImage *> *imagesWithName(NSString *name) {
|
|||
}
|
||||
}
|
||||
|
||||
- (void)handleIsolinesState:(MWMMapOverlayIsolinesState)state {
|
||||
switch (state) {
|
||||
case MWMMapOverlayIsolinesStateDisabled:
|
||||
break;
|
||||
case MWMMapOverlayIsolinesStateEnabled:
|
||||
if (![MWMMapOverlayManager isolinesVisible]) {
|
||||
[[MWMToast toastWithText:L(@"isolines_toast_zooms_1_10")] show];
|
||||
[Statistics logEvent:kStatMapToastShow withParameters:@{kStatType: kStatIsolines}];
|
||||
}
|
||||
break;
|
||||
case MWMMapOverlayIsolinesStateExpiredData:
|
||||
[MWMAlertViewController.activeAlertController presentInfoAlert:L(@"isolines_activation_error_dialog")];
|
||||
[MWMMapOverlayManager setIsoLinesEnabled:NO];
|
||||
break;
|
||||
case MWMMapOverlayIsolinesStateNoData:
|
||||
[MWMAlertViewController.activeAlertController presentInfoAlert:L(@"isolines_location_error_dialog")];
|
||||
[MWMMapOverlayManager setIsoLinesEnabled:NO];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)applyTheme {
|
||||
MWMButton *btn = static_cast<MWMButton *>(self.view);
|
||||
UIImageView *iv = btn.imageView;
|
||||
|
@ -163,15 +184,7 @@ NSArray<UIImage *> *imagesWithName(NSString *name) {
|
|||
[[MWMToast toastWithText:L(@"subway_data_unavailable")] show];
|
||||
} else if ([MWMMapOverlayManager isoLinesEnabled]) {
|
||||
btn.imageName = @"btn_isoMap_on";
|
||||
if ([MWMMapOverlayManager isolinesState] == MWMMapOverlayIsolinesStateEnabled &&
|
||||
![MWMMapOverlayManager isolinesVisible]) {
|
||||
[[MWMToast toastWithText:L(@"isolines_toast_zooms_1_10")] show];
|
||||
[Statistics logEvent:kStatMapToastShow withParameters:@{kStatType : kStatIsolines}];
|
||||
} else if ([MWMMapOverlayManager isolinesState] == MWMMapOverlayIsolinesStateNoData) {
|
||||
[[MWMToast toastWithText:L(@"isolines_location_error_dialog")] show];
|
||||
}
|
||||
else if ([MWMMapOverlayManager isolinesState] == MWMMapOverlayIsolinesStateExpiredData)
|
||||
[MWMAlertViewController.activeAlertController presentInfoAlert:L(@"isolines_activation_error_dialog") text:@""];
|
||||
[self handleIsolinesState:[MWMMapOverlayManager isolinesState]];
|
||||
} else if ([MWMMapOverlayManager guidesEnabled]) {
|
||||
btn.imageName = @"btn_layers_off";
|
||||
[self handleGuidesState:[MWMMapOverlayManager guidesState]];
|
||||
|
|
Loading…
Add table
Reference in a new issue