summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAndrej Mihajlov <and@mullvad.net>2020-07-15 17:51:03 +0200
committerAndrej Mihajlov <and@mullvad.net>2020-07-15 17:52:37 +0200
commit75c3a9888fe985e5b6ee14c0be49df801790a21c (patch)
treea5ad523b7892bcf90ea97039878abf402ed4f8f9
parent1f4b0610a6049ae79d393ffc2b688ad1d7956f1f (diff)
downloadmullvadvpn-75c3a9888fe985e5b6ee14c0be49df801790a21c.tar.xz
mullvadvpn-75c3a9888fe985e5b6ee14c0be49df801790a21c.zip
Change the UserInterfaceInteractionRestrictionProtocol interface
-rw-r--r--ios/MullvadVPN/AccountViewController.swift14
-rw-r--r--ios/MullvadVPN/UserInterfaceInteractionRestriction.swift20
2 files changed, 17 insertions, 17 deletions
diff --git a/ios/MullvadVPN/AccountViewController.swift b/ios/MullvadVPN/AccountViewController.swift
index e4507d569c..6d3bf1dbcf 100644
--- a/ios/MullvadVPN/AccountViewController.swift
+++ b/ios/MullvadVPN/AccountViewController.swift
@@ -95,7 +95,7 @@ class AccountViewController: UIViewController, AppStorePaymentObserver {
purchaseButton.setTitle(inAppPurchase.localizedTitle, for: .normal)
purchaseButton.isLoading = true
- purchaseButtonInteractionRestriction.raise(animated: true)
+ purchaseButtonInteractionRestriction.increase(animated: true)
AppStorePaymentManager.shared.requestProducts(with: [inAppPurchase]) { [weak self] (result) in
DispatchQueue.main.async {
@@ -112,7 +112,7 @@ class AccountViewController: UIViewController, AppStorePaymentObserver {
}
self.purchaseButton.isLoading = false
- self.purchaseButtonInteractionRestriction.lift(animated: true)
+ self.purchaseButtonInteractionRestriction.decrease(animated: true)
}
}
}
@@ -273,7 +273,7 @@ class AccountViewController: UIViewController, AppStorePaymentObserver {
self.alertPresenter.enqueue(alertController, presentingController: self)
if transaction.payment == self.pendingPayment {
- self.compoundInteractionRestriction.lift(animated: true)
+ self.compoundInteractionRestriction.decrease(animated: true)
}
}
}
@@ -283,7 +283,7 @@ class AccountViewController: UIViewController, AppStorePaymentObserver {
self.showTimeAddedConfirmationAlert(with: response, context: .purchase)
if transaction.payment == self.pendingPayment {
- self.compoundInteractionRestriction.lift(animated: true)
+ self.compoundInteractionRestriction.decrease(animated: true)
}
}
}
@@ -322,7 +322,7 @@ class AccountViewController: UIViewController, AppStorePaymentObserver {
let payment = SKPayment(product: product)
self.pendingPayment = payment
- compoundInteractionRestriction.raise(animated: true)
+ compoundInteractionRestriction.increase(animated: true)
AppStorePaymentManager.shared.addPayment(payment, for: accountToken)
}
@@ -330,7 +330,7 @@ class AccountViewController: UIViewController, AppStorePaymentObserver {
@IBAction func restorePurchases() {
guard let accountToken = Account.shared.token else { return }
- compoundInteractionRestriction.raise(animated: true)
+ compoundInteractionRestriction.increase(animated: true)
AppStorePaymentManager.shared.restorePurchases(for: accountToken) { (result) in
DispatchQueue.main.async {
@@ -350,7 +350,7 @@ class AccountViewController: UIViewController, AppStorePaymentObserver {
self.alertPresenter.enqueue(alertController, presentingController: self)
}
- self.compoundInteractionRestriction.lift(animated: true)
+ self.compoundInteractionRestriction.decrease(animated: true)
}
}
}
diff --git a/ios/MullvadVPN/UserInterfaceInteractionRestriction.swift b/ios/MullvadVPN/UserInterfaceInteractionRestriction.swift
index 34c3606b3f..865dc29366 100644
--- a/ios/MullvadVPN/UserInterfaceInteractionRestriction.swift
+++ b/ios/MullvadVPN/UserInterfaceInteractionRestriction.swift
@@ -10,11 +10,11 @@ import Foundation
/// A protocol describing a common interface for the implementations of user interaction restriction
protocol UserInterfaceInteractionRestrictionProtocol {
- /// Lift the user interface interaction restrictions
- func lift(animated: Bool)
+ /// Increase the user interface interaction restrictions
+ func increase(animated: Bool)
- /// Raise the user interface interaction restrictions
- func raise(animated: Bool)
+ /// Decrease the user interface interaction restrictions
+ func decrease(animated: Bool)
}
/// A counter based user interface interaction restriction implementation
@@ -29,7 +29,7 @@ class UserInterfaceInteractionRestriction: UserInterfaceInteractionRestrictionPr
self.action = action
}
- func raise(animated: Bool) {
+ func increase(animated: Bool) {
DispatchQueue.main.async {
if self.counter == 0 {
self.action(false, animated)
@@ -38,7 +38,7 @@ class UserInterfaceInteractionRestriction: UserInterfaceInteractionRestrictionPr
}
}
- func lift(animated: Bool) {
+ func decrease(animated: Bool) {
DispatchQueue.main.async {
guard self.counter > 0 else { return }
@@ -60,11 +60,11 @@ class CompoundUserInterfaceInteractionRestriction: UserInterfaceInteractionRestr
self.restrictions = restrictions
}
- func lift(animated: Bool) {
- restrictions.forEach { $0.lift(animated: animated) }
+ func decrease(animated: Bool) {
+ restrictions.forEach { $0.decrease(animated: animated) }
}
- func raise(animated: Bool) {
- restrictions.forEach { $0.raise(animated: animated) }
+ func increase(animated: Bool) {
+ restrictions.forEach { $0.increase(animated: animated) }
}
}