[ios] fix route planning reloading ui bug

The bottom route status view sometimes jumps from the top to the bottom during the 1st rendering. It happens because the view's frame is not calculated on the isVisible because the view is not init/deinit multiple times during the route building state changing. The bottom view now only changes its visibility and constraints, not the init/deinit on every update.

Signed-off-by: Kiryl Kaveryn <kirylkaveryn@gmail.com>
This commit is contained in:
Kiryl Kaveryn 2025-02-13 17:18:18 +04:00 committed by Roman Tsisyk
parent db4371e2c3
commit 1cbe25e5bc
2 changed files with 6 additions and 11 deletions

View file

@ -134,8 +134,7 @@ NSString *const kNavigationControlViewXibName = @"NavigationControlView";
self.navigationInfoView = nil;
_navigationControlView.isVisible = NO;
_navigationControlView = nil;
[_baseRoutePreviewStatus hide];
_baseRoutePreviewStatus = nil;
[self.baseRoutePreviewStatus hide];
[_transportRoutePreviewStatus hide];
_transportRoutePreviewStatus = nil;
}
@ -147,7 +146,7 @@ NSString *const kNavigationControlViewXibName = @"NavigationControlView";
[routePreview statePrepare];
[routePreview selectRouter:[MWMRouter type]];
[self updateGoButtonTitle];
[_baseRoutePreviewStatus hide];
[self.baseRoutePreviewStatus hide];
[_transportRoutePreviewStatus hide];
for (MWMRouteStartButton *button in self.goButtons)
[button statePrepare];
@ -204,8 +203,7 @@ NSString *const kNavigationControlViewXibName = @"NavigationControlView";
self.routePreview = nil;
self.navigationInfoView.state = MWMNavigationInfoViewStateNavigation;
self.navigationControlView.isVisible = YES;
[_baseRoutePreviewStatus hide];
_baseRoutePreviewStatus = nil;
[self.baseRoutePreviewStatus hide];
[_transportRoutePreviewStatus hide];
_transportRoutePreviewStatus = nil;
[self onNavigationInfoUpdated];

View file

@ -51,12 +51,8 @@ final class BaseRoutePreviewStatus: SolidTouchView {
private var isVisible = false {
didSet {
guard isVisible != oldValue else { return }
if isVisible {
addView()
} else {
self.removeFromSuperview()
}
addView()
isHidden = !isVisible
}
}
@ -68,6 +64,7 @@ final class BaseRoutePreviewStatus: SolidTouchView {
leadingAnchor.constraint(equalTo: lg.leadingAnchor).isActive = true
trailingAnchor.constraint(equalTo: lg.trailingAnchor).isActive = true
bottomAnchor.constraint(equalTo: lg.bottomAnchor).isActive = true
ownerView.layoutIfNeeded()
}
private func updateHeight() {