Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

[IP-578] Subscription screen updating with promo results

  • Loading branch information
Pavel authored and pavel-cliqz committed May 28, 2019
1 parent 8c69f4f commit 17396d48039efd1ec8e458b66a4f13987e6c7846
@@ -302,7 +302,7 @@ extension SubscriptionController: SubscriptionDataSourceDelegate {
completion(self.standardSubscriptionProducts) completion(self.standardSubscriptionProducts)
} else { } else {
self.requestProducts { (standart, promo) in self.requestProducts { (standart, promo) in
completion(promo) completion(standart)
} }
} }
} }
@@ -98,14 +98,20 @@ class PromoUpgradeViewController: UIViewController {
self.startLoadingAnimation() self.startLoadingAnimation()
self.dataSource.fetchProducts { (success) in self.dataSource.fetchProducts { (success) in
if success { if success {
self.subscriptionsTableView.reloadData() self.reloadData()
} else { } else {
self.showProductsRetrievalFailedAlert() self.showProductsRetrievalFailedAlert()
} }
self.stopLoadingAnimation() self.stopLoadingAnimation()
} }
} }


private func reloadData() {
self.subscriptionsTableView.reloadData()
self.conditionsLabel.text = self.dataSource.getConditionText()
self.promoCodeLabel.text = self.dataSource.promoText()
}

private func showProductsRetrievalFailedAlert() { private func showProductsRetrievalFailedAlert() {
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)
@@ -142,7 +148,7 @@ class PromoUpgradeViewController: UIViewController {
self.view.addSubview(subscriptionsTableView) self.view.addSubview(subscriptionsTableView)


conditionsLabel.numberOfLines = 0 conditionsLabel.numberOfLines = 0
conditionsLabel.text = self.dataSource.getConditionText() //NSLocalizedString("", tableName: "Lumen", comment: "[Upgrade Flow] Conditions text") conditionsLabel.text = self.dataSource.getConditionText()
conditionsLabel.textColor = UIColor(colorString: "BDC0CE") conditionsLabel.textColor = UIColor(colorString: "BDC0CE")


conditionsLabel.textAlignment = .center conditionsLabel.textAlignment = .center

0 comments on commit 17396d4

Please sign in to comment.