Skip to content

Commit

Permalink
IOS-4541 Ensure that ViewController only presented once
Browse files Browse the repository at this point in the history
  • Loading branch information
megakoko committed Sep 18, 2023
1 parent af1f997 commit 930443f
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions TangemSdk/TangemSdk/UI/BaseViewDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,11 @@ class BaseViewDelegate {
}

func presentScreenIfNeeded() {
if screen == nil {
screen = makeScreen()
guard self.screen == nil else {
return
}

guard !self.screen!.isBeingPresented, self.screen!.presentingViewController == nil,
let topmostViewController = UIApplication.shared.topMostViewController
else { return }
guard let topmostViewController = UIApplication.shared.topMostViewController else { return }

if let presentedController = topmostViewController.presentedViewController { //dismiss alert
presentedController.dismiss(animated: false) {
Expand All @@ -40,7 +38,10 @@ class BaseViewDelegate {
return
}

topmostViewController.present(self.screen!, animated: true, completion: nil)
let screen = makeScreen()
self.screen = screen

topmostViewController.present(screen, animated: true, completion: nil)
}


Expand Down

0 comments on commit 930443f

Please sign in to comment.