[ios] split logic for the closing the PP and show/hide side buttons

Signed-off-by: Kiryl Kaveryn <kirylkaveryn@gmail.com>
This commit is contained in:
Kiryl Kaveryn 2024-06-11 16:04:15 +04:00 committed by Alexander Borsuk
parent 553d936a13
commit 6d4e5eb7d6
7 changed files with 18 additions and 22 deletions

View file

@ -24,7 +24,7 @@ NS_SWIFT_NAME(FrameworkHelper)
+ (void)zoomMap:(MWMZoomMode)mode;
+ (void)moveMap:(UIOffset)offset;
+ (void)scrollMap:(double)distanceX :(double) distanceY;
+ (void)deactivateMapSelection:(BOOL)notifyUI NS_SWIFT_NAME(deactivateMapSelection(notifyUI:));
+ (void)deactivateMapSelection;
+ (void)switchMyPositionMode;
+ (void)stopLocationFollow;
+ (NSArray<NSString *> *)obtainLastSearchQueries;

View file

@ -116,8 +116,8 @@
GetFramework().Scroll(distanceX, distanceY);
}
+ (void)deactivateMapSelection:(BOOL)notifyUI {
GetFramework().DeactivateMapSelection(notifyUI);
+ (void)deactivateMapSelection {
GetFramework().DeactivateMapSelection();
}
+ (void)switchMyPositionMode {

View file

@ -68,7 +68,7 @@ import UIKit
animations: {
navigationController.setViewControllers(controllers, animated: false)
}, completion: nil)
FrameworkHelper.deactivateMapSelection(notifyUI: true)
FrameworkHelper.deactivateMapSelection()
self.bookmarksControllers = nil
case .closed:
navigationController.popToRootViewController(animated: true)

View file

@ -136,7 +136,7 @@ NSString *const kPP2BookmarkEditingSegue = @"PP2BookmarkEditing";
}
- (void)dismissPlacePage {
GetFramework().DeactivateMapSelection(true);
GetFramework().DeactivateMapSelection();
}
- (void)hideRegularPlacePage {
@ -155,7 +155,7 @@ NSString *const kPP2BookmarkEditingSegue = @"PP2BookmarkEditing";
self.controlsManager.trafficButtonHidden = NO;
}
- (void)onMapObjectDeselected:(bool)switchFullScreenMode {
- (void)onMapObjectDeselected {
[self hidePlacePage];
MWMSearchManager * searchManager = MWMSearchManager.manager;
@ -168,16 +168,11 @@ NSString *const kPP2BookmarkEditingSegue = @"PP2BookmarkEditing";
searchManager.state = MWMSearchManagerStateHidden;
}
}
}
if (!switchFullScreenMode)
return;
// TODO(AB): Switch to full screen mode directly from the tap, in one place, instead of
// every call to onMapObjectDeselected.
if (DeepLinkHandler.shared.isLaunchedByDeeplink)
return;
BOOL const isSearchHidden = searchManager.state == MWMSearchManagerStateHidden;
- (void)onSwitchFullScreen {
BOOL const isNavigationDashboardHidden = [MWMNavigationDashboardManager sharedManager].state == MWMNavigationDashboardStateHidden;
BOOL const isSearchHidden = MWMSearchManager.manager.state == MWMSearchManagerStateHidden;
if (isSearchHidden && isNavigationDashboardHidden) {
self.controlsManager.hidden = !self.controlsManager.hidden;
}
@ -448,8 +443,9 @@ NSString *const kPP2BookmarkEditingSegue = @"PP2BookmarkEditing";
Framework &f = GetFramework();
// TODO: Review and improve this code.
f.SetPlacePageListeners([self]() { [self onMapObjectSelected]; },
[self](bool switchFullScreen) { [self onMapObjectDeselected:switchFullScreen]; },
[self]() { [self onMapObjectUpdated]; });
[self]() { [self onMapObjectDeselected]; },
[self]() { [self onMapObjectUpdated]; },
[self]() { [self onSwitchFullScreen]; });
// TODO: Review and improve this code.
f.SetMyPositionModeListener([self](location::EMyPositionMode mode, bool routingActive) {
// TODO: Two global listeners are subscribed to the same event from the core.

View file

@ -433,7 +433,7 @@ char const *kRenderAltitudeImagesQueueLabel = "mapsme.mwmrouter.renderAltitudeIm
- (void)onRouteReady:(BOOL)hasWarnings {
self.routingOptions = [MWMRoutingOptions new];
GetFramework().DeactivateMapSelection(true);
GetFramework().DeactivateMapSelection();
auto startPoint = [MWMRouter startPoint];
if (!startPoint || !startPoint.isMyPosition) {

View file

@ -30,7 +30,7 @@ using namespace storage;
return GetFramework().HasPlacePageInfo();
}
- (void)closePlacePage { GetFramework().DeactivateMapSelection(true); }
- (void)closePlacePage { GetFramework().DeactivateMapSelection(); }
- (void)routeFrom:(PlacePageData *)data {
MWMRoutePoint *point = [self routePoint:data withType:MWMRoutePointTypeStart intermediateIndex:0];

View file

@ -216,7 +216,7 @@ const CGFloat kWidthForiPad = 320;
[self.navigationController popToRootViewControllerAnimated:NO];
self.searchBarView.state = SearchBarStateReady;
GetFramework().DeactivateMapSelection(true);
GetFramework().DeactivateMapSelection();
[self animateConstraints:^{
self.contentViewTopHidden.priority = UILayoutPriorityDefaultLow;
self.contentViewBottomHidden.priority = UILayoutPriorityDefaultLow;
@ -237,7 +237,7 @@ const CGFloat kWidthForiPad = 320;
[self.navigationController popToRootViewControllerAnimated:NO];
self.searchBarView.state = SearchBarStateReady;
GetFramework().DeactivateMapSelection(true);
GetFramework().DeactivateMapSelection();
[self updateTableSearchActionBar];
auto const navigationManagerState = [MWMNavigationDashboardManager sharedManager].state;
if (navigationManagerState == MWMNavigationDashboardStateHidden) {
@ -265,7 +265,7 @@ const CGFloat kWidthForiPad = 320;
auto const navigationManagerState = [MWMNavigationDashboardManager sharedManager].state;
[self viewHidden:navigationManagerState != MWMNavigationDashboardStateHidden];
self.controlsManager.menuState = MWMBottomMenuStateHidden;
GetFramework().DeactivateMapSelection(true);
GetFramework().DeactivateMapSelection();
[MWMSearch setSearchOnMap:YES];
[self.tableViewController reloadData];