Manos Chorianopoulos

redesign CouponViewController

Showing 20 changed files with 229 additions and 59 deletions
1 +<?xml version="1.0" encoding="UTF-8"?>
2 +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3 +<plist version="1.0">
4 +<dict>
5 + <key>SchemeUserState</key>
6 + <dict>
7 + <key>Pods-SwiftWarplyFramework.xcscheme_^#shared#^_</key>
8 + <dict>
9 + <key>orderHint</key>
10 + <integer>0</integer>
11 + </dict>
12 + </dict>
13 +</dict>
14 +</plist>
1 +<?xml version="1.0" encoding="UTF-8"?>
2 +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3 +<plist version="1.0">
4 +<dict>
5 + <key>SchemeUserState</key>
6 + <dict>
7 + <key>SwiftWarplyFramework.xcscheme_^#shared#^_</key>
8 + <dict>
9 + <key>orderHint</key>
10 + <integer>1</integer>
11 + </dict>
12 + </dict>
13 +</dict>
14 +</plist>
...@@ -9,12 +9,17 @@ import UIKit ...@@ -9,12 +9,17 @@ import UIKit
9 9
10 class CouponViewController: UIViewController { 10 class CouponViewController: UIViewController {
11 @IBOutlet weak var mainView: UIView! 11 @IBOutlet weak var mainView: UIView!
12 + @IBOutlet weak var scrollView: UIScrollView!
12 @IBOutlet weak var scrollContentView: UIView! 13 @IBOutlet weak var scrollContentView: UIView!
13 @IBOutlet weak var couponImageHeight: NSLayoutConstraint! 14 @IBOutlet weak var couponImageHeight: NSLayoutConstraint!
14 @IBOutlet weak var redeemButton: UIButton! 15 @IBOutlet weak var redeemButton: UIButton!
15 - @IBOutlet weak var termsLabel: UILabel! 16 + @IBOutlet weak var termsButton: UIButton!
17 + @IBOutlet weak var termsTextView: UITextView!
18 + @IBOutlet weak var termsTextViewHeight: NSLayoutConstraint!
16 19
17 let uiscreen: CGRect = UIScreen.main.bounds 20 let uiscreen: CGRect = UIScreen.main.bounds
21 +
22 + var termsVisible: Bool = false;
18 23
19 override func viewDidLoad() { 24 override func viewDidLoad() {
20 super.viewDidLoad() 25 super.viewDidLoad()
...@@ -23,31 +28,55 @@ class CouponViewController: UIViewController { ...@@ -23,31 +28,55 @@ class CouponViewController: UIViewController {
23 setBackButton() 28 setBackButton()
24 setNavigationTitle("Εκπτωτικό κουπόνι") 29 setNavigationTitle("Εκπτωτικό κουπόνι")
25 30
26 - mainView.clipsToBounds = true 31 + scrollView.clipsToBounds = true
27 - mainView.layer.cornerRadius = 30 32 + scrollView.layer.cornerRadius = 30
28 - mainView.layer.maskedCorners = [ .layerMinXMinYCorner] // Top left corner radius 33 + scrollView.layer.maskedCorners = [ .layerMinXMinYCorner] // Top left corner radius
29 34
30 couponImageHeight.constant = self.uiscreen.height * 0.25 35 couponImageHeight.constant = self.uiscreen.height * 0.25
31 36
32 redeemButton.titleLabel?.font = UIFont.systemFont(ofSize: 15, weight: .medium) 37 redeemButton.titleLabel?.font = UIFont.systemFont(ofSize: 15, weight: .medium)
33 38
34 - termsLabel.font = UIFont.systemFont(ofSize: 14, weight: UIFont.Weight.medium) 39 + termsButton.titleLabel?.font = .systemFont(ofSize: 15.0, weight: .semibold)
35 - let tap = UITapGestureRecognizer(target: self, action: #selector(CouponViewController.termsTapFunction)) 40 +// termsButton.imageView?.layer.transform = CATransform3DMakeScale(1.5, 1.5, 1.5)
36 - termsLabel.isUserInteractionEnabled = true 41 +
37 - termsLabel.addGestureRecognizer(tap) 42 + let htmlText = "<p>Το κουπόνι ισχύει έως 05/12/2022</p>\n"
43 + termsTextView.attributedText = htmlText.htmlToAttributedString
44 + termsTextView.font = UIFont.systemFont(ofSize: 14, weight: UIFont.Weight.regular)
45 + termsTextView.textColor = UIColor(red: 0.25, green: 0.33, blue: 0.39, alpha: 1.00)
46 + termsTextView.textAlignment = .center
47 + termsTextView.isScrollEnabled = false
48 +
49 + toggleTerms()
50 +
38 } 51 }
39 52
53 + // MARK: - Functions
54 + func toggleTerms() {
55 + if (termsVisible) {
56 + termsTextView.isHidden = false
57 + let targetSize = CGSize(width: termsTextView.frame.width, height: CGFloat(MAXFLOAT))
58 + termsTextViewHeight.constant = termsTextView.sizeThatFits(targetSize).height
59 +
60 + termsButton.setImage(UIImage(named: "ic_up_dark.png"), for: .normal)
61 + } else {
62 + termsTextView.isHidden = true
63 + termsTextViewHeight.constant = CGFloat(0)
64 +
65 + termsButton.setImage(UIImage(named: "ic_down_dark.png"), for: .normal)
66 + }
67 + }
40 68
41 // MARK: - Actions 69 // MARK: - Actions
42 70
43 - @objc func termsTapFunction(sender:UITapGestureRecognizer) {
44 - print("Terms tapped!")
45 - }
46 -
47 @IBAction func redeemButtomAction(_ sender: Any) { 71 @IBAction func redeemButtomAction(_ sender: Any) {
48 let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self)) 72 let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self))
49 let vc = storyboard.instantiateViewController(withIdentifier: "MakeItAPresentViewController") as UIViewController 73 let vc = storyboard.instantiateViewController(withIdentifier: "MakeItAPresentViewController") as UIViewController
50 self.navigationController?.pushViewController(vc, animated: true) 74 self.navigationController?.pushViewController(vc, animated: true)
51 } 75 }
76 +
77 + @IBAction func termsButtonAction(_ sender: Any) {
78 + termsVisible = !termsVisible
79 + toggleTerms()
80 + }
52 } 81 }
53 82
......
1 <?xml version="1.0" encoding="UTF-8"?> 1 <?xml version="1.0" encoding="UTF-8"?>
2 -<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="20037" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> 2 +<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="19455" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
3 <device id="retina6_1" orientation="portrait" appearance="light"/> 3 <device id="retina6_1" orientation="portrait" appearance="light"/>
4 <dependencies> 4 <dependencies>
5 <deployment identifier="iOS"/> 5 <deployment identifier="iOS"/>
6 - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="20020"/> 6 + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="19454"/>
7 <capability name="Safe area layout guides" minToolsVersion="9.0"/> 7 <capability name="Safe area layout guides" minToolsVersion="9.0"/>
8 <capability name="System colors in document resources" minToolsVersion="11.0"/> 8 <capability name="System colors in document resources" minToolsVersion="11.0"/>
9 <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> 9 <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
...@@ -173,13 +173,16 @@ ...@@ -173,13 +173,16 @@
173 <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> 173 <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
174 <subviews> 174 <subviews>
175 <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Jqu-cp-CWU"> 175 <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Jqu-cp-CWU">
176 - <rect key="frame" x="0.0" y="54" width="414" height="842"/> 176 + <rect key="frame" x="0.0" y="44" width="414" height="852"/>
177 <subviews> 177 <subviews>
178 + <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="coupons_scrollview_white" translatesAutoresizingMaskIntoConstraints="NO" id="Oep-XD-blB">
179 + <rect key="frame" x="0.0" y="0.0" width="414" height="852"/>
180 + </imageView>
178 <scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" ambiguous="YES" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" translatesAutoresizingMaskIntoConstraints="NO" id="1N5-oA-ZTb"> 181 <scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" ambiguous="YES" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" translatesAutoresizingMaskIntoConstraints="NO" id="1N5-oA-ZTb">
179 - <rect key="frame" x="0.0" y="0.0" width="414" height="842"/> 182 + <rect key="frame" x="0.0" y="5" width="414" height="847"/>
180 <subviews> 183 <subviews>
181 <view contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="uTN-Qr-wBi"> 184 <view contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="uTN-Qr-wBi">
182 - <rect key="frame" x="0.0" y="0.0" width="414" height="842"/> 185 + <rect key="frame" x="0.0" y="0.0" width="414" height="852"/>
183 <subviews> 186 <subviews>
184 <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="3SX-fR-ph2"> 187 <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="3SX-fR-ph2">
185 <rect key="frame" x="0.0" y="0.0" width="414" height="200"/> 188 <rect key="frame" x="0.0" y="0.0" width="414" height="200"/>
...@@ -187,68 +190,84 @@ ...@@ -187,68 +190,84 @@
187 <constraint firstAttribute="height" constant="200" id="zUx-Yd-in7"/> 190 <constraint firstAttribute="height" constant="200" id="zUx-Yd-in7"/>
188 </constraints> 191 </constraints>
189 </imageView> 192 </imageView>
190 - <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Πάρε δωρεάν μηνιαία πακέτα με πάνες στα supermarket Σκλαβενίτης!" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="isU-Qv-94G"> 193 + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Πάρε δωρεάν μηνιαία πακέτα με πάνες στα supermarket Σκλαβενίτης!" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="isU-Qv-94G">
191 - <rect key="frame" x="20" y="230" width="341" height="38.5"/> 194 + <rect key="frame" x="20" y="230" width="374" height="38.5"/>
192 - <fontDescription key="fontDescription" type="boldSystem" pointSize="16"/> 195 + <fontDescription key="fontDescription" type="system" weight="semibold" pointSize="16"/>
193 <color key="textColor" red="0.25490196078431371" green="0.33333333333333331" blue="0.39215686274509803" alpha="0.84705882352941175" colorSpace="calibratedRGB"/> 196 <color key="textColor" red="0.25490196078431371" green="0.33333333333333331" blue="0.39215686274509803" alpha="0.84705882352941175" colorSpace="calibratedRGB"/>
194 <nil key="highlightedColor"/> 197 <nil key="highlightedColor"/>
195 </label> 198 </label>
196 - <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Χρησιμοποίησε τον παρακάτω κωδικό και πάρε δωρεάν πακέτο πάνες Pampers αποκλειστικά στα Supermarket Σκλαβενίτης" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="dSA-lM-N5v"> 199 + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Χρησιμοποίησε τον παρακάτω κωδικό και πάρε δωρεάν πακέτο πάνες Pampers αποκλειστικά στα Supermarket Σκλαβενίτης" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="dSA-lM-N5v">
197 - <rect key="frame" x="20" y="298.5" width="361.5" height="50.5"/> 200 + <rect key="frame" x="20" y="293.5" width="374" height="57.5"/>
198 - <fontDescription key="fontDescription" type="system" pointSize="14"/> 201 + <fontDescription key="fontDescription" type="system" pointSize="16"/>
199 <color key="textColor" red="0.25490196079999999" green="0.33333333329999998" blue="0.3921568627" alpha="0.84705882349999995" colorSpace="calibratedRGB"/> 202 <color key="textColor" red="0.25490196079999999" green="0.33333333329999998" blue="0.3921568627" alpha="0.84705882349999995" colorSpace="calibratedRGB"/>
200 <nil key="highlightedColor"/> 203 <nil key="highlightedColor"/>
201 </label> 204 </label>
202 - <button opaque="NO" contentMode="scaleToFill" ambiguous="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="FCd-hv-dHg"> 205 + <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="FCd-hv-dHg">
203 - <rect key="frame" x="30" y="716" width="354" height="50"/> 206 + <rect key="frame" x="83" y="451" width="248" height="50"/>
204 <constraints> 207 <constraints>
205 <constraint firstAttribute="height" constant="50" id="n2w-Tx-hhO"/> 208 <constraint firstAttribute="height" constant="50" id="n2w-Tx-hhO"/>
206 </constraints> 209 </constraints>
207 <state key="normal" title="Button"/> 210 <state key="normal" title="Button"/>
208 - <buttonConfiguration key="configuration" style="plain" title="Κάντο δώρο!"> 211 + <buttonConfiguration key="configuration" style="plain" title="Απόκτησέ το">
209 - <backgroundConfiguration key="background" cornerRadius="7"> 212 + <backgroundConfiguration key="background" cornerRadius="12">
210 <color key="backgroundColor" red="0.47450980390000003" green="0.74901960779999999" blue="0.078431372550000003" alpha="0.84705882349999995" colorSpace="calibratedRGB"/> 213 <color key="backgroundColor" red="0.47450980390000003" green="0.74901960779999999" blue="0.078431372550000003" alpha="0.84705882349999995" colorSpace="calibratedRGB"/>
211 </backgroundConfiguration> 214 </backgroundConfiguration>
212 <fontDescription key="titleFontDescription" type="system" weight="medium" pointSize="15"/> 215 <fontDescription key="titleFontDescription" type="system" weight="medium" pointSize="15"/>
213 <color key="baseForegroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> 216 <color key="baseForegroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
214 </buttonConfiguration> 217 </buttonConfiguration>
215 <connections> 218 <connections>
216 - <action selector="redeemButtomAction:" destination="S8k-2D-tGT" eventType="touchUpInside" id="ygO-66-Dsl"/> 219 + <action selector="redeemButtomAction:" destination="S8k-2D-tGT" eventType="touchUpInside" id="W1u-Fc-1nm"/>
217 </connections> 220 </connections>
218 </button> 221 </button>
219 - <label opaque="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" usesAttributedText="YES" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="9Wc-e3-KgW"> 222 + <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="KvN-fk-rlm">
220 - <rect key="frame" x="20" y="796" width="374" height="16"/> 223 + <rect key="frame" x="103.5" y="511" width="207" height="50"/>
221 - <attributedString key="attributedText"> 224 + <constraints>
222 - <fragment content="Όροι χρήσης"> 225 + <constraint firstAttribute="height" constant="50" id="O7T-ug-rTB"/>
223 - <attributes> 226 + </constraints>
224 - <color key="NSColor" red="0.25490196079999999" green="0.33333333329999998" blue="0.3921568627" alpha="0.84705882349999995" colorSpace="calibratedRGB"/> 227 + <inset key="imageEdgeInsets" minX="5" minY="0.0" maxX="0.0" maxY="0.0"/>
225 - <font key="NSFont" metaFont="system" size="14"/> 228 + <state key="normal" title="Button"/>
226 - <paragraphStyle key="NSParagraphStyle" alignment="center" lineBreakMode="wordWrapping" baseWritingDirection="natural" tighteningFactorForTruncation="0.0"/> 229 + <buttonConfiguration key="configuration" style="plain" image="ic_down_dark" imagePlacement="trailing" title="Όροι χρήσης" imagePadding="5">
227 - <integer key="NSUnderline" value="1"/> 230 + <preferredSymbolConfiguration key="preferredSymbolConfigurationForImage"/>
228 - </attributes> 231 + <fontDescription key="titleFontDescription" type="system" weight="semibold" pointSize="15"/>
229 - </fragment> 232 + <color key="baseForegroundColor" red="0.25490196078431371" green="0.33333333333333331" blue="0.39215686274509803" alpha="0.84705882349999995" colorSpace="calibratedRGB"/>
230 - </attributedString> 233 + </buttonConfiguration>
231 - <nil key="highlightedColor"/> 234 + <connections>
232 - </label> 235 + <action selector="termsButtonAction:" destination="S8k-2D-tGT" eventType="touchUpInside" id="Cdz-mV-gqb"/>
236 + </connections>
237 + </button>
238 + <textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" editable="NO" textAlignment="center" selectable="NO" translatesAutoresizingMaskIntoConstraints="NO" id="siA-c8-Ub8">
239 + <rect key="frame" x="20" y="571" width="374" height="0.0"/>
240 + <color key="backgroundColor" systemColor="systemBackgroundColor"/>
241 + <constraints>
242 + <constraint firstAttribute="height" id="BWJ-i6-UeO"/>
243 + </constraints>
244 + <color key="textColor" red="0.25490196078431371" green="0.33333333333333331" blue="0.39215686274509803" alpha="1" colorSpace="calibratedRGB"/>
245 + <fontDescription key="fontDescription" type="system" pointSize="14"/>
246 + <textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
247 + </textView>
233 </subviews> 248 </subviews>
234 <color key="backgroundColor" systemColor="systemBackgroundColor"/> 249 <color key="backgroundColor" systemColor="systemBackgroundColor"/>
235 <constraints> 250 <constraints>
251 + <constraint firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="KvN-fk-rlm" secondAttribute="bottom" constant="30" id="2Md-hq-rQl"/>
252 + <constraint firstItem="KvN-fk-rlm" firstAttribute="width" secondItem="uTN-Qr-wBi" secondAttribute="width" multiplier="0.5" id="2R9-MN-w6g"/>
236 <constraint firstItem="dSA-lM-N5v" firstAttribute="leading" secondItem="uTN-Qr-wBi" secondAttribute="leading" constant="20" id="6B9-Tx-YcO"/> 253 <constraint firstItem="dSA-lM-N5v" firstAttribute="leading" secondItem="uTN-Qr-wBi" secondAttribute="leading" constant="20" id="6B9-Tx-YcO"/>
237 - <constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="isU-Qv-94G" secondAttribute="trailing" constant="20" id="7cL-ob-hXY"/> 254 + <constraint firstAttribute="trailing" secondItem="isU-Qv-94G" secondAttribute="trailing" constant="20" id="7cL-ob-hXY"/>
238 - <constraint firstItem="9Wc-e3-KgW" firstAttribute="leading" secondItem="uTN-Qr-wBi" secondAttribute="leading" constant="20" id="91Z-y9-N6s"/> 255 + <constraint firstAttribute="trailing" secondItem="siA-c8-Ub8" secondAttribute="trailing" constant="20" id="C8g-1f-Ef3"/>
239 - <constraint firstItem="FCd-hv-dHg" firstAttribute="leading" secondItem="uTN-Qr-wBi" secondAttribute="leading" constant="30" id="DYG-XQ-tco"/> 256 + <constraint firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="siA-c8-Ub8" secondAttribute="bottom" constant="30" id="FOo-d7-zvC"/>
240 - <constraint firstAttribute="trailing" secondItem="FCd-hv-dHg" secondAttribute="trailing" constant="30" id="KJ4-Vf-6ti"/> 257 + <constraint firstAttribute="trailing" secondItem="dSA-lM-N5v" secondAttribute="trailing" constant="20" id="LZq-UM-EE3"/>
241 - <constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="dSA-lM-N5v" secondAttribute="trailing" constant="20" id="LZq-UM-EE3"/> 258 + <constraint firstItem="siA-c8-Ub8" firstAttribute="top" secondItem="KvN-fk-rlm" secondAttribute="bottom" constant="10" id="MHv-4j-YYr"/>
259 + <constraint firstItem="FCd-hv-dHg" firstAttribute="centerX" secondItem="uTN-Qr-wBi" secondAttribute="centerX" id="OFE-Xc-Ui3"/>
242 <constraint firstItem="isU-Qv-94G" firstAttribute="leading" secondItem="uTN-Qr-wBi" secondAttribute="leading" constant="20" id="PR6-tJ-tw0"/> 260 <constraint firstItem="isU-Qv-94G" firstAttribute="leading" secondItem="uTN-Qr-wBi" secondAttribute="leading" constant="20" id="PR6-tJ-tw0"/>
261 + <constraint firstItem="KvN-fk-rlm" firstAttribute="centerX" secondItem="uTN-Qr-wBi" secondAttribute="centerX" id="QQN-Ps-Th4"/>
243 <constraint firstAttribute="trailing" secondItem="3SX-fR-ph2" secondAttribute="trailing" id="WJj-1Q-Erx"/> 262 <constraint firstAttribute="trailing" secondItem="3SX-fR-ph2" secondAttribute="trailing" id="WJj-1Q-Erx"/>
244 - <constraint firstAttribute="bottom" secondItem="9Wc-e3-KgW" secondAttribute="bottom" constant="30" id="dJ7-Kz-ne0"/> 263 + <constraint firstItem="siA-c8-Ub8" firstAttribute="leading" secondItem="uTN-Qr-wBi" secondAttribute="leading" constant="20" id="cpX-xa-q0z"/>
245 - <constraint firstItem="9Wc-e3-KgW" firstAttribute="top" secondItem="FCd-hv-dHg" secondAttribute="bottom" constant="30" id="dTv-Rx-rpW"/> 264 + <constraint firstItem="KvN-fk-rlm" firstAttribute="top" secondItem="FCd-hv-dHg" secondAttribute="bottom" constant="10" id="fAV-Vc-ICH"/>
246 - <constraint firstItem="dSA-lM-N5v" firstAttribute="top" secondItem="isU-Qv-94G" secondAttribute="bottom" constant="30" id="k8m-Rf-p7u"/> 265 + <constraint firstItem="dSA-lM-N5v" firstAttribute="top" secondItem="isU-Qv-94G" secondAttribute="bottom" constant="25" id="k8m-Rf-p7u"/>
247 <constraint firstItem="3SX-fR-ph2" firstAttribute="leading" secondItem="uTN-Qr-wBi" secondAttribute="leading" id="nBV-nm-wOq"/> 266 <constraint firstItem="3SX-fR-ph2" firstAttribute="leading" secondItem="uTN-Qr-wBi" secondAttribute="leading" id="nBV-nm-wOq"/>
248 - <constraint firstAttribute="trailing" secondItem="9Wc-e3-KgW" secondAttribute="trailing" constant="20" id="nsf-fZ-63s"/>
249 <constraint firstItem="3SX-fR-ph2" firstAttribute="top" secondItem="uTN-Qr-wBi" secondAttribute="top" id="oaX-KH-TEh"/> 267 <constraint firstItem="3SX-fR-ph2" firstAttribute="top" secondItem="uTN-Qr-wBi" secondAttribute="top" id="oaX-KH-TEh"/>
250 <constraint firstItem="isU-Qv-94G" firstAttribute="top" secondItem="3SX-fR-ph2" secondAttribute="bottom" constant="30" id="vQf-lC-GgG"/> 268 <constraint firstItem="isU-Qv-94G" firstAttribute="top" secondItem="3SX-fR-ph2" secondAttribute="bottom" constant="30" id="vQf-lC-GgG"/>
251 - <constraint firstItem="FCd-hv-dHg" firstAttribute="top" relation="greaterThanOrEqual" secondItem="dSA-lM-N5v" secondAttribute="bottom" constant="60" id="x3c-xH-QFZ"/> 269 + <constraint firstItem="FCd-hv-dHg" firstAttribute="top" secondItem="dSA-lM-N5v" secondAttribute="bottom" constant="100" id="x3c-xH-QFZ"/>
270 + <constraint firstItem="FCd-hv-dHg" firstAttribute="width" secondItem="uTN-Qr-wBi" secondAttribute="width" multiplier="0.6" id="xPb-wH-vOl"/>
252 </constraints> 271 </constraints>
253 </view> 272 </view>
254 </subviews> 273 </subviews>
...@@ -266,10 +285,14 @@ ...@@ -266,10 +285,14 @@
266 <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> 285 <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
267 <constraints> 286 <constraints>
268 <constraint firstItem="1N5-oA-ZTb" firstAttribute="leading" secondItem="Jqu-cp-CWU" secondAttribute="leading" id="6xu-Fr-ayy"/> 287 <constraint firstItem="1N5-oA-ZTb" firstAttribute="leading" secondItem="Jqu-cp-CWU" secondAttribute="leading" id="6xu-Fr-ayy"/>
288 + <constraint firstItem="Oep-XD-blB" firstAttribute="leading" secondItem="Jqu-cp-CWU" secondAttribute="leading" id="EcY-pv-yN5"/>
269 <constraint firstItem="uTN-Qr-wBi" firstAttribute="height" relation="greaterThanOrEqual" secondItem="Jqu-cp-CWU" secondAttribute="height" id="IW1-Sy-djh"/> 289 <constraint firstItem="uTN-Qr-wBi" firstAttribute="height" relation="greaterThanOrEqual" secondItem="Jqu-cp-CWU" secondAttribute="height" id="IW1-Sy-djh"/>
290 + <constraint firstItem="Oep-XD-blB" firstAttribute="top" secondItem="Jqu-cp-CWU" secondAttribute="top" id="Ykm-QS-49G"/>
270 <constraint firstAttribute="trailing" secondItem="1N5-oA-ZTb" secondAttribute="trailing" id="dQR-wy-Qcd"/> 291 <constraint firstAttribute="trailing" secondItem="1N5-oA-ZTb" secondAttribute="trailing" id="dQR-wy-Qcd"/>
271 - <constraint firstItem="1N5-oA-ZTb" firstAttribute="top" secondItem="Jqu-cp-CWU" secondAttribute="top" id="g8J-5T-9Mg"/> 292 + <constraint firstItem="1N5-oA-ZTb" firstAttribute="top" secondItem="Jqu-cp-CWU" secondAttribute="top" constant="5" id="g8J-5T-9Mg"/>
272 <constraint firstAttribute="bottom" secondItem="1N5-oA-ZTb" secondAttribute="bottom" id="kaG-d8-5oJ"/> 293 <constraint firstAttribute="bottom" secondItem="1N5-oA-ZTb" secondAttribute="bottom" id="kaG-d8-5oJ"/>
294 + <constraint firstAttribute="bottom" secondItem="Oep-XD-blB" secondAttribute="bottom" id="kkx-h0-joG"/>
295 + <constraint firstAttribute="trailing" secondItem="Oep-XD-blB" secondAttribute="trailing" id="xnN-ZO-lA9"/>
273 </constraints> 296 </constraints>
274 </view> 297 </view>
275 </subviews> 298 </subviews>
...@@ -277,17 +300,20 @@ ...@@ -277,17 +300,20 @@
277 <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> 300 <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
278 <constraints> 301 <constraints>
279 <constraint firstAttribute="bottom" secondItem="Jqu-cp-CWU" secondAttribute="bottom" id="ANm-zp-vX6"/> 302 <constraint firstAttribute="bottom" secondItem="Jqu-cp-CWU" secondAttribute="bottom" id="ANm-zp-vX6"/>
280 - <constraint firstItem="Jqu-cp-CWU" firstAttribute="top" secondItem="JM4-xN-bgp" secondAttribute="topMargin" constant="10" id="ST9-WE-ewd"/> 303 + <constraint firstItem="Jqu-cp-CWU" firstAttribute="top" secondItem="TUZ-8z-puM" secondAttribute="top" id="ST9-WE-ewd"/>
281 <constraint firstAttribute="trailing" secondItem="Jqu-cp-CWU" secondAttribute="trailing" id="eQx-vL-Dfd"/> 304 <constraint firstAttribute="trailing" secondItem="Jqu-cp-CWU" secondAttribute="trailing" id="eQx-vL-Dfd"/>
282 <constraint firstItem="Jqu-cp-CWU" firstAttribute="leading" secondItem="JM4-xN-bgp" secondAttribute="leading" id="kQx-xb-czQ"/> 305 <constraint firstItem="Jqu-cp-CWU" firstAttribute="leading" secondItem="JM4-xN-bgp" secondAttribute="leading" id="kQx-xb-czQ"/>
283 </constraints> 306 </constraints>
284 </view> 307 </view>
285 <connections> 308 <connections>
286 - <outlet property="couponImageHeight" destination="zUx-Yd-in7" id="NWw-aF-GEM"/> 309 + <outlet property="couponImageHeight" destination="zUx-Yd-in7" id="7vo-8L-d8o"/>
287 - <outlet property="mainView" destination="Jqu-cp-CWU" id="cLA-eX-Av4"/> 310 + <outlet property="mainView" destination="Jqu-cp-CWU" id="Q0Z-dO-MXL"/>
288 - <outlet property="redeemButton" destination="FCd-hv-dHg" id="blu-64-lZt"/> 311 + <outlet property="redeemButton" destination="FCd-hv-dHg" id="3Jw-Yn-uNr"/>
289 - <outlet property="scrollContentView" destination="uTN-Qr-wBi" id="atF-nT-J6Y"/> 312 + <outlet property="scrollContentView" destination="uTN-Qr-wBi" id="pPq-Lh-qVN"/>
290 - <outlet property="termsLabel" destination="9Wc-e3-KgW" id="2Z0-nm-mAy"/> 313 + <outlet property="scrollView" destination="1N5-oA-ZTb" id="qee-AV-Oev"/>
314 + <outlet property="termsButton" destination="KvN-fk-rlm" id="pj7-bA-bhe"/>
315 + <outlet property="termsTextView" destination="siA-c8-Ub8" id="EfZ-wm-ED6"/>
316 + <outlet property="termsTextViewHeight" destination="BWJ-i6-UeO" id="GHO-YH-B9e"/>
291 </connections> 317 </connections>
292 </viewController> 318 </viewController>
293 <placeholder placeholderIdentifier="IBFirstResponder" id="zFf-Es-4zg" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/> 319 <placeholder placeholderIdentifier="IBFirstResponder" id="zFf-Es-4zg" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
...@@ -341,6 +367,8 @@ ...@@ -341,6 +367,8 @@
341 </scenes> 367 </scenes>
342 <resources> 368 <resources>
343 <image name="coupons_scrollview" width="214" height="463.5"/> 369 <image name="coupons_scrollview" width="214" height="463.5"/>
370 + <image name="coupons_scrollview_white" width="214" height="462"/>
371 + <image name="ic_down_dark" width="22" height="11.5"/>
344 <systemColor name="systemBackgroundColor"> 372 <systemColor name="systemBackgroundColor">
345 <color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> 373 <color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
346 </systemColor> 374 </systemColor>
......
1 +{
2 + "images" : [
3 + {
4 + "filename" : "coupons_scrollview_white.png",
5 + "idiom" : "universal",
6 + "scale" : "1x"
7 + },
8 + {
9 + "filename" : "coupons_scrollview_white-1.png",
10 + "idiom" : "universal",
11 + "scale" : "2x"
12 + },
13 + {
14 + "filename" : "coupons_scrollview_white-2.png",
15 + "idiom" : "universal",
16 + "scale" : "3x"
17 + }
18 + ],
19 + "info" : {
20 + "author" : "xcode",
21 + "version" : 1
22 + }
23 +}
1 +{
2 + "images" : [
3 + {
4 + "filename" : "ic_down_dark.png",
5 + "idiom" : "universal",
6 + "scale" : "1x"
7 + },
8 + {
9 + "filename" : "ic_down_dark-1.png",
10 + "idiom" : "universal",
11 + "scale" : "2x"
12 + },
13 + {
14 + "filename" : "ic_down_dark-2.png",
15 + "idiom" : "universal",
16 + "scale" : "3x"
17 + }
18 + ],
19 + "info" : {
20 + "author" : "xcode",
21 + "version" : 1
22 + }
23 +}
1 +{
2 + "images" : [
3 + {
4 + "filename" : "ic_up_dark.png",
5 + "idiom" : "universal",
6 + "scale" : "1x"
7 + },
8 + {
9 + "filename" : "ic_up_dark-1.png",
10 + "idiom" : "universal",
11 + "scale" : "2x"
12 + },
13 + {
14 + "filename" : "ic_up_dark-2.png",
15 + "idiom" : "universal",
16 + "scale" : "3x"
17 + }
18 + ],
19 + "info" : {
20 + "author" : "xcode",
21 + "version" : 1
22 + }
23 +}
...@@ -49,3 +49,17 @@ extension UIViewController { ...@@ -49,3 +49,17 @@ extension UIViewController {
49 49
50 } 50 }
51 } 51 }
52 +
53 +extension String {
54 + var htmlToAttributedString: NSAttributedString? {
55 + guard let data = data(using: .utf8) else { return nil }
56 + do {
57 + return try NSAttributedString(data: data, options: [.documentType: NSAttributedString.DocumentType.html, .characterEncoding:String.Encoding.utf8.rawValue], documentAttributes: nil)
58 + } catch {
59 + return nil
60 + }
61 + }
62 + var htmlToString: String {
63 + return htmlToAttributedString?.string ?? ""
64 + }
65 +}
......
...@@ -75,6 +75,7 @@ public class swiftApi { ...@@ -75,6 +75,7 @@ public class swiftApi {
75 public let inner_text: String? 75 public let inner_text: String?
76 public let buyable: Bool? 76 public let buyable: Bool?
77 public let visible: Bool? 77 public let visible: Bool?
78 + public let terms: String?
78 79
79 public init(dictionary: [String: Any]) { 80 public init(dictionary: [String: Any]) {
80 self.uuid = dictionary["uuid"] as? String? ?? "" 81 self.uuid = dictionary["uuid"] as? String? ?? ""
...@@ -88,6 +89,7 @@ public class swiftApi { ...@@ -88,6 +89,7 @@ public class swiftApi {
88 self.inner_text = dictionary["inner_text"] as? String? ?? "" 89 self.inner_text = dictionary["inner_text"] as? String? ?? ""
89 self.buyable = dictionary["buyable"] as? Bool? ?? false 90 self.buyable = dictionary["buyable"] as? Bool? ?? false
90 self.visible = dictionary["visible"] as? Bool? ?? false 91 self.visible = dictionary["visible"] as? Bool? ?? false
92 + self.terms = dictionary["terms"] as? String? ?? ""
91 93
92 let expirationObject = dictionary["expiration"] as? [String: Any]? ?? ["":""] 94 let expirationObject = dictionary["expiration"] as? [String: Any]? ?? ["":""]
93 let expirationString = expirationObject?["value"] as? String? ?? "" 95 let expirationString = expirationObject?["value"] as? String? ?? ""
......