Manos Chorianopoulos

add multiple dfyactiveCodes UI at WalletVC

...@@ -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>
......
...@@ -615,19 +615,19 @@ ...@@ -615,19 +615,19 @@
615 <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="2" translatesAutoresizingMaskIntoConstraints="NO" id="MCY-xv-vpg"> 615 <stackView opaque="NO" contentMode="scaleToFill" axis="vertical" spacing="2" translatesAutoresizingMaskIntoConstraints="NO" id="MCY-xv-vpg">
616 <rect key="frame" x="20" y="20" width="254" height="60.5"/> 616 <rect key="frame" x="20" y="20" width="254" height="60.5"/>
617 <subviews> 617 <subviews>
618 - <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"> 618 + <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">
619 <rect key="frame" x="0.0" y="0.0" width="254" height="21.5"/> 619 <rect key="frame" x="0.0" y="0.0" width="254" height="21.5"/>
620 <fontDescription key="fontDescription" type="system" weight="semibold" pointSize="18"/> 620 <fontDescription key="fontDescription" type="system" weight="semibold" pointSize="18"/>
621 <color key="textColor" red="0.23529411759999999" green="0.32549019610000002" blue="0.39607843139999999" alpha="1" colorSpace="calibratedRGB"/> 621 <color key="textColor" red="0.23529411759999999" green="0.32549019610000002" blue="0.39607843139999999" alpha="1" colorSpace="calibratedRGB"/>
622 <nil key="highlightedColor"/> 622 <nil key="highlightedColor"/>
623 </label> 623 </label>
624 - <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" text="961544809" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="qBe-Jw-QUx"> 624 + <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">
625 <rect key="frame" x="0.0" y="23.5" width="254" height="21.5"/> 625 <rect key="frame" x="0.0" y="23.5" width="254" height="21.5"/>
626 <fontDescription key="fontDescription" type="system" weight="heavy" pointSize="18"/> 626 <fontDescription key="fontDescription" type="system" weight="heavy" pointSize="18"/>
627 <color key="textColor" red="0.23529411759999999" green="0.32549019610000002" blue="0.39607843139999999" alpha="1" colorSpace="calibratedRGB"/> 627 <color key="textColor" red="0.23529411759999999" green="0.32549019610000002" blue="0.39607843139999999" alpha="1" colorSpace="calibratedRGB"/>
628 <nil key="highlightedColor"/> 628 <nil key="highlightedColor"/>
629 </label> 629 </label>
630 - <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"> 630 + <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">
631 <rect key="frame" x="0.0" y="47" width="254" height="13.5"/> 631 <rect key="frame" x="0.0" y="47" width="254" height="13.5"/>
632 <fontDescription key="fontDescription" type="system" weight="medium" pointSize="11"/> 632 <fontDescription key="fontDescription" type="system" weight="medium" pointSize="11"/>
633 <color key="textColor" red="0.2274509804" green="0.32156862749999998" blue="0.40000000000000002" alpha="1" colorSpace="calibratedRGB"/> 633 <color key="textColor" red="0.2274509804" green="0.32156862749999998" blue="0.40000000000000002" alpha="1" colorSpace="calibratedRGB"/>
...@@ -819,6 +819,7 @@ ...@@ -819,6 +819,7 @@
819 <outlet property="activeCodeLabel" destination="qBe-Jw-QUx" id="mlj-zT-T0Z"/> 819 <outlet property="activeCodeLabel" destination="qBe-Jw-QUx" id="mlj-zT-T0Z"/>
820 <outlet property="activeCodeView" destination="zFT-By-XHL" id="M0w-Ln-iC9"/> 820 <outlet property="activeCodeView" destination="zFT-By-XHL" id="M0w-Ln-iC9"/>
821 <outlet property="activeCodeViewHeight" destination="7r0-fu-7H9" id="nDr-bk-ViP"/> 821 <outlet property="activeCodeViewHeight" destination="7r0-fu-7H9" id="nDr-bk-ViP"/>
822 + <outlet property="activeCodesCountLabel" destination="ucC-u4-AQL" id="BCn-Ul-WqA"/>
822 <outlet property="couponEarnAmountLabel" destination="cbA-fm-1uO" id="o0w-tT-Etg"/> 823 <outlet property="couponEarnAmountLabel" destination="cbA-fm-1uO" id="o0w-tT-Etg"/>
823 <outlet property="couponEarnImage" destination="Vfg-nm-Igo" id="iLu-eS-mW3"/> 824 <outlet property="couponEarnImage" destination="Vfg-nm-Igo" id="iLu-eS-mW3"/>
824 <outlet property="couponEarnLabel" destination="WdW-lP-g1v" id="GeT-9O-3ZD"/> 825 <outlet property="couponEarnLabel" destination="WdW-lP-g1v" id="GeT-9O-3ZD"/>
......
...@@ -27,6 +27,7 @@ import SwiftEventBus ...@@ -27,6 +27,7 @@ import SwiftEventBus
27 @IBOutlet weak var dfyLogoImageHeight: NSLayoutConstraint! 27 @IBOutlet weak var dfyLogoImageHeight: NSLayoutConstraint!
28 @IBOutlet weak var activeCodeView: UIView! 28 @IBOutlet weak var activeCodeView: UIView!
29 @IBOutlet weak var activeCodeViewHeight: NSLayoutConstraint! 29 @IBOutlet weak var activeCodeViewHeight: NSLayoutConstraint!
30 + @IBOutlet weak var activeCodesCountLabel: UILabel!
30 @IBOutlet weak var activeCodeLabel: UILabel! 31 @IBOutlet weak var activeCodeLabel: UILabel!
31 @IBOutlet weak var activeCodeExpirationLabel: UILabel! 32 @IBOutlet weak var activeCodeExpirationLabel: UILabel!
32 @IBOutlet weak var tableView: UITableView! 33 @IBOutlet weak var tableView: UITableView!
...@@ -65,7 +66,7 @@ import SwiftEventBus ...@@ -65,7 +66,7 @@ import SwiftEventBus
65 } 66 }
66 67
67 let userTag = swiftApi().getUserTag() 68 let userTag = swiftApi().getUserTag()
68 - if (userTag != "") { 69 + if (userTag != "" && userTag != "undefined") {
69 questionnaireButton.setTitle(userTag, for: .normal) 70 questionnaireButton.setTitle(userTag, for: .normal)
70 questionnaireButton.titleLabel?.font = UIFont.systemFont(ofSize: 13, weight: .semibold) 71 questionnaireButton.titleLabel?.font = UIFont.systemFont(ofSize: 13, weight: .semibold)
71 questionnaireButton.setTitleColor(.white, for: .normal) 72 questionnaireButton.setTitleColor(.white, for: .normal)
...@@ -122,6 +123,7 @@ import SwiftEventBus ...@@ -122,6 +123,7 @@ import SwiftEventBus
122 activeCodeView.layer.shadowRadius = 6.0 123 activeCodeView.layer.shadowRadius = 6.0
123 124
124 if (dfyCoupons.count > 0) { 125 if (dfyCoupons.count > 0) {
126 + if (dfyCoupons.count == 1) {
125 let dateFormatter = DateFormatter() 127 let dateFormatter = DateFormatter()
126 dateFormatter.dateFormat = "yyyy-MM-dd hh:mm:ss" 128 dateFormatter.dateFormat = "yyyy-MM-dd hh:mm:ss"
127 129
...@@ -149,8 +151,31 @@ import SwiftEventBus ...@@ -149,8 +151,31 @@ import SwiftEventBus
149 daysFromNow = (components.day) != nil ? String(components.day ?? 0) : "" 151 daysFromNow = (components.day) != nil ? String(components.day ?? 0) : ""
150 } 152 }
151 153
154 + activeCodesCountLabel.text = "Ενεργός κωδικός:"
152 activeCodeLabel.text = dfyCoupons[0]._code 155 activeCodeLabel.text = dfyCoupons[0]._code
156 + // TODO: UNHIDE IT
157 + activeCodeExpirationLabel.isHidden = true
158 + if (daysFromNow == "1") {
159 + activeCodeExpirationLabel.text = "Λήγει σε " + daysFromNow + " ημέρα"
160 + } else {
153 activeCodeExpirationLabel.text = "Λήγει σε " + daysFromNow + " ημέρες" 161 activeCodeExpirationLabel.text = "Λήγει σε " + daysFromNow + " ημέρες"
162 + }
163 +
164 + } else {
165 + var couponCodesString = ""
166 + for (index, item) in dfyCoupons.enumerated() {
167 + if (index == (dfyCoupons.endIndex - 1)) {
168 + couponCodesString += String(item._code)
169 + } else {
170 + couponCodesString += String(item._code) + ", "
171 + }
172 +
173 + }
174 +
175 + activeCodesCountLabel.text = String(dfyCoupons.count) + " Ενεργοί κωδικοί:"
176 + activeCodeLabel.text = couponCodesString
177 + activeCodeExpirationLabel.isHidden = true
178 + }
154 } else { 179 } else {
155 activeCodeLabel.text = "-" 180 activeCodeLabel.text = "-"
156 activeCodeExpirationLabel.text = "" 181 activeCodeExpirationLabel.text = ""
...@@ -169,7 +194,7 @@ import SwiftEventBus ...@@ -169,7 +194,7 @@ import SwiftEventBus
169 194
170 let userTag = swiftApi().getUserTag() 195 let userTag = swiftApi().getUserTag()
171 if (questionnaireButton.currentTitle != userTag) { 196 if (questionnaireButton.currentTitle != userTag) {
172 - if (userTag != "") { 197 + if (userTag != "" && userTag != "undefined") {
173 questionnaireButton.setTitle(userTag, for: .normal) 198 questionnaireButton.setTitle(userTag, for: .normal)
174 questionnaireButton.titleLabel?.font = UIFont.systemFont(ofSize: 13, weight: .semibold) 199 questionnaireButton.titleLabel?.font = UIFont.systemFont(ofSize: 13, weight: .semibold)
175 questionnaireButton.setTitleColor(.white, for: .normal) 200 questionnaireButton.setTitleColor(.white, for: .normal)
......