Manos Chorianopoulos

MarketPassViewController changes

...@@ -96,7 +96,7 @@ import SwiftEventBus ...@@ -96,7 +96,7 @@ import SwiftEventBus
96 96
97 let barcodeString = "" 97 let barcodeString = ""
98 barcodeLabel.text = barcodeString 98 barcodeLabel.text = barcodeString
99 - barcodeLabel.font = UIFont(name: "PeridotPE-Regular", size: 19.0) 99 + barcodeLabel.font = UIFont(name: "PeridotPE-SBold", size: 19.0)
100 barcodeLabel.textColor = UIColor(rgb: 0x212121) 100 barcodeLabel.textColor = UIColor(rgb: 0x212121)
101 101
102 // if let barcodeUIImage = RSUnifiedCodeGenerator.shared.generateCode(barcodeString, machineReadableCodeObjectType: AVMetadataObject.ObjectType.ean13.rawValue, targetSize: CGSize(width: self.uiscreen.width * 0.8, height: self.uiscreen.height * 0.12)) { 102 // if let barcodeUIImage = RSUnifiedCodeGenerator.shared.generateCode(barcodeString, machineReadableCodeObjectType: AVMetadataObject.ObjectType.ean13.rawValue, targetSize: CGSize(width: self.uiscreen.width * 0.8, height: self.uiscreen.height * 0.12)) {
...@@ -110,18 +110,23 @@ import SwiftEventBus ...@@ -110,18 +110,23 @@ import SwiftEventBus
110 // barcodeImageHeight.constant = 0 110 // barcodeImageHeight.constant = 0
111 // } 111 // }
112 112
113 - let couponsValueString = "0.00" 113 +// let couponsValueString = "0.00"
114 - let attrRegular = [NSAttributedString.Key.font : UIFont(name: "PeridotPE-Regular", size: 17) ?? UIFont.systemFont(ofSize: 16), NSAttributedString.Key.foregroundColor: UIColor.white] 114 +// let attrRegular = [NSAttributedString.Key.font : UIFont(name: "PeridotPE-Regular", size: 17) ?? UIFont.systemFont(ofSize: 16), NSAttributedString.Key.foregroundColor: UIColor.white]
115 - let attrBold = [NSAttributedString.Key.font : UIFont(name: "PeridotPE-Bold", size: 17) ?? UIFont.boldSystemFont(ofSize: 16), NSAttributedString.Key.foregroundColor: UIColor.white] 115 +// let attrBold = [NSAttributedString.Key.font : UIFont(name: "PeridotPE-Bold", size: 17) ?? UIFont.boldSystemFont(ofSize: 16), NSAttributedString.Key.foregroundColor: UIColor.white]
116 - 116 +//
117 - let couponsValueNormalText1 = "Με τα διαθέσιμα κουπόνια μπορείς να εξοικονομήσεις έως και " 117 +// let couponsValueNormalText1 = "Με τα διαθέσιμα κουπόνια μπορείς να εξοικονομήσεις έως και "
118 - let couponsValueBoldText = couponsValueString + "€." 118 +// let couponsValueBoldText = couponsValueString + "€."
119 - 119 +//
120 - let couponsValueAttributedString = NSMutableAttributedString(string:couponsValueNormalText1, attributes:attrRegular) 120 +// let couponsValueAttributedString = NSMutableAttributedString(string:couponsValueNormalText1, attributes:attrRegular)
121 - let couponsValueBoldString = NSMutableAttributedString(string: couponsValueBoldText, attributes:attrBold) 121 +// let couponsValueBoldString = NSMutableAttributedString(string: couponsValueBoldText, attributes:attrBold)
122 +//
123 +// couponsValueAttributedString.append(couponsValueBoldString)
124 +// couponsValueLabel.attributedText = couponsValueAttributedString
122 125
123 - couponsValueAttributedString.append(couponsValueBoldString) 126 + couponsValueLabel.text = "Χρησιμοποίησε τη SUPERMARKET DEALS CARD σου για να κερδίσεις έκπτωση σε επιλεγμένα προϊόντα. Ανακάλυψε τα διαθέσιμα εκπτωτικά κουπόνια στο For You."
124 - couponsValueLabel.attributedText = couponsValueAttributedString 127 + couponsValueLabel.textAlignment = .left
128 + couponsValueLabel.font = UIFont(name: "PeridotPE-Regular", size: 13.0)
129 + couponsValueLabel.textColor = .white
125 130
126 mapButton.titleLabel?.font = UIFont(name: "PeridotPE-SBold", size: 16) 131 mapButton.titleLabel?.font = UIFont(name: "PeridotPE-SBold", size: 16)
127 mapButton.setTitle("Δες στο χάρτη", for: .normal) 132 mapButton.setTitle("Δες στο χάρτη", for: .normal)
...@@ -194,21 +199,25 @@ import SwiftEventBus ...@@ -194,21 +199,25 @@ import SwiftEventBus
194 barcodeImageHeight.constant = 0 199 barcodeImageHeight.constant = 0
195 } 200 }
196 201
197 - let couponsValueFloat = marketPassDetails?._total_available_discount ?? 0.0 202 +// let couponsValueFloat = marketPassDetails?._total_available_discount ?? 0.0
198 - let couponsValueString = String(format: "%.2f", couponsValueFloat) 203 +// let couponsValueString = String(format: "%.2f", couponsValueFloat)
199 - // let couponsValueString = String(marketPassDetails?._total_available_discount ?? 0.0) 204 +// // let couponsValueString = String(marketPassDetails?._total_available_discount ?? 0.0)
200 - let attrRegular = [NSAttributedString.Key.font : UIFont(name: "PeridotPE-Regular", size: 17) ?? UIFont.systemFont(ofSize: 16), NSAttributedString.Key.foregroundColor: UIColor.white] 205 +// let attrRegular = [NSAttributedString.Key.font : UIFont(name: "PeridotPE-Regular", size: 17) ?? UIFont.systemFont(ofSize: 16), NSAttributedString.Key.foregroundColor: UIColor.white]
201 - let attrBold = [NSAttributedString.Key.font : UIFont(name: "PeridotPE-Bold", size: 17) ?? UIFont.boldSystemFont(ofSize: 16), NSAttributedString.Key.foregroundColor: UIColor.white] 206 +// let attrBold = [NSAttributedString.Key.font : UIFont(name: "PeridotPE-Bold", size: 17) ?? UIFont.boldSystemFont(ofSize: 16), NSAttributedString.Key.foregroundColor: UIColor.white]
202 - 207 +//
203 - let couponsValueNormalText1 = "Με τα διαθέσιμα κουπόνια μπορείς να εξοικονομήσεις έως και " 208 +// let couponsValueNormalText1 = "Με τα διαθέσιμα κουπόνια μπορείς να εξοικονομήσεις έως και "
204 - let couponsValueBoldText = couponsValueString + "€." 209 +// let couponsValueBoldText = couponsValueString + "€."
205 - 210 +//
206 - let couponsValueAttributedString = NSMutableAttributedString(string:couponsValueNormalText1, attributes:attrRegular) 211 +// let couponsValueAttributedString = NSMutableAttributedString(string:couponsValueNormalText1, attributes:attrRegular)
207 - let couponsValueBoldString = NSMutableAttributedString(string: couponsValueBoldText, attributes:attrBold) 212 +// let couponsValueBoldString = NSMutableAttributedString(string: couponsValueBoldText, attributes:attrBold)
213 +//
214 +// couponsValueAttributedString.append(couponsValueBoldString)
215 +// couponsValueLabel.attributedText = couponsValueAttributedString
208 216
209 - couponsValueAttributedString.append(couponsValueBoldString) 217 + couponsValueLabel.text = "Χρησιμοποίησε τη SUPERMARKET DEALS CARD σου για να κερδίσεις έκπτωση σε επιλεγμένα προϊόντα. Ανακάλυψε τα διαθέσιμα εκπτωτικά κουπόνια στο For You."
210 - couponsValueLabel.attributedText = couponsValueAttributedString
211 couponsValueLabel.textAlignment = .left 218 couponsValueLabel.textAlignment = .left
219 + couponsValueLabel.font = UIFont(name: "PeridotPE-Regular", size: 13.0)
220 + couponsValueLabel.textColor = .white
212 221
213 let supermarkets: Array<swiftApi.SupermarketModel> = marketPassDetails?._supermarkets ?? [] 222 let supermarkets: Array<swiftApi.SupermarketModel> = marketPassDetails?._supermarkets ?? []
214 223
...@@ -348,6 +357,10 @@ import SwiftEventBus ...@@ -348,6 +357,10 @@ import SwiftEventBus
348 // } 357 // }
349 358
350 // MARK: - Actions 359 // MARK: - Actions
360 + @IBAction func supermakrtPassButtonAction(_ sender: Any) {
361 + swiftApi().openSupermarketPass(self)
362 + }
363 +
351 @IBAction func mapButtonAction(_ sender: Any) { 364 @IBAction func mapButtonAction(_ sender: Any) {
352 swiftApi().openSupermarketMap(self) 365 swiftApi().openSupermarketMap(self)
353 } 366 }
......
...@@ -9405,6 +9405,33 @@ public class swiftApi { ...@@ -9405,6 +9405,33 @@ public class swiftApi {
9405 } 9405 }
9406 } 9406 }
9407 9407
9408 + public func getMarketPassUrl() -> String {
9409 + let appUuid = swiftApi().getAppUuid()
9410 + if (appUuid == "f83dfde1145e4c2da69793abb2f579af") {
9411 + return "https://dev.supermarketdeals.eu"
9412 + } else {
9413 + return "https://supermarketdeals.eu"
9414 + }
9415 + }
9416 +
9417 + public func openSupermarketPass(_ controller: UIViewController) -> Void {
9418 + let status = swiftApi().getNetworkStatus()
9419 + if (status == -1 || status == 0) {
9420 + swiftApi().showDialog(controller, "Δεν υπάρχει σύνδεση","Αυτή τη στιγμή βρίσκεσαι εκτός σύνδεσης. Παρακαλούμε βεβαιώσου ότι είσαι συνδεδεμένος στο διαδίκτυο και προσπάθησε ξανά.")
9421 +
9422 + } else {
9423 + let tempCampaign = CampaignItemModel()
9424 + let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self))
9425 + let vc = storyboard.instantiateViewController(withIdentifier: "CampaignViewController") as! SwiftWarplyFramework.CampaignViewController
9426 + let url = swiftApi().getMarketPassUrl()
9427 + let params = swiftApi().constructCampaignParams(tempCampaign)
9428 + vc.campaignUrl = url
9429 + vc.params = params
9430 + vc.showHeader = false
9431 + controller.navigationController?.pushViewController(vc, animated: true)
9432 + }
9433 + }
9434 +
9408 9435
9409 /* 9436 /*
9410 { 9437 {
......