Manos Chorianopoulos

add UnifiedCouponsViewController part 2

......@@ -7,7 +7,7 @@
<key>Pods-SwiftWarplyFramework.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
<integer>1</integer>
</dict>
</dict>
</dict>
......
......@@ -7,7 +7,7 @@
<key>SwiftWarplyFramework.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>1</integer>
<integer>0</integer>
</dict>
</dict>
</dict>
......
......@@ -3125,9 +3125,154 @@
<view key="view" contentMode="scaleToFill" id="ktT-by-xJt">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="BQW-dX-NwZ" userLabel="Main View">
<rect key="frame" x="0.0" y="48" width="414" height="848"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="coupons_scrollview_dark" translatesAutoresizingMaskIntoConstraints="NO" id="QKV-Lk-E2a">
<rect key="frame" x="0.0" y="0.0" width="414" height="848"/>
</imageView>
<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">
<rect key="frame" x="0.0" y="2" width="414" height="846"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<color key="sectionIndexBackgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="none" indentationWidth="10" reuseIdentifier="UnifiedCouponsTableViewCellId" id="D63-Nr-YbN" customClass="UnifiedCouponsTableViewCell" customModule="SwiftWarplyFramework">
<rect key="frame" x="0.0" y="50" width="414" height="64.5"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="D63-Nr-YbN" id="Fzs-bb-ogj">
<rect key="frame" x="0.0" y="0.0" width="414" height="64.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="SNn-v6-lAQ">
<rect key="frame" x="10" y="0.0" width="394" height="64.5"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="coupon_bg" translatesAutoresizingMaskIntoConstraints="NO" id="P7R-OP-hfM">
<rect key="frame" x="0.0" y="0.0" width="394" height="64.5"/>
</imageView>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Te0-Eo-vQy">
<rect key="frame" x="20" y="10" width="79" height="44.5"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="YTM-kV-L3p">
<rect key="frame" x="18" y="18" width="43" height="8.5"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</imageView>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="YTM-kV-L3p" secondAttribute="trailing" constant="18" id="S8B-5l-NmI"/>
<constraint firstAttribute="bottom" secondItem="YTM-kV-L3p" secondAttribute="bottom" constant="18" id="VV5-9e-0o2"/>
<constraint firstItem="YTM-kV-L3p" firstAttribute="leading" secondItem="Te0-Eo-vQy" secondAttribute="leading" constant="18" id="bLV-gv-3Ew"/>
<constraint firstItem="YTM-kV-L3p" firstAttribute="top" secondItem="Te0-Eo-vQy" secondAttribute="top" constant="18" id="tel-jV-m7i"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="mTi-wJ-LZa">
<rect key="frame" x="104" y="10" width="10" height="44.5"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="width" constant="10" id="KBt-tr-uxF"/>
</constraints>
</view>
<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">
<rect key="frame" x="119" y="15" width="163.5" height="20"/>
<fontDescription key="fontDescription" name="BTCosmo-Bold" family="BTCosmo" pointSize="17"/>
<color key="textColor" red="0.12941176469999999" green="0.12941176469999999" blue="0.12941176469999999" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<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">
<rect key="frame" x="292.5" y="25.5" width="81.5" height="14"/>
<fontDescription key="fontDescription" name="PeridotPE-Regular" family="Peridot PE" pointSize="12"/>
<color key="textColor" red="0.12941176469999999" green="0.12941176469999999" blue="0.12941176469999999" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<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">
<rect key="frame" x="119" y="35.5" width="255" height="14"/>
<fontDescription key="fontDescription" name="PeridotPE-Regular" family="Peridot PE" pointSize="12"/>
<color key="textColor" red="0.12941176469999999" green="0.12941176469999999" blue="0.12941176469999999" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="bottom" secondItem="P7R-OP-hfM" secondAttribute="bottom" id="1zT-ka-Exy"/>
<constraint firstItem="mTi-wJ-LZa" firstAttribute="top" secondItem="SNn-v6-lAQ" secondAttribute="top" constant="10" id="2ds-Yp-3DN"/>
<constraint firstAttribute="trailing" secondItem="P7R-OP-hfM" secondAttribute="trailing" id="CoX-ln-n8e"/>
<constraint firstAttribute="trailing" secondItem="jeN-eT-NTP" secondAttribute="trailing" constant="20" id="HbK-tE-oJ7"/>
<constraint firstItem="GFK-EC-8kT" firstAttribute="top" secondItem="SNn-v6-lAQ" secondAttribute="top" constant="15" id="KdF-fj-Aka"/>
<constraint firstItem="Te0-Eo-vQy" firstAttribute="width" secondItem="SNn-v6-lAQ" secondAttribute="width" multiplier="0.2" id="LYy-Lp-bHh"/>
<constraint firstAttribute="bottom" secondItem="wCr-ft-C3l" secondAttribute="bottom" constant="15" id="Mvj-2b-KZs"/>
<constraint firstItem="jeN-eT-NTP" firstAttribute="leading" secondItem="GFK-EC-8kT" secondAttribute="trailing" constant="10" id="T31-yI-0d8"/>
<constraint firstItem="GFK-EC-8kT" firstAttribute="width" secondItem="jeN-eT-NTP" secondAttribute="width" multiplier="2" id="ahW-d1-PFZ"/>
<constraint firstItem="mTi-wJ-LZa" firstAttribute="leading" secondItem="Te0-Eo-vQy" secondAttribute="trailing" constant="5" id="b39-H0-7Bz"/>
<constraint firstAttribute="trailing" secondItem="wCr-ft-C3l" secondAttribute="trailing" constant="20" id="e5S-hU-hSg"/>
<constraint firstItem="jeN-eT-NTP" firstAttribute="centerY" secondItem="SNn-v6-lAQ" secondAttribute="centerY" id="fg0-gy-qkk"/>
<constraint firstItem="GFK-EC-8kT" firstAttribute="leading" secondItem="mTi-wJ-LZa" secondAttribute="trailing" constant="5" id="hCu-4c-qRX"/>
<constraint firstItem="P7R-OP-hfM" firstAttribute="top" secondItem="SNn-v6-lAQ" secondAttribute="top" id="ibc-Xg-7RL"/>
<constraint firstAttribute="bottom" secondItem="Te0-Eo-vQy" secondAttribute="bottom" constant="10" id="lqJ-6O-cKJ"/>
<constraint firstItem="wCr-ft-C3l" firstAttribute="leading" secondItem="mTi-wJ-LZa" secondAttribute="trailing" constant="5" id="nRf-Wb-4Wb"/>
<constraint firstItem="Te0-Eo-vQy" firstAttribute="top" secondItem="SNn-v6-lAQ" secondAttribute="top" constant="10" id="p6Q-Lt-DEe"/>
<constraint firstItem="Te0-Eo-vQy" firstAttribute="leading" secondItem="SNn-v6-lAQ" secondAttribute="leading" constant="20" id="pzE-ST-RVu"/>
<constraint firstAttribute="bottom" secondItem="mTi-wJ-LZa" secondAttribute="bottom" constant="10" id="qaD-jQ-lJT"/>
<constraint firstItem="P7R-OP-hfM" firstAttribute="leading" secondItem="SNn-v6-lAQ" secondAttribute="leading" id="scG-CZ-8AK"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="SNn-v6-lAQ" firstAttribute="leading" secondItem="Fzs-bb-ogj" secondAttribute="leading" constant="10" id="AvX-cm-EUW"/>
<constraint firstAttribute="trailing" secondItem="SNn-v6-lAQ" secondAttribute="trailing" constant="10" id="NYM-q3-gfI"/>
<constraint firstAttribute="bottom" secondItem="SNn-v6-lAQ" secondAttribute="bottom" id="Z91-aK-9nI"/>
<constraint firstItem="SNn-v6-lAQ" firstAttribute="top" secondItem="Fzs-bb-ogj" secondAttribute="top" id="sou-xJ-tDN"/>
</constraints>
</tableViewCellContentView>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<connections>
<outlet property="borderView" destination="mTi-wJ-LZa" id="cWk-w9-CzM"/>
<outlet property="couponBgImage" destination="P7R-OP-hfM" id="UFL-aM-Xdl"/>
<outlet property="couponImage" destination="YTM-kV-L3p" id="YAs-US-Jgy"/>
<outlet property="discriptionLabel" destination="jeN-eT-NTP" id="Wue-YT-if6"/>
<outlet property="expirationLabel" destination="wCr-ft-C3l" id="VOr-GP-P1V"/>
<outlet property="nameLabel" destination="GFK-EC-8kT" id="Bbm-E9-hGO"/>
</connections>
</tableViewCell>
</prototypes>
<connections>
<outlet property="dataSource" destination="3uV-Le-crf" id="Qf4-jf-XhM"/>
<outlet property="delegate" destination="3uV-Le-crf" id="3Mq-HR-Udb"/>
</connections>
</tableView>
</subviews>
<color key="backgroundColor" red="0.94901960780000005" green="0.94901960780000005" blue="0.95294117649999999" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="bottom" secondItem="YVv-xm-y2W" secondAttribute="bottom" id="2Sd-z8-rwY"/>
<constraint firstAttribute="trailing" secondItem="YVv-xm-y2W" secondAttribute="trailing" id="38N-7Z-jr0"/>
<constraint firstItem="YVv-xm-y2W" firstAttribute="leading" secondItem="BQW-dX-NwZ" secondAttribute="leading" id="93P-If-3rc"/>
<constraint firstAttribute="bottom" secondItem="QKV-Lk-E2a" secondAttribute="bottom" id="IeT-AJ-BlK"/>
<constraint firstItem="QKV-Lk-E2a" firstAttribute="top" secondItem="BQW-dX-NwZ" secondAttribute="top" id="TRn-cU-wHn"/>
<constraint firstItem="YVv-xm-y2W" firstAttribute="top" secondItem="BQW-dX-NwZ" secondAttribute="top" constant="2" id="XeB-29-8xb"/>
<constraint firstItem="QKV-Lk-E2a" firstAttribute="leading" secondItem="BQW-dX-NwZ" secondAttribute="leading" id="ZP8-kd-9RI"/>
<constraint firstAttribute="trailing" secondItem="QKV-Lk-E2a" secondAttribute="trailing" id="tzT-5O-w7Q"/>
</constraints>
<variation key="default">
<mask key="subviews">
<exclude reference="QKV-Lk-E2a"/>
</mask>
</variation>
</view>
</subviews>
<viewLayoutGuide key="safeArea" id="e3G-Dp-x2L"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="BQW-dX-NwZ" secondAttribute="trailing" id="12O-aM-qls"/>
<constraint firstItem="BQW-dX-NwZ" firstAttribute="leading" secondItem="ktT-by-xJt" secondAttribute="leading" id="7eK-lN-9aw"/>
<constraint firstItem="BQW-dX-NwZ" firstAttribute="top" secondItem="e3G-Dp-x2L" secondAttribute="top" id="DsK-TB-xoF"/>
<constraint firstAttribute="bottom" secondItem="BQW-dX-NwZ" secondAttribute="bottom" id="ttz-hz-AF0"/>
</constraints>
</view>
<connections>
<outlet property="backgroundImage" destination="QKV-Lk-E2a" id="sWD-ra-Ek8"/>
<outlet property="tableView" destination="YVv-xm-y2W" id="kle-or-Ckg"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="3Zc-8U-ste" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
......
......@@ -10,22 +10,83 @@ import UIKit
import SwiftEventBus
@objc public class UnifiedCouponsViewController: UIViewController {
@IBOutlet weak var backgroundImage: UIImageView!
@IBOutlet weak var tableView: UITableView!
public var unifiedCoupons:Array<swiftApi.UnifiedCouponModel> = []
public override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
self.hidesBottomBarWhenPushed = true
SwiftEventBus.onBackgroundThread(self, name: "unified_coupons_fetched") { result in
DispatchQueue.main.async {
self.unifiedCoupons = swiftApi().getUnifiedCouponList()
self.tableView.reloadData()
}
}
setBackButton()
setNavigationTitle("SUPERMARKET DEALS")
// backgroundImage.image = UIImage(named: "coupons_scrollview_dark", in: MyEmptyClass.resourceBundle(), compatibleWith: nil)
tableView.delegate = self
tableView.dataSource = self
// tableView.clipsToBounds = true
// tableView.layer.cornerRadius = 30
// tableView.layer.maskedCorners = [ .layerMinXMinYCorner] // Top left corner radius
tableView.contentInset.top = 30
}
public override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
swiftApi().logTrackersEvent("screen", "ActiveUnifiedCouponsScreen")
self.unifiedCoupons = swiftApi().getUnifiedCouponList()
self.tableView.reloadData()
self.navigationController?.hideHairline()
}
// MARK: - Functions
}
// MARK: - TableView
extension UnifiedCouponsViewController: UITableViewDelegate, UITableViewDataSource{
public func numberOfSections(in tableView: UITableView) -> Int {
return 1
}
public func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return self.unifiedCoupons.count
}
public func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 130.0 + 8.0
// return UITableViewAutomaticDimension
}
public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "UnifiedCouponsTableViewCellId", for: indexPath) as! UnifiedCouponsTableViewCell
cell.configureCell(coupon: unifiedCoupons[indexPath.row])
return cell
}
/*
// MARK: - Navigation
public func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let couponBarcode = unifiedCoupons[indexPath.row]._barcode
swiftApi().logTrackersEvent("click", ("UnifiedCoupon:" + couponBarcode))
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destination.
// Pass the selected object to the new view controller.
let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self))
let vc = storyboard.instantiateViewController(withIdentifier: "UnifiedCouponBarcodeViewController") as! SwiftWarplyFramework.UnifiedCouponBarcodeViewController
vc.coupon = unifiedCoupons[indexPath.row]
vc.isFromWallet = true
self.navigationController?.pushViewController(vc, animated: true)
}
*/
}
......