fix: General improvements on purchase restore
This commit is contained in:
@@ -40,6 +40,8 @@ class SubscriptionsViewController: UITableViewController {
|
||||
private var availability: EQNPurchaseAvailability?
|
||||
/// Tells if products are loading
|
||||
private var isLoading = false
|
||||
/// Tells if a restore is in progress
|
||||
private var isRestorePurchase = false
|
||||
|
||||
// MARK: - View Lifecycle
|
||||
|
||||
@@ -155,7 +157,8 @@ class SubscriptionsViewController: UITableViewController {
|
||||
// MARK: - Actions
|
||||
|
||||
@objc func restoreTapped(_ sender: AnyObject) {
|
||||
VersioneProProducts.store.restorePurchases()
|
||||
isRestorePurchase = true
|
||||
VersioneProProducts.store.restorePurchases()
|
||||
}
|
||||
|
||||
// MARK: - Notifications
|
||||
@@ -165,6 +168,15 @@ class SubscriptionsViewController: UITableViewController {
|
||||
}
|
||||
|
||||
@objc func handlePurchaseNotification(_ notification: Notification) {
|
||||
if isRestorePurchase {
|
||||
isRestorePurchase = false
|
||||
|
||||
let alert = UIAlertController(title: NSLocalizedString("purchase_pro_restore_alert_title", comment: ""),
|
||||
message: NSLocalizedString("purchase_pro_restore_alert_message", comment: ""), preferredStyle: .alert)
|
||||
alert.addAction(UIAlertAction(title: "OK", style: .default, handler: nil))
|
||||
present(alert, animated: true, completion: nil)
|
||||
}
|
||||
|
||||
VersioneProProducts.store.loadPurchase()
|
||||
loadData()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user