From b367b9bb59ff0cc6698ad37829fe2fc0b6e4110c Mon Sep 17 00:00:00 2001 From: Kiryl Kaveryn Date: Tue, 23 Jan 2024 16:22:41 +0400 Subject: [PATCH] [ios] remove 'continue location' alert and pending timeout subscription Signed-off-by: Kiryl Kaveryn --- .../AlertController/MWMAlertViewController.h | 1 - .../AlertController/MWMAlertViewController.mm | 6 ---- .../MWMLocationNotFoundAlert.h | 7 ----- .../MWMLocationNotFoundAlert.mm | 29 ------------------- iphone/Maps/Classes/MapViewController.mm | 16 +--------- iphone/Maps/Maps.xcodeproj/project.pbxproj | 14 --------- 6 files changed, 1 insertion(+), 72 deletions(-) delete mode 100644 iphone/Maps/Classes/CustomAlert/LocationNotFoundAlert/MWMLocationNotFoundAlert.h delete mode 100644 iphone/Maps/Classes/CustomAlert/LocationNotFoundAlert/MWMLocationNotFoundAlert.mm diff --git a/iphone/Maps/Classes/CustomAlert/AlertController/MWMAlertViewController.h b/iphone/Maps/Classes/CustomAlert/AlertController/MWMAlertViewController.h index cae78cc886..3f304a4f1e 100644 --- a/iphone/Maps/Classes/CustomAlert/AlertController/MWMAlertViewController.h +++ b/iphone/Maps/Classes/CustomAlert/AlertController/MWMAlertViewController.h @@ -16,7 +16,6 @@ - (void)presentLocationAlertWithCancelBlock:(MWMVoidBlock _Nonnull )cancelBlock; - (void)presentLocationServicesDisabledAlert; - (void)presentLocationServiceNotSupportedAlert; -- (void)presentLocationNotFoundAlertWithOkBlock:(nonnull MWMVoidBlock)okBlock; - (void)presentNoConnectionAlert; - (void)presentSearchQuickFilterNoConnectionAlert; - (void)presentDeleteMapProhibitedAlert; diff --git a/iphone/Maps/Classes/CustomAlert/AlertController/MWMAlertViewController.mm b/iphone/Maps/Classes/CustomAlert/AlertController/MWMAlertViewController.mm index 0e58d21e69..c29c6e9d12 100644 --- a/iphone/Maps/Classes/CustomAlert/AlertController/MWMAlertViewController.mm +++ b/iphone/Maps/Classes/CustomAlert/AlertController/MWMAlertViewController.mm @@ -2,7 +2,6 @@ #import "MWMController.h" #import "MWMDownloadTransitMapAlert.h" #import "MWMLocationAlert.h" -#import "MWMLocationNotFoundAlert.h" #import "MapViewController.h" #import "MapsAppDelegate.h" #import "SwiftBridge.h" @@ -60,11 +59,6 @@ static NSString *const kAlertControllerNibIdentifier = @"MWMAlertViewController" - (void)presentLocationServiceNotSupportedAlert { [self displayAlert:[MWMAlert locationServiceNotSupportedAlert]]; } - -- (void)presentLocationNotFoundAlertWithOkBlock:(nonnull MWMVoidBlock)okBlock { - [self displayAlert:[MWMLocationNotFoundAlert alertWithOkBlock:okBlock]]; -} - - (void)presentNoConnectionAlert { [self displayAlert:[MWMAlert noConnectionAlert]]; } diff --git a/iphone/Maps/Classes/CustomAlert/LocationNotFoundAlert/MWMLocationNotFoundAlert.h b/iphone/Maps/Classes/CustomAlert/LocationNotFoundAlert/MWMLocationNotFoundAlert.h deleted file mode 100644 index ed69969a52..0000000000 --- a/iphone/Maps/Classes/CustomAlert/LocationNotFoundAlert/MWMLocationNotFoundAlert.h +++ /dev/null @@ -1,7 +0,0 @@ -#import "MWMDefaultAlert.h" - -@interface MWMLocationNotFoundAlert : MWMDefaultAlert - -+ (instancetype)alertWithOkBlock:(MWMVoidBlock)okBlock; - -@end diff --git a/iphone/Maps/Classes/CustomAlert/LocationNotFoundAlert/MWMLocationNotFoundAlert.mm b/iphone/Maps/Classes/CustomAlert/LocationNotFoundAlert/MWMLocationNotFoundAlert.mm deleted file mode 100644 index eb065d266b..0000000000 --- a/iphone/Maps/Classes/CustomAlert/LocationNotFoundAlert/MWMLocationNotFoundAlert.mm +++ /dev/null @@ -1,29 +0,0 @@ -#import "MWMLocationNotFoundAlert.h" -#import "MWMDefaultAlert_Protected.h" -#import "MWMLocationManager.h" -#import "MWMLocationObserver.h" - -@interface MWMLocationNotFoundAlert () - -@end - -@implementation MWMLocationNotFoundAlert - -+ (instancetype)alertWithOkBlock:(MWMVoidBlock)okBlock -{ - MWMLocationNotFoundAlert * alert = - [self defaultAlertWithTitle:L(@"current_location_unknown_title") - message:L(@"current_location_unknown_message") - rightButtonTitle:L(@"current_location_unknown_continue_button") - leftButtonTitle:L(@"current_location_unknown_stop_button") - rightButtonAction:okBlock - log:@"Location Not Found Alert"]; - [alert setNeedsCloseAlertAfterEnterBackground]; - [MWMLocationManager addObserver:alert]; - return alert; -} - -#pragma mark - MWMLocationObserver - -- (void)onLocationUpdate:(CLLocation *)location { [self close:self.rightButtonAction]; } -@end diff --git a/iphone/Maps/Classes/MapViewController.mm b/iphone/Maps/Classes/MapViewController.mm index 8cfda863ce..ca65e90992 100644 --- a/iphone/Maps/Classes/MapViewController.mm +++ b/iphone/Maps/Classes/MapViewController.mm @@ -440,7 +440,6 @@ NSString *const kPP2BookmarkEditingSegue = @"PP2BookmarkEditing"; // May be better solution would be multiobservers support in the C++ core. [self processMyPositionStateModeEvent:location_helpers::mwmMyPositionMode(mode)]; }); - f.SetMyPositionPendingTimeoutListener([self] { [self processMyPositionPendingTimeout]; }); self.userTouchesAction = UserTouchesActionNone; [[MWMBookmarksManager sharedManager] addObserver:self]; @@ -505,6 +504,7 @@ NSString *const kPP2BookmarkEditingSegue = @"PP2BookmarkEditing"; self.disableStandbyOnLocationStateMode = NO; switch (mode) { case MWMMyPositionModeNotFollowNoPosition: + [MWMLocationManager stop]; break; case MWMMyPositionModePendingPosition: [MWMLocationManager start]; @@ -520,20 +520,6 @@ NSString *const kPP2BookmarkEditingSegue = @"PP2BookmarkEditing"; } } -- (void)processMyPositionPendingTimeout { - [MWMLocationManager stop]; - NSArray> *objects = self.listeners.allObjects; - for (id object in objects) { - [object processMyPositionPendingTimeout]; - } - BOOL const isMapVisible = (self.navigationController.visibleViewController == self); - if (isMapVisible && ![MWMLocationManager isLocationProhibited]) { - [self.alertController presentLocationNotFoundAlertWithOkBlock:^{ - GetFramework().SwitchMyPositionNextMode(); - }]; - } -} - #pragma mark - MWMFrameworkDrapeObserver - (void)processViewportCountryEvent:(CountryId const &)countryId { diff --git a/iphone/Maps/Maps.xcodeproj/project.pbxproj b/iphone/Maps/Maps.xcodeproj/project.pbxproj index 2b4dbc4a9a..3380d35ace 100644 --- a/iphone/Maps/Maps.xcodeproj/project.pbxproj +++ b/iphone/Maps/Maps.xcodeproj/project.pbxproj @@ -72,7 +72,6 @@ 3467CEB2202C6EEE00D3C670 /* BMCNotificationsHeader.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3467CEB1202C6EEE00D3C670 /* BMCNotificationsHeader.swift */; }; 3467CEB6202C6FA900D3C670 /* BMCNotificationsCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3467CEB4202C6FA900D3C670 /* BMCNotificationsCell.swift */; }; 3467CEB7202C6FA900D3C670 /* BMCNotificationsCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3467CEB5202C6FA900D3C670 /* BMCNotificationsCell.xib */; }; - 346B42AC1DD5E3D20094EBEE /* MWMLocationNotFoundAlert.mm in Sources */ = {isa = PBXBuildFile; fileRef = 346B42AA1DD5E3D20094EBEE /* MWMLocationNotFoundAlert.mm */; }; 347040301EA6470700038379 /* BorderedButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3470402E1EA6470700038379 /* BorderedButton.swift */; }; 3472B5CB200F43EF00DC6CD5 /* BackgroundFetchScheduler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3472B5C9200F43EF00DC6CD5 /* BackgroundFetchScheduler.swift */; }; 3472B5CF200F4A2B00DC6CD5 /* BackgroundFetchTask.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3472B5CD200F4A2B00DC6CD5 /* BackgroundFetchTask.swift */; }; @@ -807,8 +806,6 @@ 3467CEB1202C6EEE00D3C670 /* BMCNotificationsHeader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BMCNotificationsHeader.swift; sourceTree = ""; }; 3467CEB4202C6FA900D3C670 /* BMCNotificationsCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BMCNotificationsCell.swift; sourceTree = ""; }; 3467CEB5202C6FA900D3C670 /* BMCNotificationsCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = BMCNotificationsCell.xib; sourceTree = ""; }; - 346B42A91DD5E3D20094EBEE /* MWMLocationNotFoundAlert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MWMLocationNotFoundAlert.h; sourceTree = ""; }; - 346B42AA1DD5E3D20094EBEE /* MWMLocationNotFoundAlert.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MWMLocationNotFoundAlert.mm; sourceTree = ""; }; 346B42AD1DD5E5450094EBEE /* MWMDefaultAlert_Protected.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MWMDefaultAlert_Protected.h; sourceTree = ""; }; 3470402E1EA6470700038379 /* BorderedButton.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BorderedButton.swift; sourceTree = ""; }; 3472B5C9200F43EF00DC6CD5 /* BackgroundFetchScheduler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BackgroundFetchScheduler.swift; sourceTree = ""; }; @@ -2130,15 +2127,6 @@ path = Notifications; sourceTree = ""; }; - 346B42A81DD5E3D20094EBEE /* LocationNotFoundAlert */ = { - isa = PBXGroup; - children = ( - 346B42A91DD5E3D20094EBEE /* MWMLocationNotFoundAlert.h */, - 346B42AA1DD5E3D20094EBEE /* MWMLocationNotFoundAlert.mm */, - ); - path = LocationNotFoundAlert; - sourceTree = ""; - }; 346EDAD81B9F0E15004F8DB5 /* Components */ = { isa = PBXGroup; children = ( @@ -2983,7 +2971,6 @@ F64D9C9C1C899BEA0063FA30 /* EditorAlert */, F63774E51B59374F00BCF54D /* RoutingDisclaimerAlert */, F6BBF2C31B4FFB56000CF8E2 /* LocationAlert */, - 346B42A81DD5E3D20094EBEE /* LocationNotFoundAlert */, F64F19801AB81A00006EAF7E /* AlertController */, F64F19841AB81A00006EAF7E /* BaseAlert */, F64F19871AB81A00006EAF7E /* DefaultAlert */, @@ -4271,7 +4258,6 @@ 34D3B0481E389D05004100F9 /* MWMNoteCell.m in Sources */, CD9AD967228067F500EC174A /* MapInfo.swift in Sources */, 6741AA1D1BF340DE002C974C /* MWMDownloadTransitMapAlert.mm in Sources */, - 346B42AC1DD5E3D20094EBEE /* MWMLocationNotFoundAlert.mm in Sources */, 471A7BBE2481A3D000A0D4C1 /* EditBookmarkViewController.swift in Sources */, 993DF0C923F6BD0600AC231A /* ElevationDetailsBuilder.swift in Sources */, 674A7E301C0DB10B003D48E1 /* MWMMapWidgets.mm in Sources */,