Skip to content

Commit

Permalink
Merge branch 'prevent-user-from-navigating-away-from-views-when-waiti…
Browse files Browse the repository at this point in the history
…ng-on-ios-312'
  • Loading branch information
buggmagnet committed Oct 20, 2023
2 parents 61bc7d4 + 669f1f3 commit 8fc622a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,11 @@ class RootContainerViewController: UIViewController {
}
}

func enableHeaderBarButtons(_ enabled: Bool) {
headerBarView.accountButton.isEnabled = enabled
headerBarView.settingsButton.isEnabled = enabled
}

// MARK: - Accessibility

override func accessibilityPerformMagicTap() -> Bool {
Expand Down
6 changes: 5 additions & 1 deletion ios/MullvadVPN/Coordinators/WelcomeCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ extension WelcomeCoordinator: WelcomeViewControllerDelegate {
}

func didRequestToPurchaseCredit(controller: WelcomeViewController, accountNumber: String, product: SKProduct) {
navigationController.enableHeaderBarButtons(false)

let coordinator = InAppPurchaseCoordinator(
navigationController: navigationController,
interactor: inAppPurchaseInteractor
Expand All @@ -131,11 +133,13 @@ extension WelcomeCoordinator: WelcomeViewControllerDelegate {

coordinator.didFinish = { [weak self] coordinator in
guard let self else { return }
navigationController.enableHeaderBarButtons(true)
coordinator.removeFromParent()
didFinish?()
}

coordinator.didCancel = { coordinator in
coordinator.didCancel = { [weak self] coordinator in
self?.navigationController.enableHeaderBarButtons(true)
coordinator.removeFromParent()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ final class WelcomeContentView: UIView {
didSet {
let alpha = isPurchasing ? 0.7 : 1.0
purchaseButton.isLoading = isPurchasing
purchaseButton.isEnabled = !isPurchasing
purchaseButton.alpha = alpha
redeemVoucherButton.isEnabled = !isPurchasing
redeemVoucherButton.alpha = alpha
Expand Down

0 comments on commit 8fc622a

Please sign in to comment.