[ios] fix screen freezing when the PP relaods on viewWillAppear

Signed-off-by: Kiryl Kaveryn <kirylkaveryn@gmail.com>
This commit is contained in:
Kiryl Kaveryn 2024-06-09 13:50:04 +04:00 committed by Alexander Borsuk
parent 35be2a37d7
commit 97a0544a55
2 changed files with 10 additions and 0 deletions

View file

@ -114,7 +114,13 @@ class PlacePageInfoViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
delegate?.viewWillAppear()
}
// MARK: private
private func setupViews() {
if let openingHours = placePageInfoData.openingHours {
openingHoursView.openingHours = openingHours
addToStack(openingHoursView)

View file

@ -8,6 +8,7 @@ class PlacePageInteractor: NSObject {
weak var mapViewController: MapViewController?
private let bookmarksManager = BookmarksManager.shared()
private var placePageData: PlacePageData
private var viewWillAppearIsCalledForTheFirstTime = false
init(viewController: UIViewController, data: PlacePageData, mapViewController: MapViewController) {
self.placePageData = data
@ -50,6 +51,9 @@ extension PlacePageInteractor: PlacePageInteractorProtocol {
extension PlacePageInteractor: PlacePageInfoViewControllerDelegate {
func viewWillAppear() {
// Skip data reloading on the first appearance, to avoid unnecessary updates.
guard viewWillAppearIsCalledForTheFirstTime else { return }
viewWillAppearIsCalledForTheFirstTime = true
updateBookmarkIfNeeded()
}