[IP-624] [Subscriptions UI] Loading indicator after clicking on subsc…
…ribe (#361)
* Fix a possible bug in BaseUpgradeViewController with telemetry
* Show loading indicator when tapping buy button
* Fix a nil issue in VPNEndPointManager
* Blur UpgradeViewController when loading
* Fix iffies, viewsies
Loading branch information
Daniel Jilg
committed
Jun 25, 2019
Verified
This commit was created on GitHub.com and signed with GitHub’s verified signature.
iflet data = UserDefaults.standard.value(forKey: SelectedCountryKey) as? Data, let country =try?PropertyListDecoder().decode(VPNCountry.self, from: data) {
iflet data = UserDefaults.standard.value(forKey: SelectedCountryKey) as? Data, let country =try?PropertyListDecoder().decode(VPNCountry.self, from: data) {
let errorDescirption =NSLocalizedString("We are sorry, but something went wrong. The payment was not successful, please try again.", tableName: "Lumen", comment: "Error message when there is failing payment transaction")
let errorDescirption =NSLocalizedString("We are sorry, but something went wrong. The payment was not successful, please try again.", tableName: "Lumen", comment: "Error message when there is failing payment transaction")
let alertController =UIAlertController(title: "", message: errorDescirption, preferredStyle: .alert)
let alertController =UIAlertController(title: "", message: errorDescirption, preferredStyle: .alert)
@@ -126,14 +141,37 @@ class BaseUpgradeViewController: UIViewController {
}
}
}
}
privatefuncstartLoadingAnimation() {
// MARK: - Loading
self.loadingView.startAnimating()
funcstartLoadingAnimation() {
loadingOverlay.alpha=0
view.addSubview(loadingOverlay)
loadingOverlay.snp.makeConstraints { (make) in
make.top.equalTo(view)
make.bottom.equalTo(view)
make.left.equalTo(view)
make.right.equalTo(view)
}
view.bringSubview(toFront: loadingView)
loadingView.startAnimating()
UIView.animate(withDuration: 0.5) {
self.loadingOverlay.alpha=0.8
}
}
}
privatefuncstopLoadingAnimation() {
funcstopLoadingAnimation() {
self.loadingView.stopAnimating()
self.loadingView.stopAnimating()
UIView.animate(withDuration: 0.25, animations: {
self.loadingOverlay.alpha=0
}) { finished in
self.loadingOverlay.removeFromSuperview()
}
}
}
// MARK: - Alerts
privatefuncshowProductsRetrievalFailedAlert() {
privatefuncshowProductsRetrievalFailedAlert() {
let errorDescirption =NSLocalizedString("Sorry, Lumen cannot connect to the Internet.", tableName: "Lumen", comment: "Error when can't get list of available subscriptions")
let errorDescirption =NSLocalizedString("Sorry, Lumen cannot connect to the Internet.", tableName: "Lumen", comment: "Error when can't get list of available subscriptions")
let alertController =UIAlertController(title: "", message: errorDescirption, preferredStyle: .alert)
let alertController =UIAlertController(title: "", message: errorDescirption, preferredStyle: .alert)