Manos Chorianopoulos

hide empty banners at WalletViewController

......@@ -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>
......
......@@ -864,19 +864,19 @@
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="2" translatesAutoresizingMaskIntoConstraints="NO" id="MCY-xv-vpg">
<rect key="frame" x="20" y="20" width="254" height="60.5"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" text="Ενεργός κωδικός:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ucC-u4-AQL">
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Ενεργός κωδικός:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ucC-u4-AQL">
<rect key="frame" x="0.0" y="0.0" width="254" height="21.5"/>
<fontDescription key="fontDescription" type="system" weight="semibold" pointSize="18"/>
<color key="textColor" red="0.23529411759999999" green="0.32549019610000002" blue="0.39607843139999999" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" text="961544809" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="qBe-Jw-QUx">
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="961544809" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="qBe-Jw-QUx">
<rect key="frame" x="0.0" y="23.5" width="254" height="21.5"/>
<fontDescription key="fontDescription" type="system" weight="heavy" pointSize="18"/>
<color key="textColor" red="0.23529411759999999" green="0.32549019610000002" blue="0.39607843139999999" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" text="Λήγει σε 4 ημέρες" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="qL0-3b-eqA">
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Λήγει σε 4 ημέρες" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="qL0-3b-eqA">
<rect key="frame" x="0.0" y="47" width="254" height="13.5"/>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="11"/>
<color key="textColor" red="0.2274509804" green="0.32156862749999998" blue="0.40000000000000002" alpha="1" colorSpace="calibratedRGB"/>
......@@ -1073,10 +1073,14 @@
<outlet property="couponEarnImage" destination="Vfg-nm-Igo" id="iLu-eS-mW3"/>
<outlet property="couponEarnLabel" destination="WdW-lP-g1v" id="GeT-9O-3ZD"/>
<outlet property="couponEarnView" destination="Fef-hi-2VL" id="XXW-N6-ouW"/>
<outlet property="couponEarnViewHeight" destination="9eX-HX-DsV" id="Vqq-R7-jLb"/>
<outlet property="couponEarnViewTopSpace" destination="Mwt-JX-Ol8" id="qSk-fY-Gbs"/>
<outlet property="dfyEarnAmountLabel" destination="AIw-YV-t1D" id="O7F-LB-2Kp"/>
<outlet property="dfyEarnBannerHeight" destination="9d9-gP-1Kb" id="lrl-g8-BVS"/>
<outlet property="dfyEarnBannerTopSpace" destination="o67-KC-ulO" id="sYD-lR-Kcn"/>
<outlet property="dfyEarnBannerView" destination="hdz-dS-6jm" id="vg1-ut-UxW"/>
<outlet property="dfyEarnImage" destination="3RL-2R-WXw" id="OsP-nb-KTP"/>
<outlet property="dfyEarnLabel" destination="h7B-UX-3wG" id="eW2-n0-5x5"/>
<outlet property="dfyEarnView" destination="EpZ-Qo-xby" id="HjN-zQ-3at"/>
<outlet property="dfyLogoImage" destination="gdf-s4-2CF" id="eGT-J8-7vO"/>
<outlet property="dfyLogoImageHeight" destination="Ch9-8X-FNJ" id="1f2-Tl-Ias"/>
<outlet property="dfyLogoImageTopSpace" destination="4FL-Zz-Okv" id="NJf-cd-AG2"/>
......
......@@ -14,11 +14,15 @@ import SwiftEventBus
@IBOutlet weak var profileImage: UIImageView!
@IBOutlet weak var profileNameLabel: UILabel!
@IBOutlet weak var questionnaireButton: UIButton!
@IBOutlet weak var dfyEarnView: UIView!
@IBOutlet weak var dfyEarnBannerView: UIView!
@IBOutlet weak var dfyEarnBannerHeight: NSLayoutConstraint!
@IBOutlet weak var dfyEarnBannerTopSpace: NSLayoutConstraint!
@IBOutlet weak var dfyEarnLabel: UILabel!
@IBOutlet weak var dfyEarnAmountLabel: UILabel!
@IBOutlet weak var dfyEarnImage: UIImageView!
@IBOutlet weak var couponEarnView: UIView!
@IBOutlet weak var couponEarnViewHeight: NSLayoutConstraint!
@IBOutlet weak var couponEarnViewTopSpace: NSLayoutConstraint!
@IBOutlet weak var couponEarnLabel: UILabel!
@IBOutlet weak var couponEarnAmountLabel: UILabel!
@IBOutlet weak var couponEarnImage: UIImageView!
......@@ -96,13 +100,24 @@ import SwiftEventBus
questionnaireButton.layer.cornerRadius = 7.0
dfyEarnView.layer.cornerRadius = 5.0
dfyEarnView.layer.shadowColor = UIColor(red: 0.00, green: 0.00, blue: 0.00, alpha: 0.16).cgColor
dfyEarnView.layer.shadowOffset = CGSize(width: 0.0, height: 3.0)
dfyEarnView.layer.shadowOpacity = 1.0
dfyEarnView.layer.shadowRadius = 3.0
dfyEarnBannerView.layer.cornerRadius = 5.0
dfyEarnBannerView.layer.shadowColor = UIColor(red: 0.00, green: 0.00, blue: 0.00, alpha: 0.16).cgColor
dfyEarnBannerView.layer.shadowOffset = CGSize(width: 0.0, height: 3.0)
dfyEarnBannerView.layer.shadowOpacity = 1.0
dfyEarnBannerView.layer.shadowRadius = 3.0
var totalCouponValue = swiftApi().getDealsCouponsSum()
if (totalCouponValue == 0.0) {
dfyEarnBannerView.isHidden = true
dfyEarnBannerHeight.constant = 0
dfyEarnBannerTopSpace.constant = 0
} else {
dfyEarnBannerView.isHidden = false
dfyEarnBannerHeight.constant = 75
dfyEarnBannerTopSpace.constant = 30
}
totalCouponValue = Float(round(100 * totalCouponValue) / 100)
var totalCouponValueString = "0"
totalCouponValueString = String(format: "%.2f", totalCouponValue).replacingOccurrences(of: ".", with: ",", options: .literal, range: nil)
......@@ -110,6 +125,16 @@ import SwiftEventBus
dfyEarnLabel.text = "Μέχρι τώρα έχεις κερδίσει " + totalCouponValueString + "€ με το DEALS for YOU!"
dfyEarnAmountLabel.text = totalCouponValueString + "€"
if (loyaltyBadge._couponCount == 0) {
couponEarnView.isHidden = true
couponEarnViewHeight.constant = 0
couponEarnViewTopSpace.constant = 0
} else {
couponEarnView.isHidden = false
couponEarnViewHeight.constant = 75
couponEarnViewTopSpace.constant = 30
}
couponEarnView.layer.cornerRadius = 5.0
couponEarnView.layer.shadowColor = UIColor(red: 0.00, green: 0.00, blue: 0.00, alpha: 0.16).cgColor
couponEarnView.layer.shadowOffset = CGSize(width: 0.0, height: 3.0)
......