Manos Chorianopoulos

CouponsetViewController redesign part2

...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
8 import UIKit 8 import UIKit
9 9
10 extension UIViewController { 10 extension UIViewController {
11 - func addFloatingBackButton(icon: String = "ic_back_3") { 11 + func addFloatingBackButton(icon: String = "ic_back_4") {
12 let button = UIButton(type: .custom) 12 let button = UIButton(type: .custom)
13 button.translatesAutoresizingMaskIntoConstraints = false 13 button.translatesAutoresizingMaskIntoConstraints = false
14 button.backgroundColor = .white 14 button.backgroundColor = .white
...@@ -17,6 +17,9 @@ extension UIViewController { ...@@ -17,6 +17,9 @@ extension UIViewController {
17 button.layer.shadowOpacity = 0.1 17 button.layer.shadowOpacity = 0.1
18 button.layer.shadowOffset = CGSize(width: 0, height: 2) 18 button.layer.shadowOffset = CGSize(width: 0, height: 2)
19 button.layer.shadowRadius = 4 19 button.layer.shadowRadius = 4
20 + button.imageView?.contentMode = .scaleAspectFit
21 + button.contentEdgeInsets = UIEdgeInsets(top: 12, left: 12, bottom: 12, right: 12)
22 +
20 23
21 if let img = UIImage(named: icon, in: Bundle.frameworkResourceBundle, compatibleWith: nil) { 24 if let img = UIImage(named: icon, in: Bundle.frameworkResourceBundle, compatibleWith: nil) {
22 button.setImage(img, for: .normal) 25 button.setImage(img, for: .normal)
......
...@@ -34,6 +34,7 @@ import UIKit ...@@ -34,6 +34,7 @@ import UIKit
34 @IBOutlet weak var titleLabel: UILabel! 34 @IBOutlet weak var titleLabel: UILabel!
35 @IBOutlet weak var subtitleLabel: UILabel! 35 @IBOutlet weak var subtitleLabel: UILabel!
36 @IBOutlet weak var expirationView: UIView! 36 @IBOutlet weak var expirationView: UIView!
37 + @IBOutlet weak var expirationImage: UIImageView!
37 @IBOutlet weak var expirationLabel: UILabel! 38 @IBOutlet weak var expirationLabel: UILabel!
38 @IBOutlet weak var detailsLabel: UILabel! 39 @IBOutlet weak var detailsLabel: UILabel!
39 40
...@@ -99,6 +100,7 @@ import UIKit ...@@ -99,6 +100,7 @@ import UIKit
99 infoImage.image = UIImage(named: "info", in: Bundle.frameworkResourceBundle, compatibleWith: nil) 100 infoImage.image = UIImage(named: "info", in: Bundle.frameworkResourceBundle, compatibleWith: nil)
100 shareImage.image = UIImage(named: "share", in: Bundle.frameworkResourceBundle, compatibleWith: nil) 101 shareImage.image = UIImage(named: "share", in: Bundle.frameworkResourceBundle, compatibleWith: nil)
101 termsButtonArrowImage.image = UIImage(named: "arrow_down", in: Bundle.frameworkResourceBundle, compatibleWith: nil) 102 termsButtonArrowImage.image = UIImage(named: "arrow_down", in: Bundle.frameworkResourceBundle, compatibleWith: nil)
103 + expirationImage.image = UIImage(named: "clock", in: Bundle.frameworkResourceBundle, compatibleWith: nil)
102 104
103 infoLabel.font = UIFont(name: "PingLCG-Regular", size: 13) 105 infoLabel.font = UIFont(name: "PingLCG-Regular", size: 13)
104 infoLabel.textColor = UIColor(rgb: 0x020E1C) 106 infoLabel.textColor = UIColor(rgb: 0x020E1C)
...@@ -172,6 +174,23 @@ import UIKit ...@@ -172,6 +174,23 @@ import UIKit
172 if let response = response, 174 if let response = response,
173 let result = response["result"] as? [String: Any], 175 let result = response["result"] as? [String: Any],
174 let couponCode = result["coupon"] as? String { 176 let couponCode = result["coupon"] as? String {
177 +
178 + self.redeemButton.setTitle("Saved to My Coupons", for: .normal)
179 + self.redeemButton.setTitle("Saved to My Coupons", for: .disabled) // keeps title when disabled
180 + self.redeemButton.backgroundColor = UIColor(rgb: 0xDBF6E6)
181 + self.redeemButton.setTitleColor(UIColor(rgb: 0x0D9E5B), for: .normal)
182 + self.redeemButton.setTitleColor(UIColor(rgb: 0x0D9E5B), for: .disabled) // keeps color when disabled
183 +
184 + if let tickImage = UIImage(named: "tick", in: Bundle.frameworkResourceBundle, compatibleWith: nil) {
185 + let tintedImage = tickImage.withRenderingMode(.alwaysTemplate)
186 + self.redeemButton.setImage(tintedImage, for: .normal)
187 + self.redeemButton.setImage(tintedImage, for: .disabled)
188 + }
189 + self.redeemButton.tintColor = UIColor(rgb: 0x17B26A)
190 + self.redeemButton.imageEdgeInsets = UIEdgeInsets(top: 0, left: -13, bottom: 0, right: 0)
191 + // self.redeemButton.isEnabled = false
192 + self.redeemButton.removeTarget(self, action: #selector(redeemButtonTapped), for: .touchUpInside)
193 +
175 let expiration = result["expiration"] as? String ?? "" 194 let expiration = result["expiration"] as? String ?? ""
176 self.showSuccessAlert(couponCode: couponCode, expiration: expiration) 195 self.showSuccessAlert(couponCode: couponCode, expiration: expiration)
177 } else { 196 } else {
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
12 <connections> 12 <connections>
13 <outlet property="couponImage" destination="50f-Uw-WmD" id="yxn-pQ-nCT"/> 13 <outlet property="couponImage" destination="50f-Uw-WmD" id="yxn-pQ-nCT"/>
14 <outlet property="detailsLabel" destination="tOt-gP-Et5" id="H2V-Uq-Dsj"/> 14 <outlet property="detailsLabel" destination="tOt-gP-Et5" id="H2V-Uq-Dsj"/>
15 + <outlet property="expirationImage" destination="IO5-82-CjR" id="6OY-KM-0Kn"/>
15 <outlet property="expirationLabel" destination="PZ8-Go-A85" id="hXE-lo-i0w"/> 16 <outlet property="expirationLabel" destination="PZ8-Go-A85" id="hXE-lo-i0w"/>
16 <outlet property="expirationView" destination="Haz-Ae-VkM" id="OMt-Fr-BW4"/> 17 <outlet property="expirationView" destination="Haz-Ae-VkM" id="OMt-Fr-BW4"/>
17 <outlet property="favoriteImage" destination="kQb-LM-Zaa" id="75J-Ez-RZx"/> 18 <outlet property="favoriteImage" destination="kQb-LM-Zaa" id="75J-Ez-RZx"/>
...@@ -115,10 +116,18 @@ ...@@ -115,10 +116,18 @@
115 <nil key="highlightedColor"/> 116 <nil key="highlightedColor"/>
116 </label> 117 </label>
117 <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Haz-Ae-VkM" userLabel="Expiration View"> 118 <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Haz-Ae-VkM" userLabel="Expiration View">
118 - <rect key="frame" x="24.000000000000004" y="347" width="55.333333333333343" height="34.333333333333314"/> 119 + <rect key="frame" x="24" y="347" width="76.333333333333329" height="34.333333333333314"/>
119 <subviews> 120 <subviews>
121 + <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="IO5-82-CjR" userLabel="Expiration Image">
122 + <rect key="frame" x="10" y="10.333333333333314" width="14" height="14"/>
123 + <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
124 + <constraints>
125 + <constraint firstAttribute="height" constant="14" id="2Kv-8v-5Rd"/>
126 + <constraint firstAttribute="width" constant="14" id="kDx-vc-7Ie"/>
127 + </constraints>
128 + </imageView>
120 <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="PZ8-Go-A85" userLabel="Expiration Label"> 129 <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="PZ8-Go-A85" userLabel="Expiration Label">
121 - <rect key="frame" x="7" y="6.9999999999999982" width="41.333333333333336" height="20.333333333333329"/> 130 + <rect key="frame" x="28.000000000000004" y="6.9999999999999982" width="41.333333333333343" height="20.333333333333329"/>
122 <fontDescription key="fontDescription" type="system" pointSize="17"/> 131 <fontDescription key="fontDescription" type="system" pointSize="17"/>
123 <nil key="textColor"/> 132 <nil key="textColor"/>
124 <nil key="highlightedColor"/> 133 <nil key="highlightedColor"/>
...@@ -126,10 +135,12 @@ ...@@ -126,10 +135,12 @@
126 </subviews> 135 </subviews>
127 <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> 136 <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
128 <constraints> 137 <constraints>
129 - <constraint firstItem="PZ8-Go-A85" firstAttribute="leading" secondItem="Haz-Ae-VkM" secondAttribute="leading" constant="7" id="GHg-uf-y2A"/> 138 + <constraint firstItem="PZ8-Go-A85" firstAttribute="leading" secondItem="IO5-82-CjR" secondAttribute="trailing" constant="4" id="GHg-uf-y2A"/>
130 <constraint firstAttribute="bottom" secondItem="PZ8-Go-A85" secondAttribute="bottom" constant="7" id="lzh-zn-eSc"/> 139 <constraint firstAttribute="bottom" secondItem="PZ8-Go-A85" secondAttribute="bottom" constant="7" id="lzh-zn-eSc"/>
131 <constraint firstAttribute="trailing" secondItem="PZ8-Go-A85" secondAttribute="trailing" constant="7" id="mOL-XE-ayp"/> 140 <constraint firstAttribute="trailing" secondItem="PZ8-Go-A85" secondAttribute="trailing" constant="7" id="mOL-XE-ayp"/>
141 + <constraint firstItem="IO5-82-CjR" firstAttribute="leading" secondItem="Haz-Ae-VkM" secondAttribute="leading" constant="10" id="st4-Ng-17V"/>
132 <constraint firstItem="PZ8-Go-A85" firstAttribute="top" secondItem="Haz-Ae-VkM" secondAttribute="top" constant="7" id="u2c-QD-K7q"/> 142 <constraint firstItem="PZ8-Go-A85" firstAttribute="top" secondItem="Haz-Ae-VkM" secondAttribute="top" constant="7" id="u2c-QD-K7q"/>
143 + <constraint firstItem="IO5-82-CjR" firstAttribute="centerY" secondItem="Haz-Ae-VkM" secondAttribute="centerY" id="xvt-yn-tD3"/>
133 </constraints> 144 </constraints>
134 </view> 145 </view>
135 <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="tOt-gP-Et5" userLabel="Details Label"> 146 <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="tOt-gP-Et5" userLabel="Details Label">
......