Manos Chorianopoulos

hide empty banners at WalletViewController

...@@ -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>
......
...@@ -864,19 +864,19 @@ ...@@ -864,19 +864,19 @@
864 <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="2" translatesAutoresizingMaskIntoConstraints="NO" id="MCY-xv-vpg"> 864 <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="2" translatesAutoresizingMaskIntoConstraints="NO" id="MCY-xv-vpg">
865 <rect key="frame" x="20" y="20" width="254" height="60.5"/> 865 <rect key="frame" x="20" y="20" width="254" height="60.5"/>
866 <subviews> 866 <subviews>
867 - <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"> 867 + <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">
868 <rect key="frame" x="0.0" y="0.0" width="254" height="21.5"/> 868 <rect key="frame" x="0.0" y="0.0" width="254" height="21.5"/>
869 <fontDescription key="fontDescription" type="system" weight="semibold" pointSize="18"/> 869 <fontDescription key="fontDescription" type="system" weight="semibold" pointSize="18"/>
870 <color key="textColor" red="0.23529411759999999" green="0.32549019610000002" blue="0.39607843139999999" alpha="1" colorSpace="calibratedRGB"/> 870 <color key="textColor" red="0.23529411759999999" green="0.32549019610000002" blue="0.39607843139999999" alpha="1" colorSpace="calibratedRGB"/>
871 <nil key="highlightedColor"/> 871 <nil key="highlightedColor"/>
872 </label> 872 </label>
873 - <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"> 873 + <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">
874 <rect key="frame" x="0.0" y="23.5" width="254" height="21.5"/> 874 <rect key="frame" x="0.0" y="23.5" width="254" height="21.5"/>
875 <fontDescription key="fontDescription" type="system" weight="heavy" pointSize="18"/> 875 <fontDescription key="fontDescription" type="system" weight="heavy" pointSize="18"/>
876 <color key="textColor" red="0.23529411759999999" green="0.32549019610000002" blue="0.39607843139999999" alpha="1" colorSpace="calibratedRGB"/> 876 <color key="textColor" red="0.23529411759999999" green="0.32549019610000002" blue="0.39607843139999999" alpha="1" colorSpace="calibratedRGB"/>
877 <nil key="highlightedColor"/> 877 <nil key="highlightedColor"/>
878 </label> 878 </label>
879 - <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"> 879 + <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">
880 <rect key="frame" x="0.0" y="47" width="254" height="13.5"/> 880 <rect key="frame" x="0.0" y="47" width="254" height="13.5"/>
881 <fontDescription key="fontDescription" type="system" weight="medium" pointSize="11"/> 881 <fontDescription key="fontDescription" type="system" weight="medium" pointSize="11"/>
882 <color key="textColor" red="0.2274509804" green="0.32156862749999998" blue="0.40000000000000002" alpha="1" colorSpace="calibratedRGB"/> 882 <color key="textColor" red="0.2274509804" green="0.32156862749999998" blue="0.40000000000000002" alpha="1" colorSpace="calibratedRGB"/>
...@@ -1073,10 +1073,14 @@ ...@@ -1073,10 +1073,14 @@
1073 <outlet property="couponEarnImage" destination="Vfg-nm-Igo" id="iLu-eS-mW3"/> 1073 <outlet property="couponEarnImage" destination="Vfg-nm-Igo" id="iLu-eS-mW3"/>
1074 <outlet property="couponEarnLabel" destination="WdW-lP-g1v" id="GeT-9O-3ZD"/> 1074 <outlet property="couponEarnLabel" destination="WdW-lP-g1v" id="GeT-9O-3ZD"/>
1075 <outlet property="couponEarnView" destination="Fef-hi-2VL" id="XXW-N6-ouW"/> 1075 <outlet property="couponEarnView" destination="Fef-hi-2VL" id="XXW-N6-ouW"/>
1076 + <outlet property="couponEarnViewHeight" destination="9eX-HX-DsV" id="Vqq-R7-jLb"/>
1077 + <outlet property="couponEarnViewTopSpace" destination="Mwt-JX-Ol8" id="qSk-fY-Gbs"/>
1076 <outlet property="dfyEarnAmountLabel" destination="AIw-YV-t1D" id="O7F-LB-2Kp"/> 1078 <outlet property="dfyEarnAmountLabel" destination="AIw-YV-t1D" id="O7F-LB-2Kp"/>
1079 + <outlet property="dfyEarnBannerHeight" destination="9d9-gP-1Kb" id="lrl-g8-BVS"/>
1080 + <outlet property="dfyEarnBannerTopSpace" destination="o67-KC-ulO" id="sYD-lR-Kcn"/>
1081 + <outlet property="dfyEarnBannerView" destination="hdz-dS-6jm" id="vg1-ut-UxW"/>
1077 <outlet property="dfyEarnImage" destination="3RL-2R-WXw" id="OsP-nb-KTP"/> 1082 <outlet property="dfyEarnImage" destination="3RL-2R-WXw" id="OsP-nb-KTP"/>
1078 <outlet property="dfyEarnLabel" destination="h7B-UX-3wG" id="eW2-n0-5x5"/> 1083 <outlet property="dfyEarnLabel" destination="h7B-UX-3wG" id="eW2-n0-5x5"/>
1079 - <outlet property="dfyEarnView" destination="EpZ-Qo-xby" id="HjN-zQ-3at"/>
1080 <outlet property="dfyLogoImage" destination="gdf-s4-2CF" id="eGT-J8-7vO"/> 1084 <outlet property="dfyLogoImage" destination="gdf-s4-2CF" id="eGT-J8-7vO"/>
1081 <outlet property="dfyLogoImageHeight" destination="Ch9-8X-FNJ" id="1f2-Tl-Ias"/> 1085 <outlet property="dfyLogoImageHeight" destination="Ch9-8X-FNJ" id="1f2-Tl-Ias"/>
1082 <outlet property="dfyLogoImageTopSpace" destination="4FL-Zz-Okv" id="NJf-cd-AG2"/> 1086 <outlet property="dfyLogoImageTopSpace" destination="4FL-Zz-Okv" id="NJf-cd-AG2"/>
......
...@@ -14,11 +14,15 @@ import SwiftEventBus ...@@ -14,11 +14,15 @@ import SwiftEventBus
14 @IBOutlet weak var profileImage: UIImageView! 14 @IBOutlet weak var profileImage: UIImageView!
15 @IBOutlet weak var profileNameLabel: UILabel! 15 @IBOutlet weak var profileNameLabel: UILabel!
16 @IBOutlet weak var questionnaireButton: UIButton! 16 @IBOutlet weak var questionnaireButton: UIButton!
17 - @IBOutlet weak var dfyEarnView: UIView! 17 + @IBOutlet weak var dfyEarnBannerView: UIView!
18 + @IBOutlet weak var dfyEarnBannerHeight: NSLayoutConstraint!
19 + @IBOutlet weak var dfyEarnBannerTopSpace: NSLayoutConstraint!
18 @IBOutlet weak var dfyEarnLabel: UILabel! 20 @IBOutlet weak var dfyEarnLabel: UILabel!
19 @IBOutlet weak var dfyEarnAmountLabel: UILabel! 21 @IBOutlet weak var dfyEarnAmountLabel: UILabel!
20 @IBOutlet weak var dfyEarnImage: UIImageView! 22 @IBOutlet weak var dfyEarnImage: UIImageView!
21 @IBOutlet weak var couponEarnView: UIView! 23 @IBOutlet weak var couponEarnView: UIView!
24 + @IBOutlet weak var couponEarnViewHeight: NSLayoutConstraint!
25 + @IBOutlet weak var couponEarnViewTopSpace: NSLayoutConstraint!
22 @IBOutlet weak var couponEarnLabel: UILabel! 26 @IBOutlet weak var couponEarnLabel: UILabel!
23 @IBOutlet weak var couponEarnAmountLabel: UILabel! 27 @IBOutlet weak var couponEarnAmountLabel: UILabel!
24 @IBOutlet weak var couponEarnImage: UIImageView! 28 @IBOutlet weak var couponEarnImage: UIImageView!
...@@ -96,19 +100,40 @@ import SwiftEventBus ...@@ -96,19 +100,40 @@ import SwiftEventBus
96 100
97 questionnaireButton.layer.cornerRadius = 7.0 101 questionnaireButton.layer.cornerRadius = 7.0
98 102
99 - dfyEarnView.layer.cornerRadius = 5.0 103 + dfyEarnBannerView.layer.cornerRadius = 5.0
100 - dfyEarnView.layer.shadowColor = UIColor(red: 0.00, green: 0.00, blue: 0.00, alpha: 0.16).cgColor 104 + dfyEarnBannerView.layer.shadowColor = UIColor(red: 0.00, green: 0.00, blue: 0.00, alpha: 0.16).cgColor
101 - dfyEarnView.layer.shadowOffset = CGSize(width: 0.0, height: 3.0) 105 + dfyEarnBannerView.layer.shadowOffset = CGSize(width: 0.0, height: 3.0)
102 - dfyEarnView.layer.shadowOpacity = 1.0 106 + dfyEarnBannerView.layer.shadowOpacity = 1.0
103 - dfyEarnView.layer.shadowRadius = 3.0 107 + dfyEarnBannerView.layer.shadowRadius = 3.0
104 108
105 var totalCouponValue = swiftApi().getDealsCouponsSum() 109 var totalCouponValue = swiftApi().getDealsCouponsSum()
110 +
111 + if (totalCouponValue == 0.0) {
112 + dfyEarnBannerView.isHidden = true
113 + dfyEarnBannerHeight.constant = 0
114 + dfyEarnBannerTopSpace.constant = 0
115 + } else {
116 + dfyEarnBannerView.isHidden = false
117 + dfyEarnBannerHeight.constant = 75
118 + dfyEarnBannerTopSpace.constant = 30
119 + }
120 +
106 totalCouponValue = Float(round(100 * totalCouponValue) / 100) 121 totalCouponValue = Float(round(100 * totalCouponValue) / 100)
107 var totalCouponValueString = "0" 122 var totalCouponValueString = "0"
108 totalCouponValueString = String(format: "%.2f", totalCouponValue).replacingOccurrences(of: ".", with: ",", options: .literal, range: nil) 123 totalCouponValueString = String(format: "%.2f", totalCouponValue).replacingOccurrences(of: ".", with: ",", options: .literal, range: nil)
109 124
110 dfyEarnLabel.text = "Μέχρι τώρα έχεις κερδίσει " + totalCouponValueString + "€ με το DEALS for YOU!" 125 dfyEarnLabel.text = "Μέχρι τώρα έχεις κερδίσει " + totalCouponValueString + "€ με το DEALS for YOU!"
111 dfyEarnAmountLabel.text = totalCouponValueString + "€" 126 dfyEarnAmountLabel.text = totalCouponValueString + "€"
127 +
128 + if (loyaltyBadge._couponCount == 0) {
129 + couponEarnView.isHidden = true
130 + couponEarnViewHeight.constant = 0
131 + couponEarnViewTopSpace.constant = 0
132 + } else {
133 + couponEarnView.isHidden = false
134 + couponEarnViewHeight.constant = 75
135 + couponEarnViewTopSpace.constant = 30
136 + }
112 137
113 couponEarnView.layer.cornerRadius = 5.0 138 couponEarnView.layer.cornerRadius = 5.0
114 couponEarnView.layer.shadowColor = UIColor(red: 0.00, green: 0.00, blue: 0.00, alpha: 0.16).cgColor 139 couponEarnView.layer.shadowColor = UIColor(red: 0.00, green: 0.00, blue: 0.00, alpha: 0.16).cgColor
......