Manos Chorianopoulos

Added no vouchers UI in myRewards

......@@ -2644,23 +2644,23 @@
</connections>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="none" indentationWidth="10" reuseIdentifier="UnifiedCouponsTableViewCellId" id="DUH-nG-QWi" customClass="UnifiedCouponsTableViewCell" customModule="SwiftWarplyFramework">
<rect key="frame" x="0.0" y="883" width="414" height="64.5"/>
<rect key="frame" x="0.0" y="883" width="414" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="DUH-nG-QWi" id="rx6-wA-MYI">
<rect key="frame" x="0.0" y="0.0" width="414" height="64.5"/>
<rect key="frame" x="0.0" y="0.0" width="414" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="WW2-mP-ZJD">
<rect key="frame" x="10" y="0.0" width="394" height="64.5"/>
<rect key="frame" x="10" y="0.0" width="394" height="44"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="coupon_bg" translatesAutoresizingMaskIntoConstraints="NO" id="Gde-3J-Ew9">
<rect key="frame" x="0.0" y="0.0" width="394" height="64.5"/>
<rect key="frame" x="0.0" y="0.0" width="394" height="44"/>
</imageView>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="87q-5c-uea">
<rect key="frame" x="20" y="10" width="79" height="44.5"/>
<rect key="frame" x="20" y="10" width="79" height="24"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="XsA-Nw-7Pr">
<rect key="frame" x="18" y="18" width="43" height="8.5"/>
<rect key="frame" x="18" y="18" width="43" height="0.0"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</imageView>
</subviews>
......@@ -2673,7 +2673,7 @@
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="u97-5H-Y40">
<rect key="frame" x="104" y="10" width="10" height="44.5"/>
<rect key="frame" x="104" y="10" width="10" height="24"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="width" constant="10" id="Tcx-FG-KC0"/>
......@@ -2686,13 +2686,13 @@
<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="KJD-Db-B4t">
<rect key="frame" x="292.5" y="25" width="81.5" height="15"/>
<rect key="frame" x="292.5" y="14.5" width="81.5" height="15"/>
<fontDescription key="fontDescription" name="PeridotPE-Regular" family="Peridot PE" pointSize="12"/>
<color key="textColor" red="0.12941176470588234" green="0.12941176470588234" blue="0.12941176470588234" 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="C5t-xz-oAO">
<rect key="frame" x="119" y="34.5" width="255" height="15"/>
<rect key="frame" x="119" y="14" width="255" height="15"/>
<fontDescription key="fontDescription" name="PeridotPE-Regular" family="Peridot PE" pointSize="12"/>
<color key="textColor" red="0.12941176470588234" green="0.12941176470588234" blue="0.12941176470588234" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
......@@ -2742,7 +2742,7 @@
</connections>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="none" indentationWidth="10" reuseIdentifier="WalletBadgesTableViewCellId" id="TeS-tP-Ilh" customClass="WalletBadgesTableViewCell" customModule="SwiftWarplyFramework">
<rect key="frame" x="0.0" y="947.5" width="414" height="260"/>
<rect key="frame" x="0.0" y="927" width="414" height="260"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="TeS-tP-Ilh" id="FFV-uA-HHA">
<rect key="frame" x="0.0" y="0.0" width="414" height="260"/>
......@@ -2969,7 +2969,7 @@
</connections>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="none" indentationWidth="10" reuseIdentifier="WalletBannersTableViewCellId" id="fgI-zL-RPZ" customClass="WalletBannersTableViewCell" customModule="SwiftWarplyFramework">
<rect key="frame" x="0.0" y="1207.5" width="414" height="404"/>
<rect key="frame" x="0.0" y="1187" width="414" height="404"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="fgI-zL-RPZ" id="gNB-PU-R1J">
<rect key="frame" x="0.0" y="0.0" width="414" height="404"/>
......@@ -3337,7 +3337,7 @@
</connections>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="none" indentationWidth="10" reuseIdentifier="WalletActiveCouponsTableViewCellId" id="qaY-Zw-d8E" customClass="WalletActiveCouponsTableViewCell" customModule="SwiftWarplyFramework">
<rect key="frame" x="0.0" y="1611.5" width="414" height="103"/>
<rect key="frame" x="0.0" y="1591" width="414" height="103"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="qaY-Zw-d8E" id="MoF-lG-k6u">
<rect key="frame" x="0.0" y="0.0" width="414" height="103"/>
......@@ -3620,7 +3620,7 @@
</connections>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="none" indentationWidth="10" reuseIdentifier="WalletVouchersBannerTableViewCellId" id="F1i-u5-1v2" customClass="WalletVouchersBannerTableViewCell" customModule="SwiftWarplyFramework">
<rect key="frame" x="0.0" y="1714.5" width="414" height="181"/>
<rect key="frame" x="0.0" y="1694" width="414" height="181"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="F1i-u5-1v2" id="q9T-Eg-Gxw">
<rect key="frame" x="0.0" y="0.0" width="414" height="181"/>
......@@ -3653,11 +3653,29 @@
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Υπόλοιπο επιδότησης" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="2p1-v2-lAL">
<rect key="frame" x="66" y="28" width="263" height="20"/>
<rect key="frame" x="66" y="28" width="164" height="20"/>
<fontDescription key="fontDescription" name="PeridotPE-Regular" family="Peridot PE" pointSize="16"/>
<color key="textColor" red="0.12941176469999999" green="0.12941176469999999" blue="0.12941176469999999" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="AKD-A9-ah0">
<rect key="frame" x="230" y="19" width="17.5" height="18"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="0" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="BwW-J2-1Sz">
<rect key="frame" x="5" y="2" width="7.5" height="14"/>
<fontDescription key="fontDescription" name="PeridotPE-SBold" family="Peridot PE" pointSize="11"/>
<color key="textColor" red="0.12941176469999999" green="0.12941176469999999" blue="0.12941176469999999" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" red="0.91764705879999997" green="0.74901960779999999" blue="0.40784313729999999" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstItem="BwW-J2-1Sz" firstAttribute="top" secondItem="AKD-A9-ah0" secondAttribute="top" constant="2" id="P9j-kH-8X7"/>
<constraint firstAttribute="bottom" secondItem="BwW-J2-1Sz" secondAttribute="bottom" constant="2" id="eI0-YG-mRB"/>
<constraint firstItem="BwW-J2-1Sz" firstAttribute="leading" secondItem="AKD-A9-ah0" secondAttribute="leading" constant="5" id="hlf-PL-cVe"/>
<constraint firstAttribute="trailing" secondItem="BwW-J2-1Sz" secondAttribute="trailing" constant="5" id="ncp-fn-LRV"/>
</constraints>
</view>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="cSu-mM-1Ep">
<rect key="frame" x="334" y="28" width="20" height="20"/>
<constraints>
......@@ -3668,14 +3686,16 @@
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="cSu-mM-1Ep" firstAttribute="leading" secondItem="2p1-v2-lAL" secondAttribute="trailing" constant="5" id="0RF-Lr-hdi"/>
<constraint firstItem="cSu-mM-1Ep" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="2p1-v2-lAL" secondAttribute="trailing" constant="5" id="0RF-Lr-hdi"/>
<constraint firstItem="U9f-Ar-TCE" firstAttribute="top" secondItem="eBr-vb-7oH" secondAttribute="top" constant="20" id="Gnc-a7-lVn"/>
<constraint firstItem="U9f-Ar-TCE" firstAttribute="leading" secondItem="eBr-vb-7oH" secondAttribute="leading" constant="20" id="O3t-rA-Xoi"/>
<constraint firstItem="2p1-v2-lAL" firstAttribute="centerY" secondItem="U9f-Ar-TCE" secondAttribute="centerY" id="bWi-vx-lud"/>
<constraint firstItem="cSu-mM-1Ep" firstAttribute="centerY" secondItem="U9f-Ar-TCE" secondAttribute="centerY" id="bwI-YH-DDm"/>
<constraint firstAttribute="trailing" secondItem="cSu-mM-1Ep" secondAttribute="trailing" constant="20" id="fLn-8r-nUC"/>
<constraint firstItem="AKD-A9-ah0" firstAttribute="leading" secondItem="2p1-v2-lAL" secondAttribute="trailing" id="hZ8-wn-M57"/>
<constraint firstAttribute="bottom" secondItem="U9f-Ar-TCE" secondAttribute="bottom" constant="20" id="jCC-NV-1nD"/>
<constraint firstItem="2p1-v2-lAL" firstAttribute="leading" secondItem="U9f-Ar-TCE" secondAttribute="trailing" constant="10" id="kv2-9q-gc9"/>
<constraint firstItem="AKD-A9-ah0" firstAttribute="centerY" secondItem="2p1-v2-lAL" secondAttribute="centerY" constant="-10" id="vGu-1o-rr0"/>
</constraints>
</view>
</subviews>
......@@ -3710,20 +3730,21 @@
<outlet property="voucherBannerIconImage" destination="U9f-Ar-TCE" id="cy8-jG-sg7"/>
<outlet property="voucherBannerLabel" destination="2p1-v2-lAL" id="Wlm-z2-nrW"/>
<outlet property="voucherBannerView" destination="eBr-vb-7oH" id="RU1-Lx-048"/>
<outlet property="voucherCountView" destination="AKD-A9-ah0" id="dEs-FI-5Ns"/>
</connections>
</tableViewCell>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="none" indentationWidth="10" reuseIdentifier="WalletSpinnerTableViewCellId" id="ShU-xo-DhW" customClass="WalletSpinnerTableViewCell" customModule="SwiftWarplyFramework">
<rect key="frame" x="0.0" y="1895.5" width="414" height="98"/>
<rect key="frame" x="0.0" y="1875" width="414" height="88"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="ShU-xo-DhW" id="U4r-xF-gbA">
<rect key="frame" x="0.0" y="0.0" width="414" height="98"/>
<rect key="frame" x="0.0" y="0.0" width="414" height="88"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<view contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="hm4-ma-8T7" userLabel="ParentView">
<rect key="frame" x="0.0" y="0.0" width="414" height="98"/>
<rect key="frame" x="0.0" y="0.0" width="414" height="88"/>
<subviews>
<activityIndicatorView opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" ambiguous="YES" style="large" translatesAutoresizingMaskIntoConstraints="NO" id="Kes-eE-1K8">
<rect key="frame" x="183" y="30" width="48" height="48"/>
<rect key="frame" x="183" y="20" width="48" height="48"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstAttribute="height" constant="48" id="MxX-gd-WB6"/>
......
......@@ -93,6 +93,8 @@ import SwiftEventBus
self.coupons = swiftApi().getCouponList()
self.totalCouponDiscount = Float(round(100 * swiftApi().getLoyaltyBadge()._value) / 100)
self.loyaltyBadge = swiftApi().getLoyaltyBadge()
self.handleSpinnerAndEmptyView()
self.tableView.reloadData()
}
}
......@@ -753,7 +755,7 @@ import SwiftEventBus
if (self.dfyCoupons.count == 0 && self.unifiedCoupons.count == 0 && self.coupons.count == 0) {
self.showActiveCouponsBanners = false
if (swiftApi().getShowVouchersBanner() == "false") {
if (swiftApi().getShowVouchersBanner() == "null") {
self.emptyView.isHidden = false
self.emptyViewHeight.constant = self.emptyView.intrinsicContentSize.height
......@@ -1058,7 +1060,7 @@ extension WalletViewController: UITableViewDelegate, UITableViewDataSource{
return 0
}
} else if (section == 1) {
if (swiftApi().getShowVouchersBanner() == "true") {
if (swiftApi().getShowVouchersBanner() == "true" || swiftApi().getShowVouchersBanner() == "false") {
return 1
} else {
return 0
......@@ -1112,7 +1114,7 @@ extension WalletViewController: UITableViewDelegate, UITableViewDataSource{
return 0.0
}
} else if (indexPath.section == 1) {
if (swiftApi().getShowVouchersBanner() == "true") {
if (swiftApi().getShowVouchersBanner() == "true" || swiftApi().getShowVouchersBanner() == "false") {
return UITableView.automaticDimension
} else {
return 0.0
......@@ -1208,7 +1210,7 @@ extension WalletViewController: UITableViewDelegate, UITableViewDataSource{
return nil
}
} else if (section == 1) {
// if (swiftApi().getShowVouchersBanner() == "true") {
// if (swiftApi().getShowVouchersBanner() == "true" || swiftApi().getShowVouchersBanner() == "false") {
// let view = UIView(frame: CGRect(x: 0, y: 0, width: tableView.frame.width, height: 70))
// view.backgroundColor = .clear
......@@ -1268,7 +1270,7 @@ extension WalletViewController: UITableViewDelegate, UITableViewDataSource{
return 0.0
}
} else if (section == 1) {
// if (swiftApi().getShowVouchersBanner() == "true") {
// if (swiftApi().getShowVouchersBanner() == "true" || swiftApi().getShowVouchersBanner() == "false") {
// return 70.0
// } else {
return 0.0
......@@ -1322,7 +1324,7 @@ extension WalletViewController: UITableViewDelegate, UITableViewDataSource{
} else if (indexPath.section == 1) {
let cell = tableView.dequeueReusableCell(withIdentifier: "WalletVouchersBannerTableViewCellId", for: indexPath) as! WalletVouchersBannerTableViewCell
cell.configureCell(showSeparator: self.showActiveCouponsBanners)
cell.configureCell(showSeparator: self.showActiveCouponsBanners, active: swiftApi().getShowVouchersBanner() == "true")
return cell
} else {
let cell = tableView.dequeueReusableCell(withIdentifier: "WalletSpinnerTableViewCellId", for: indexPath) as! WalletSpinnerTableViewCell
......
......@@ -15,6 +15,7 @@ import UIKit
@IBOutlet weak var voucherBannerIconImage: UIImageView!
@IBOutlet weak var voucherBannerLabel: UILabel!
@IBOutlet weak var voucherBannerArrowImage: UIImageView!
@IBOutlet weak var voucherCountView: UIView!
public override func awakeFromNib() {
super.awakeFromNib()
......@@ -35,7 +36,10 @@ import UIKit
voucherBannerIconImage.image = UIImage(named: "wallet_voucher", in: MyEmptyClass.resourceBundle(), compatibleWith: nil)
voucherBannerArrowImage.image = UIImage(named: "arrow_right_black", in: MyEmptyClass.resourceBundle(), compatibleWith: nil)
voucherBannerLabel.text = "Ενημερώσου για το υπόλοιπο επιδότησης"
// voucherBannerLabel.text = "Ενημερώσου για το υπόλοιπο επιδότησης"
voucherCountView.layer.cornerRadius = 4.0
voucherCountView.backgroundColor = UIColor(red: 0.92, green: 0.75, blue: 0.41, alpha: 1.00)
}
public override func setSelected(_ selected: Bool, animated: Bool) {
......@@ -44,7 +48,7 @@ import UIKit
// Configure the view for the selected state
}
func configureCell(showSeparator: Bool) {
func configureCell(showSeparator: Bool, active: Bool) {
if (showSeparator == true) {
separatorView.isHidden = false
separatorTopSpace.constant = 25
......@@ -53,6 +57,25 @@ import UIKit
separatorView.isHidden = true
separatorTopSpace.constant = 0
}
if (active == true) {
voucherBannerView.backgroundColor = .white
voucherBannerIconImage.image = voucherBannerIconImage.image?.withRenderingMode(.alwaysTemplate)
voucherBannerIconImage.tintColor = UIColor(red: 0.00, green: 0.65, blue: 0.89, alpha: 1.00)
voucherBannerLabel.text = "Ενημερώσου για το υπόλοιπο επιδότησης"
voucherBannerLabel.textColor = UIColor(red: 0.13, green: 0.13, blue: 0.13, alpha: 1.00)
voucherBannerLabel.frame.size.width = voucherBannerLabel.intrinsicContentSize.width
voucherCountView.isHidden = true
} else {
voucherBannerView.backgroundColor = UIColor(red: 0.95, green: 0.95, blue: 0.95, alpha: 1.00)
voucherBannerIconImage.image = voucherBannerIconImage.image?.withRenderingMode(.alwaysTemplate)
voucherBannerIconImage.tintColor = UIColor(red: 0.52, green: 0.52, blue: 0.52, alpha: 1.00)
voucherBannerLabel.text = "Διαθέσιμο υπόλοιπο"
voucherBannerLabel.textColor = UIColor(red: 0.52, green: 0.52, blue: 0.52, alpha: 1.00)
voucherBannerLabel.frame.size.width = voucherBannerLabel.intrinsicContentSize.width
voucherCountView.isHidden = false
}
}
}
......
......@@ -183,11 +183,10 @@ public class swiftApi {
}
public func setVouchersFetched(_ success: Bool) -> Void {
if (success == true) {
setShowVouchersBanner("true")
} else {
setShowVouchersBanner("false")
public func setVouchersFetched(_ success: String) -> Void {
// Possible values "true", "false", "null"
if (success == "true" || success == "false" || success == "null") {
setShowVouchersBanner(success)
}
SwiftEventBus.post("vouchers_fetched")
......