Manos Chorianopoulos

Add open_my_rewards event and ui fixes at CouponViewController

...@@ -95,11 +95,11 @@ import SwiftEventBus ...@@ -95,11 +95,11 @@ import SwiftEventBus
95 let targetSize = CGSize(width: descriptionTextView.frame.width, height: CGFloat(MAXFLOAT)) 95 let targetSize = CGSize(width: descriptionTextView.frame.width, height: CGFloat(MAXFLOAT))
96 descriptionTextViewHeight.constant = descriptionTextView.sizeThatFits(targetSize).height 96 descriptionTextViewHeight.constant = descriptionTextView.sizeThatFits(targetSize).height
97 97
98 - redeemButton.setTitle("Απόκτησέ το", for: .normal) 98 + redeemButton.setTitle("Απόκτησέ το δωρεάν", for: .normal)
99 redeemButton.setTitleColor(.white, for: .normal) 99 redeemButton.setTitleColor(.white, for: .normal)
100 redeemButton.backgroundColor = UIColor(red: 0.05, green: 0.65, blue: 0.00, alpha: 1.00) 100 redeemButton.backgroundColor = UIColor(red: 0.05, green: 0.65, blue: 0.00, alpha: 1.00)
101 redeemButton.layer.cornerRadius = 16.0 101 redeemButton.layer.cornerRadius = 16.0
102 - redeemButton.frame = CGRect(x: 0.0, y: 0.0, width: redeemButton.intrinsicContentSize.width, height: 50) 102 +// redeemButton.frame = CGRect(x: 0.0, y: 0.0, width: redeemButton.intrinsicContentSize.width, height: 50)
103 redeemButton.contentEdgeInsets = UIEdgeInsets(top: 0, left: 25, bottom: 0, right: 25) 103 redeemButton.contentEdgeInsets = UIEdgeInsets(top: 0, left: 25, bottom: 0, right: 25)
104 // Fix width for ipad 104 // Fix width for ipad
105 if UIDevice.current.userInterfaceIdiom == .pad { 105 if UIDevice.current.userInterfaceIdiom == .pad {
...@@ -261,7 +261,7 @@ import SwiftEventBus ...@@ -261,7 +261,7 @@ import SwiftEventBus
261 SwiftEventBus.post("ccms_enabled", sender: ccmsEnabled) 261 SwiftEventBus.post("ccms_enabled", sender: ccmsEnabled)
262 } 262 }
263 263
264 - self.showSuccessDialog("Επιτυχής ενεργοποίηση","Το κουπόνι σου έχει ενεργοποιηθεί στην ενότητα My Rewards.") 264 + self.showSuccessDialog("Επιτυχής ενεργοποίηση","Το κουπόνι σου έχει ενεργοποιηθεί και βρίσκεται στην ενότητα My Rewards.")
265 265
266 swiftApi().getCouponsAsync(getCouponsCallback, failureCallback: {errorCode in }) 266 swiftApi().getCouponsAsync(getCouponsCallback, failureCallback: {errorCode in })
267 swiftApi().getCampaignsAsyncNew(language: "en", filters: [String : Any](), getCampaignsCallback, failureCallback: {errorCode in }) 267 swiftApi().getCampaignsAsyncNew(language: "en", filters: [String : Any](), getCampaignsCallback, failureCallback: {errorCode in })
...@@ -341,10 +341,28 @@ import SwiftEventBus ...@@ -341,10 +341,28 @@ import SwiftEventBus
341 func showSuccessDialog(_ alertTitle: String, _ alertSubTitle: String) -> Void { 341 func showSuccessDialog(_ alertTitle: String, _ alertSubTitle: String) -> Void {
342 342
343 let alert = UIAlertController(title: alertTitle, message: alertSubTitle, preferredStyle: .alert) 343 let alert = UIAlertController(title: alertTitle, message: alertSubTitle, preferredStyle: .alert)
344 - alert.addAction(UIAlertAction(title: "OK", style: .default, handler: { action in 344 +
345 + let cancelButton = UIAlertAction(title: "Ακύρωση", style: .default, handler: { action in
346 + switch action.style{
347 + case .default:
348 + self.navigationController?.popViewController(animated: true)
349 +
350 + case .cancel:
351 + print("cancel")
352 +
353 + case .destructive:
354 + print("destructive")
355 +
356 + }
357 + })
358 + // cancelButton.setValue(UIColor(rgb: 0xFC5757), forKey: "titleTextColor")
359 + alert.addAction(cancelButton)
360 +
361 + alert.addAction(UIAlertAction(title: "Δες το κουπόνι", style: .default, handler: { action in
345 switch action.style{ 362 switch action.style{
346 case .default: 363 case .default:
347 self.navigationController?.popViewController(animated: true) 364 self.navigationController?.popViewController(animated: true)
365 + SwiftEventBus.post("open_my_rewards")
348 366
349 case .cancel: 367 case .cancel:
350 print("cancel") 368 print("cancel")
......
...@@ -5710,7 +5710,7 @@ ...@@ -5710,7 +5710,7 @@
5710 <textInputTraits key="textInputTraits" autocapitalizationType="sentences"/> 5710 <textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
5711 </textView> 5711 </textView>
5712 <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="FCd-hv-dHg"> 5712 <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="FCd-hv-dHg">
5713 - <rect key="frame" x="158" y="384.5" width="98" height="50"/> 5713 + <rect key="frame" x="20" y="384.5" width="374" height="50"/>
5714 <constraints> 5714 <constraints>
5715 <constraint firstAttribute="height" constant="50" id="n2w-Tx-hhO"/> 5715 <constraint firstAttribute="height" constant="50" id="n2w-Tx-hhO"/>
5716 </constraints> 5716 </constraints>
...@@ -5758,6 +5758,7 @@ ...@@ -5758,6 +5758,7 @@
5758 <constraint firstAttribute="trailing" secondItem="isU-Qv-94G" secondAttribute="trailing" constant="20" id="7cL-ob-hXY"/> 5758 <constraint firstAttribute="trailing" secondItem="isU-Qv-94G" secondAttribute="trailing" constant="20" id="7cL-ob-hXY"/>
5759 <constraint firstAttribute="trailing" secondItem="siA-c8-Ub8" secondAttribute="trailing" constant="20" id="C8g-1f-Ef3"/> 5759 <constraint firstAttribute="trailing" secondItem="siA-c8-Ub8" secondAttribute="trailing" constant="20" id="C8g-1f-Ef3"/>
5760 <constraint firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="siA-c8-Ub8" secondAttribute="bottom" constant="30" id="FOo-d7-zvC"/> 5760 <constraint firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="siA-c8-Ub8" secondAttribute="bottom" constant="30" id="FOo-d7-zvC"/>
5761 + <constraint firstAttribute="trailing" secondItem="FCd-hv-dHg" secondAttribute="trailing" constant="20" id="LEE-CW-2J5"/>
5761 <constraint firstItem="siA-c8-Ub8" firstAttribute="top" secondItem="KvN-fk-rlm" secondAttribute="bottom" id="MHv-4j-YYr"/> 5762 <constraint firstItem="siA-c8-Ub8" firstAttribute="top" secondItem="KvN-fk-rlm" secondAttribute="bottom" id="MHv-4j-YYr"/>
5762 <constraint firstItem="FCd-hv-dHg" firstAttribute="centerX" secondItem="uTN-Qr-wBi" secondAttribute="centerX" id="OFE-Xc-Ui3"/> 5763 <constraint firstItem="FCd-hv-dHg" firstAttribute="centerX" secondItem="uTN-Qr-wBi" secondAttribute="centerX" id="OFE-Xc-Ui3"/>
5763 <constraint firstItem="isU-Qv-94G" firstAttribute="leading" secondItem="uTN-Qr-wBi" secondAttribute="leading" constant="20" id="PR6-tJ-tw0"/> 5764 <constraint firstItem="isU-Qv-94G" firstAttribute="leading" secondItem="uTN-Qr-wBi" secondAttribute="leading" constant="20" id="PR6-tJ-tw0"/>
...@@ -5770,6 +5771,7 @@ ...@@ -5770,6 +5771,7 @@
5770 <constraint firstItem="3SX-fR-ph2" firstAttribute="leading" secondItem="uTN-Qr-wBi" secondAttribute="leading" id="nBV-nm-wOq"/> 5771 <constraint firstItem="3SX-fR-ph2" firstAttribute="leading" secondItem="uTN-Qr-wBi" secondAttribute="leading" id="nBV-nm-wOq"/>
5771 <constraint firstItem="3SX-fR-ph2" firstAttribute="top" secondItem="uTN-Qr-wBi" secondAttribute="top" id="oaX-KH-TEh"/> 5772 <constraint firstItem="3SX-fR-ph2" firstAttribute="top" secondItem="uTN-Qr-wBi" secondAttribute="top" id="oaX-KH-TEh"/>
5772 <constraint firstItem="isU-Qv-94G" firstAttribute="top" secondItem="3SX-fR-ph2" secondAttribute="bottom" constant="30" id="vQf-lC-GgG"/> 5773 <constraint firstItem="isU-Qv-94G" firstAttribute="top" secondItem="3SX-fR-ph2" secondAttribute="bottom" constant="30" id="vQf-lC-GgG"/>
5774 + <constraint firstItem="FCd-hv-dHg" firstAttribute="leading" secondItem="uTN-Qr-wBi" secondAttribute="leading" constant="20" id="xB0-5K-hPZ"/>
5773 </constraints> 5775 </constraints>
5774 </view> 5776 </view>
5775 </subviews> 5777 </subviews>
......