Manos Chorianopoulos

nonTelco popup in couponVC

...@@ -22,6 +22,8 @@ import UIKit ...@@ -22,6 +22,8 @@ import UIKit
22 @IBOutlet weak var termsTextView: UITextView! 22 @IBOutlet weak var termsTextView: UITextView!
23 @IBOutlet weak var termsTextViewHeight: NSLayoutConstraint! 23 @IBOutlet weak var termsTextViewHeight: NSLayoutConstraint!
24 24
25 + public var profile:swiftApi.ProfileModel? = swiftApi().getConsumer()
26 +
25 let uiscreen: CGRect = UIScreen.main.bounds 27 let uiscreen: CGRect = UIScreen.main.bounds
26 28
27 var termsVisible: Bool = false; 29 var termsVisible: Bool = false;
...@@ -38,6 +40,10 @@ import UIKit ...@@ -38,6 +40,10 @@ import UIKit
38 setBackButton() 40 setBackButton()
39 setNavigationTitle("Εκπτωτικό κουπόνι") 41 setNavigationTitle("Εκπτωτικό κουπόνι")
40 42
43 + if ((profile != nil) && (profile?._nonTelco == true)) {
44 + nonTelcoDialog("", "Παρακαλούμε πολύ πρόσθεσε τις συνδέσεις σου στην COSMOTE για να έχεις πρόσβαση στα προνόμια του νέου Loyalty προγράμματος της COSMOTE!");
45 + }
46 +
41 backgroundImage.image = UIImage(named: "coupons_scrollview_white", in: Bundle(for: MyEmptyClass.self), compatibleWith: nil) 47 backgroundImage.image = UIImage(named: "coupons_scrollview_white", in: Bundle(for: MyEmptyClass.self), compatibleWith: nil)
42 48
43 scrollView.clipsToBounds = true 49 scrollView.clipsToBounds = true
...@@ -80,6 +86,26 @@ import UIKit ...@@ -80,6 +86,26 @@ import UIKit
80 } 86 }
81 87
82 // MARK: - Functions 88 // MARK: - Functions
89 + func nonTelcoDialog(_ alertTitle: String, _ alertSubTitle: String) -> Void {
90 +
91 + let alert = UIAlertController(title: alertTitle, message: alertSubTitle, preferredStyle: .alert)
92 + alert.addAction(UIAlertAction(title: "OK", style: .default, handler: { action in
93 + switch action.style{
94 + case .default:
95 + self.navigationController?.popViewController(animated: true)
96 + self.dismiss(animated: true, completion: {})
97 +
98 + case .cancel:
99 + print("cancel")
100 +
101 + case .destructive:
102 + print("destructive")
103 +
104 + }
105 + }))
106 + self.present(alert, animated: true, completion: nil)
107 + }
108 +
83 func toggleTerms() { 109 func toggleTerms() {
84 if (termsVisible) { 110 if (termsVisible) {
85 termsTextView.isHidden = false 111 termsTextView.isHidden = false
......