From f707186dead7cefbb6e4383a334c9dc03adf6bfe Mon Sep 17 00:00:00 2001 From: Andrea Busi Date: Sun, 29 Nov 2020 12:57:07 +0100 Subject: [PATCH] refactor: Show restored product in alert --- .../Controllers/InApp/SubscriptionsViewController.swift | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Sources/Earthquake Network/Controllers/InApp/SubscriptionsViewController.swift b/Sources/Earthquake Network/Controllers/InApp/SubscriptionsViewController.swift index def933f..d7662c2 100644 --- a/Sources/Earthquake Network/Controllers/InApp/SubscriptionsViewController.swift +++ b/Sources/Earthquake Network/Controllers/InApp/SubscriptionsViewController.swift @@ -177,8 +177,14 @@ class SubscriptionsViewController: UITableViewController { if isRestorePurchase { isRestorePurchase = false + var product: String = "unknown" + if let productIdentifier = notification.object as? String, let productName = resourceNameForProductIdentifier(productIdentifier) { + product = productName + } + + let message = "\(NSLocalizedString("purchase_pro_restore_alert_message", comment: ""))\n\n(\(product))" let alert = UIAlertController(title: NSLocalizedString("purchase_pro_restore_alert_title", comment: ""), - message: NSLocalizedString("purchase_pro_restore_alert_message", comment: ""), preferredStyle: .alert) + message: message, preferredStyle: .alert) alert.addAction(UIAlertAction(title: "OK", style: .default, handler: nil)) present(alert, animated: true, completion: nil) }