Showing
5 changed files
with
216 additions
and
10 deletions
| ... | @@ -7,7 +7,7 @@ | ... | @@ -7,7 +7,7 @@ | 
| 7 | <key>Pods-SwiftWarplyFramework.xcscheme_^#shared#^_</key> | 7 | <key>Pods-SwiftWarplyFramework.xcscheme_^#shared#^_</key> | 
| 8 | <dict> | 8 | <dict> | 
| 9 | <key>orderHint</key> | 9 | <key>orderHint</key> | 
| 10 | - <integer>0</integer> | 10 | + <integer>1</integer> | 
| 11 | </dict> | 11 | </dict> | 
| 12 | </dict> | 12 | </dict> | 
| 13 | </dict> | 13 | </dict> | ... | ... | 
| ... | @@ -7,7 +7,7 @@ | ... | @@ -7,7 +7,7 @@ | 
| 7 | <key>SwiftWarplyFramework.xcscheme_^#shared#^_</key> | 7 | <key>SwiftWarplyFramework.xcscheme_^#shared#^_</key> | 
| 8 | <dict> | 8 | <dict> | 
| 9 | <key>orderHint</key> | 9 | <key>orderHint</key> | 
| 10 | - <integer>1</integer> | 10 | + <integer>0</integer> | 
| 11 | </dict> | 11 | </dict> | 
| 12 | </dict> | 12 | </dict> | 
| 13 | </dict> | 13 | </dict> | ... | ... | 
No preview for this file type
| ... | @@ -3125,9 +3125,154 @@ | ... | @@ -3125,9 +3125,154 @@ | 
| 3125 | <view key="view" contentMode="scaleToFill" id="ktT-by-xJt"> | 3125 | <view key="view" contentMode="scaleToFill" id="ktT-by-xJt"> | 
| 3126 | <rect key="frame" x="0.0" y="0.0" width="414" height="896"/> | 3126 | <rect key="frame" x="0.0" y="0.0" width="414" height="896"/> | 
| 3127 | <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> | 3127 | <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> | 
| 3128 | + <subviews> | ||
| 3129 | + <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="BQW-dX-NwZ" userLabel="Main View"> | ||
| 3130 | + <rect key="frame" x="0.0" y="48" width="414" height="848"/> | ||
| 3131 | + <subviews> | ||
| 3132 | + <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="coupons_scrollview_dark" translatesAutoresizingMaskIntoConstraints="NO" id="QKV-Lk-E2a"> | ||
| 3133 | + <rect key="frame" x="0.0" y="0.0" width="414" height="848"/> | ||
| 3134 | + </imageView> | ||
| 3135 | + <tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="none" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="-1" estimatedSectionHeaderHeight="-1" sectionFooterHeight="-1" estimatedSectionFooterHeight="-1" translatesAutoresizingMaskIntoConstraints="NO" id="YVv-xm-y2W"> | ||
| 3136 | + <rect key="frame" x="0.0" y="2" width="414" height="846"/> | ||
| 3137 | + <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> | ||
| 3138 | + <color key="sectionIndexBackgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> | ||
| 3139 | + <prototypes> | ||
| 3140 | + <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="none" indentationWidth="10" reuseIdentifier="UnifiedCouponsTableViewCellId" id="D63-Nr-YbN" customClass="UnifiedCouponsTableViewCell" customModule="SwiftWarplyFramework"> | ||
| 3141 | + <rect key="frame" x="0.0" y="50" width="414" height="64.5"/> | ||
| 3142 | + <autoresizingMask key="autoresizingMask"/> | ||
| 3143 | + <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="D63-Nr-YbN" id="Fzs-bb-ogj"> | ||
| 3144 | + <rect key="frame" x="0.0" y="0.0" width="414" height="64.5"/> | ||
| 3145 | + <autoresizingMask key="autoresizingMask"/> | ||
| 3146 | + <subviews> | ||
| 3147 | + <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="SNn-v6-lAQ"> | ||
| 3148 | + <rect key="frame" x="10" y="0.0" width="394" height="64.5"/> | ||
| 3149 | + <subviews> | ||
| 3150 | + <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="coupon_bg" translatesAutoresizingMaskIntoConstraints="NO" id="P7R-OP-hfM"> | ||
| 3151 | + <rect key="frame" x="0.0" y="0.0" width="394" height="64.5"/> | ||
| 3152 | + </imageView> | ||
| 3153 | + <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Te0-Eo-vQy"> | ||
| 3154 | + <rect key="frame" x="20" y="10" width="79" height="44.5"/> | ||
| 3155 | + <subviews> | ||
| 3156 | + <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="YTM-kV-L3p"> | ||
| 3157 | + <rect key="frame" x="18" y="18" width="43" height="8.5"/> | ||
| 3158 | + <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> | ||
| 3159 | + </imageView> | ||
| 3160 | + </subviews> | ||
| 3161 | + <color key="backgroundColor" systemColor="systemBackgroundColor"/> | ||
| 3162 | + <constraints> | ||
| 3163 | + <constraint firstAttribute="trailing" secondItem="YTM-kV-L3p" secondAttribute="trailing" constant="18" id="S8B-5l-NmI"/> | ||
| 3164 | + <constraint firstAttribute="bottom" secondItem="YTM-kV-L3p" secondAttribute="bottom" constant="18" id="VV5-9e-0o2"/> | ||
| 3165 | + <constraint firstItem="YTM-kV-L3p" firstAttribute="leading" secondItem="Te0-Eo-vQy" secondAttribute="leading" constant="18" id="bLV-gv-3Ew"/> | ||
| 3166 | + <constraint firstItem="YTM-kV-L3p" firstAttribute="top" secondItem="Te0-Eo-vQy" secondAttribute="top" constant="18" id="tel-jV-m7i"/> | ||
| 3167 | + </constraints> | ||
| 3168 | + </view> | ||
| 3169 | + <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="mTi-wJ-LZa"> | ||
| 3170 | + <rect key="frame" x="104" y="10" width="10" height="44.5"/> | ||
| 3171 | + <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> | ||
| 3172 | + <constraints> | ||
| 3173 | + <constraint firstAttribute="width" constant="10" id="KBt-tr-uxF"/> | ||
| 3174 | + </constraints> | ||
| 3175 | + </view> | ||
| 3176 | + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="3" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="GFK-EC-8kT"> | ||
| 3177 | + <rect key="frame" x="119" y="15" width="163.5" height="20"/> | ||
| 3178 | + <fontDescription key="fontDescription" name="BTCosmo-Bold" family="BTCosmo" pointSize="17"/> | ||
| 3179 | + <color key="textColor" red="0.12941176469999999" green="0.12941176469999999" blue="0.12941176469999999" alpha="1" colorSpace="calibratedRGB"/> | ||
| 3180 | + <nil key="highlightedColor"/> | ||
| 3181 | + </label> | ||
| 3182 | + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" numberOfLines="4" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="jeN-eT-NTP"> | ||
| 3183 | + <rect key="frame" x="292.5" y="25.5" width="81.5" height="14"/> | ||
| 3184 | + <fontDescription key="fontDescription" name="PeridotPE-Regular" family="Peridot PE" pointSize="12"/> | ||
| 3185 | + <color key="textColor" red="0.12941176469999999" green="0.12941176469999999" blue="0.12941176469999999" alpha="1" colorSpace="calibratedRGB"/> | ||
| 3186 | + <nil key="highlightedColor"/> | ||
| 3187 | + </label> | ||
| 3188 | + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="wCr-ft-C3l"> | ||
| 3189 | + <rect key="frame" x="119" y="35.5" width="255" height="14"/> | ||
| 3190 | + <fontDescription key="fontDescription" name="PeridotPE-Regular" family="Peridot PE" pointSize="12"/> | ||
| 3191 | + <color key="textColor" red="0.12941176469999999" green="0.12941176469999999" blue="0.12941176469999999" alpha="1" colorSpace="calibratedRGB"/> | ||
| 3192 | + <nil key="highlightedColor"/> | ||
| 3193 | + </label> | ||
| 3194 | + </subviews> | ||
| 3195 | + <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> | ||
| 3196 | + <constraints> | ||
| 3197 | + <constraint firstAttribute="bottom" secondItem="P7R-OP-hfM" secondAttribute="bottom" id="1zT-ka-Exy"/> | ||
| 3198 | + <constraint firstItem="mTi-wJ-LZa" firstAttribute="top" secondItem="SNn-v6-lAQ" secondAttribute="top" constant="10" id="2ds-Yp-3DN"/> | ||
| 3199 | + <constraint firstAttribute="trailing" secondItem="P7R-OP-hfM" secondAttribute="trailing" id="CoX-ln-n8e"/> | ||
| 3200 | + <constraint firstAttribute="trailing" secondItem="jeN-eT-NTP" secondAttribute="trailing" constant="20" id="HbK-tE-oJ7"/> | ||
| 3201 | + <constraint firstItem="GFK-EC-8kT" firstAttribute="top" secondItem="SNn-v6-lAQ" secondAttribute="top" constant="15" id="KdF-fj-Aka"/> | ||
| 3202 | + <constraint firstItem="Te0-Eo-vQy" firstAttribute="width" secondItem="SNn-v6-lAQ" secondAttribute="width" multiplier="0.2" id="LYy-Lp-bHh"/> | ||
| 3203 | + <constraint firstAttribute="bottom" secondItem="wCr-ft-C3l" secondAttribute="bottom" constant="15" id="Mvj-2b-KZs"/> | ||
| 3204 | + <constraint firstItem="jeN-eT-NTP" firstAttribute="leading" secondItem="GFK-EC-8kT" secondAttribute="trailing" constant="10" id="T31-yI-0d8"/> | ||
| 3205 | + <constraint firstItem="GFK-EC-8kT" firstAttribute="width" secondItem="jeN-eT-NTP" secondAttribute="width" multiplier="2" id="ahW-d1-PFZ"/> | ||
| 3206 | + <constraint firstItem="mTi-wJ-LZa" firstAttribute="leading" secondItem="Te0-Eo-vQy" secondAttribute="trailing" constant="5" id="b39-H0-7Bz"/> | ||
| 3207 | + <constraint firstAttribute="trailing" secondItem="wCr-ft-C3l" secondAttribute="trailing" constant="20" id="e5S-hU-hSg"/> | ||
| 3208 | + <constraint firstItem="jeN-eT-NTP" firstAttribute="centerY" secondItem="SNn-v6-lAQ" secondAttribute="centerY" id="fg0-gy-qkk"/> | ||
| 3209 | + <constraint firstItem="GFK-EC-8kT" firstAttribute="leading" secondItem="mTi-wJ-LZa" secondAttribute="trailing" constant="5" id="hCu-4c-qRX"/> | ||
| 3210 | + <constraint firstItem="P7R-OP-hfM" firstAttribute="top" secondItem="SNn-v6-lAQ" secondAttribute="top" id="ibc-Xg-7RL"/> | ||
| 3211 | + <constraint firstAttribute="bottom" secondItem="Te0-Eo-vQy" secondAttribute="bottom" constant="10" id="lqJ-6O-cKJ"/> | ||
| 3212 | + <constraint firstItem="wCr-ft-C3l" firstAttribute="leading" secondItem="mTi-wJ-LZa" secondAttribute="trailing" constant="5" id="nRf-Wb-4Wb"/> | ||
| 3213 | + <constraint firstItem="Te0-Eo-vQy" firstAttribute="top" secondItem="SNn-v6-lAQ" secondAttribute="top" constant="10" id="p6Q-Lt-DEe"/> | ||
| 3214 | + <constraint firstItem="Te0-Eo-vQy" firstAttribute="leading" secondItem="SNn-v6-lAQ" secondAttribute="leading" constant="20" id="pzE-ST-RVu"/> | ||
| 3215 | + <constraint firstAttribute="bottom" secondItem="mTi-wJ-LZa" secondAttribute="bottom" constant="10" id="qaD-jQ-lJT"/> | ||
| 3216 | + <constraint firstItem="P7R-OP-hfM" firstAttribute="leading" secondItem="SNn-v6-lAQ" secondAttribute="leading" id="scG-CZ-8AK"/> | ||
| 3217 | + </constraints> | ||
| 3218 | + </view> | ||
| 3219 | + </subviews> | ||
| 3220 | + <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> | ||
| 3221 | + <constraints> | ||
| 3222 | + <constraint firstItem="SNn-v6-lAQ" firstAttribute="leading" secondItem="Fzs-bb-ogj" secondAttribute="leading" constant="10" id="AvX-cm-EUW"/> | ||
| 3223 | + <constraint firstAttribute="trailing" secondItem="SNn-v6-lAQ" secondAttribute="trailing" constant="10" id="NYM-q3-gfI"/> | ||
| 3224 | + <constraint firstAttribute="bottom" secondItem="SNn-v6-lAQ" secondAttribute="bottom" id="Z91-aK-9nI"/> | ||
| 3225 | + <constraint firstItem="SNn-v6-lAQ" firstAttribute="top" secondItem="Fzs-bb-ogj" secondAttribute="top" id="sou-xJ-tDN"/> | ||
| 3226 | + </constraints> | ||
| 3227 | + </tableViewCellContentView> | ||
| 3228 | + <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> | ||
| 3229 | + <connections> | ||
| 3230 | + <outlet property="borderView" destination="mTi-wJ-LZa" id="cWk-w9-CzM"/> | ||
| 3231 | + <outlet property="couponBgImage" destination="P7R-OP-hfM" id="UFL-aM-Xdl"/> | ||
| 3232 | + <outlet property="couponImage" destination="YTM-kV-L3p" id="YAs-US-Jgy"/> | ||
| 3233 | + <outlet property="discriptionLabel" destination="jeN-eT-NTP" id="Wue-YT-if6"/> | ||
| 3234 | + <outlet property="expirationLabel" destination="wCr-ft-C3l" id="VOr-GP-P1V"/> | ||
| 3235 | + <outlet property="nameLabel" destination="GFK-EC-8kT" id="Bbm-E9-hGO"/> | ||
| 3236 | + </connections> | ||
| 3237 | + </tableViewCell> | ||
| 3238 | + </prototypes> | ||
| 3239 | + <connections> | ||
| 3240 | + <outlet property="dataSource" destination="3uV-Le-crf" id="Qf4-jf-XhM"/> | ||
| 3241 | + <outlet property="delegate" destination="3uV-Le-crf" id="3Mq-HR-Udb"/> | ||
| 3242 | + </connections> | ||
| 3243 | + </tableView> | ||
| 3244 | + </subviews> | ||
| 3245 | + <color key="backgroundColor" red="0.94901960780000005" green="0.94901960780000005" blue="0.95294117649999999" alpha="1" colorSpace="calibratedRGB"/> | ||
| 3246 | + <constraints> | ||
| 3247 | + <constraint firstAttribute="bottom" secondItem="YVv-xm-y2W" secondAttribute="bottom" id="2Sd-z8-rwY"/> | ||
| 3248 | + <constraint firstAttribute="trailing" secondItem="YVv-xm-y2W" secondAttribute="trailing" id="38N-7Z-jr0"/> | ||
| 3249 | + <constraint firstItem="YVv-xm-y2W" firstAttribute="leading" secondItem="BQW-dX-NwZ" secondAttribute="leading" id="93P-If-3rc"/> | ||
| 3250 | + <constraint firstAttribute="bottom" secondItem="QKV-Lk-E2a" secondAttribute="bottom" id="IeT-AJ-BlK"/> | ||
| 3251 | + <constraint firstItem="QKV-Lk-E2a" firstAttribute="top" secondItem="BQW-dX-NwZ" secondAttribute="top" id="TRn-cU-wHn"/> | ||
| 3252 | + <constraint firstItem="YVv-xm-y2W" firstAttribute="top" secondItem="BQW-dX-NwZ" secondAttribute="top" constant="2" id="XeB-29-8xb"/> | ||
| 3253 | + <constraint firstItem="QKV-Lk-E2a" firstAttribute="leading" secondItem="BQW-dX-NwZ" secondAttribute="leading" id="ZP8-kd-9RI"/> | ||
| 3254 | + <constraint firstAttribute="trailing" secondItem="QKV-Lk-E2a" secondAttribute="trailing" id="tzT-5O-w7Q"/> | ||
| 3255 | + </constraints> | ||
| 3256 | + <variation key="default"> | ||
| 3257 | + <mask key="subviews"> | ||
| 3258 | + <exclude reference="QKV-Lk-E2a"/> | ||
| 3259 | + </mask> | ||
| 3260 | + </variation> | ||
| 3261 | + </view> | ||
| 3262 | + </subviews> | ||
| 3128 | <viewLayoutGuide key="safeArea" id="e3G-Dp-x2L"/> | 3263 | <viewLayoutGuide key="safeArea" id="e3G-Dp-x2L"/> | 
| 3129 | <color key="backgroundColor" systemColor="systemBackgroundColor"/> | 3264 | <color key="backgroundColor" systemColor="systemBackgroundColor"/> | 
| 3265 | + <constraints> | ||
| 3266 | + <constraint firstAttribute="trailing" secondItem="BQW-dX-NwZ" secondAttribute="trailing" id="12O-aM-qls"/> | ||
| 3267 | + <constraint firstItem="BQW-dX-NwZ" firstAttribute="leading" secondItem="ktT-by-xJt" secondAttribute="leading" id="7eK-lN-9aw"/> | ||
| 3268 | + <constraint firstItem="BQW-dX-NwZ" firstAttribute="top" secondItem="e3G-Dp-x2L" secondAttribute="top" id="DsK-TB-xoF"/> | ||
| 3269 | + <constraint firstAttribute="bottom" secondItem="BQW-dX-NwZ" secondAttribute="bottom" id="ttz-hz-AF0"/> | ||
| 3270 | + </constraints> | ||
| 3130 | </view> | 3271 | </view> | 
| 3272 | + <connections> | ||
| 3273 | + <outlet property="backgroundImage" destination="QKV-Lk-E2a" id="sWD-ra-Ek8"/> | ||
| 3274 | + <outlet property="tableView" destination="YVv-xm-y2W" id="kle-or-Ckg"/> | ||
| 3275 | + </connections> | ||
| 3131 | </viewController> | 3276 | </viewController> | 
| 3132 | <placeholder placeholderIdentifier="IBFirstResponder" id="3Zc-8U-ste" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/> | 3277 | <placeholder placeholderIdentifier="IBFirstResponder" id="3Zc-8U-ste" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/> | 
| 3133 | </objects> | 3278 | </objects> | ... | ... | 
| ... | @@ -10,22 +10,83 @@ import UIKit | ... | @@ -10,22 +10,83 @@ import UIKit | 
| 10 | import SwiftEventBus | 10 | import SwiftEventBus | 
| 11 | 11 | ||
| 12 | @objc public class UnifiedCouponsViewController: UIViewController { | 12 | @objc public class UnifiedCouponsViewController: UIViewController { | 
| 13 | + @IBOutlet weak var backgroundImage: UIImageView! | ||
| 14 | + @IBOutlet weak var tableView: UITableView! | ||
| 15 | + | ||
| 16 | + public var unifiedCoupons:Array<swiftApi.UnifiedCouponModel> = [] | ||
| 13 | 17 | ||
| 14 | public override func viewDidLoad() { | 18 | public override func viewDidLoad() { | 
| 15 | super.viewDidLoad() | 19 | super.viewDidLoad() | 
| 20 | + | ||
| 21 | + self.hidesBottomBarWhenPushed = true | ||
| 22 | + | ||
| 23 | + SwiftEventBus.onBackgroundThread(self, name: "unified_coupons_fetched") { result in | ||
| 16 | 24 | ||
| 17 | - // Do any additional setup after loading the view. | 25 | + DispatchQueue.main.async { | 
| 26 | + self.unifiedCoupons = swiftApi().getUnifiedCouponList() | ||
| 27 | + self.tableView.reloadData() | ||
| 28 | + } | ||
| 29 | + } | ||
| 30 | + | ||
| 31 | + setBackButton() | ||
| 32 | + setNavigationTitle("SUPERMARKET DEALS") | ||
| 33 | + | ||
| 34 | +// backgroundImage.image = UIImage(named: "coupons_scrollview_dark", in: MyEmptyClass.resourceBundle(), compatibleWith: nil) | ||
| 35 | + | ||
| 36 | + tableView.delegate = self | ||
| 37 | + tableView.dataSource = self | ||
| 38 | + | ||
| 39 | +// tableView.clipsToBounds = true | ||
| 40 | +// tableView.layer.cornerRadius = 30 | ||
| 41 | +// tableView.layer.maskedCorners = [ .layerMinXMinYCorner] // Top left corner radius | ||
| 42 | + tableView.contentInset.top = 30 | ||
| 18 | } | 43 | } | 
| 19 | 44 | ||
| 45 | + public override func viewWillAppear(_ animated: Bool) { | ||
| 46 | + super.viewWillAppear(animated) | ||
| 47 | + | ||
| 48 | + swiftApi().logTrackersEvent("screen", "ActiveUnifiedCouponsScreen") | ||
| 49 | + | ||
| 50 | + self.unifiedCoupons = swiftApi().getUnifiedCouponList() | ||
| 51 | + self.tableView.reloadData() | ||
| 52 | + | ||
| 53 | + self.navigationController?.hideHairline() | ||
| 54 | + } | ||
| 20 | 55 | ||
| 21 | - /* | 56 | + // MARK: - Functions | 
| 22 | - // MARK: - Navigation | 57 | +} | 
| 23 | 58 | ||
| 24 | - // In a storyboard-based application, you will often want to do a little preparation before navigation | 59 | +// MARK: - TableView | 
| 25 | - override func prepare(for segue: UIStoryboardSegue, sender: Any?) { | 60 | +extension UnifiedCouponsViewController: UITableViewDelegate, UITableViewDataSource{ | 
| 26 | - // Get the new view controller using segue.destination. | 61 | + | 
| 27 | - // Pass the selected object to the new view controller. | 62 | + public func numberOfSections(in tableView: UITableView) -> Int { | 
| 63 | + return 1 | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + public func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { | ||
| 67 | + return self.unifiedCoupons.count | ||
| 28 | } | 68 | } | 
| 29 | - */ | 69 | + | 
| 70 | + public func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { | ||
| 71 | + return 130.0 + 8.0 | ||
| 72 | +// return UITableViewAutomaticDimension | ||
| 73 | + } | ||
| 74 | + | ||
| 75 | + public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { | ||
| 76 | + let cell = tableView.dequeueReusableCell(withIdentifier: "UnifiedCouponsTableViewCellId", for: indexPath) as! UnifiedCouponsTableViewCell | ||
| 77 | + cell.configureCell(coupon: unifiedCoupons[indexPath.row]) | ||
| 78 | + return cell | ||
| 79 | + } | ||
| 80 | + | ||
| 81 | + public func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { | ||
| 82 | + let couponBarcode = unifiedCoupons[indexPath.row]._barcode | ||
| 83 | + swiftApi().logTrackersEvent("click", ("UnifiedCoupon:" + couponBarcode)) | ||
| 30 | 84 | ||
| 85 | + let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self)) | ||
| 86 | + let vc = storyboard.instantiateViewController(withIdentifier: "UnifiedCouponBarcodeViewController") as! SwiftWarplyFramework.UnifiedCouponBarcodeViewController | ||
| 87 | + vc.coupon = unifiedCoupons[indexPath.row] | ||
| 88 | + vc.isFromWallet = true | ||
| 89 | + self.navigationController?.pushViewController(vc, animated: true) | ||
| 90 | + } | ||
| 91 | + | ||
| 31 | } | 92 | } | ... | ... | 
- 
Please register or login to post a comment