Showing
5 changed files
with
47 additions
and
2 deletions
... | @@ -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>1</integer> | 10 | + <integer>0</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>0</integer> | 10 | + <integer>1</integer> |
11 | </dict> | 11 | </dict> |
12 | </dict> | 12 | </dict> |
13 | </dict> | 13 | </dict> | ... | ... |
No preview for this file type
... | @@ -12,6 +12,9 @@ import SwiftEventBus | ... | @@ -12,6 +12,9 @@ import SwiftEventBus |
12 | @objc public class CouponsViewController: UIViewController { | 12 | @objc public class CouponsViewController: UIViewController { |
13 | @IBOutlet weak var backgroundImage: UIImageView! | 13 | @IBOutlet weak var backgroundImage: UIImageView! |
14 | @IBOutlet weak var tableView: UITableView! | 14 | @IBOutlet weak var tableView: UITableView! |
15 | + @IBOutlet weak var emptyView: UIView! | ||
16 | + @IBOutlet weak var emptyViewHeight: NSLayoutConstraint! | ||
17 | + @IBOutlet weak var emptyLabel: UILabel! | ||
15 | 18 | ||
16 | public var coupons:Array<swiftApi.CouponItemModel> = [] | 19 | public var coupons:Array<swiftApi.CouponItemModel> = [] |
17 | 20 | ||
... | @@ -34,6 +37,8 @@ import SwiftEventBus | ... | @@ -34,6 +37,8 @@ import SwiftEventBus |
34 | // tableView.layer.cornerRadius = 30 | 37 | // tableView.layer.cornerRadius = 30 |
35 | // tableView.layer.maskedCorners = [ .layerMinXMinYCorner] // Top left corner radius | 38 | // tableView.layer.maskedCorners = [ .layerMinXMinYCorner] // Top left corner radius |
36 | tableView.contentInset.top = 30 | 39 | tableView.contentInset.top = 30 |
40 | + | ||
41 | + emptyLabel.text = "Αυτήν τη στιγμή δεν έχεις κάποιο ενεργό κουπόνι. Στην ενότητα FOR YOU μπορείς να βρεις κουπόνια αποκλειστικά για σένα!" | ||
37 | } | 42 | } |
38 | 43 | ||
39 | public override func viewWillAppear(_ animated: Bool) { | 44 | public override func viewWillAppear(_ animated: Bool) { |
... | @@ -44,6 +49,14 @@ import SwiftEventBus | ... | @@ -44,6 +49,14 @@ import SwiftEventBus |
44 | self.coupons = swiftApi().getCouponList() | 49 | self.coupons = swiftApi().getCouponList() |
45 | self.tableView.reloadData() | 50 | self.tableView.reloadData() |
46 | 51 | ||
52 | + if (self.coupons.count == 0) { | ||
53 | + self.emptyView.isHidden = false | ||
54 | + self.emptyViewHeight.constant = self.emptyView.intrinsicContentSize.height | ||
55 | + } else { | ||
56 | + self.emptyView.isHidden = true | ||
57 | + self.emptyViewHeight.constant = 0 | ||
58 | + } | ||
59 | + | ||
47 | self.navigationController?.hideHairline() | 60 | self.navigationController?.hideHairline() |
48 | } | 61 | } |
49 | 62 | ||
... | @@ -64,6 +77,14 @@ import SwiftEventBus | ... | @@ -64,6 +77,14 @@ import SwiftEventBus |
64 | DispatchQueue.main.async { | 77 | DispatchQueue.main.async { |
65 | SwiftEventBus.post("coupons_fetched") | 78 | SwiftEventBus.post("coupons_fetched") |
66 | self.tableView.reloadData() | 79 | self.tableView.reloadData() |
80 | + | ||
81 | + if (self.coupons.count == 0) { | ||
82 | + self.emptyView.isHidden = false | ||
83 | + self.emptyViewHeight.constant = self.emptyView.intrinsicContentSize.height | ||
84 | + } else { | ||
85 | + self.emptyView.isHidden = true | ||
86 | + self.emptyViewHeight.constant = 0 | ||
87 | + } | ||
67 | } | 88 | } |
68 | } else { | 89 | } else { |
69 | self.coupons = [] | 90 | self.coupons = [] | ... | ... |
... | @@ -162,14 +162,35 @@ | ... | @@ -162,14 +162,35 @@ |
162 | <outlet property="delegate" destination="UpJ-ey-hJ5" id="lXT-i0-gPS"/> | 162 | <outlet property="delegate" destination="UpJ-ey-hJ5" id="lXT-i0-gPS"/> |
163 | </connections> | 163 | </connections> |
164 | </tableView> | 164 | </tableView> |
165 | + <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="pdh-2h-vVS"> | ||
166 | + <rect key="frame" x="20" y="0.0" width="374" height="0.0"/> | ||
167 | + <subviews> | ||
168 | + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="xtj-PD-xx6"> | ||
169 | + <rect key="frame" x="0.0" y="30" width="374" height="18.5"/> | ||
170 | + <fontDescription key="fontDescription" name="PeridotPE-Regular" family="Peridot PE" pointSize="15"/> | ||
171 | + <color key="textColor" red="0.12941176469999999" green="0.12941176469999999" blue="0.12941176469999999" alpha="1" colorSpace="calibratedRGB"/> | ||
172 | + <nil key="highlightedColor"/> | ||
173 | + </label> | ||
174 | + </subviews> | ||
175 | + <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> | ||
176 | + <constraints> | ||
177 | + <constraint firstAttribute="height" id="CMi-78-cNv"/> | ||
178 | + <constraint firstAttribute="trailing" secondItem="xtj-PD-xx6" secondAttribute="trailing" id="Y5v-ib-fY7"/> | ||
179 | + <constraint firstItem="xtj-PD-xx6" firstAttribute="leading" secondItem="pdh-2h-vVS" secondAttribute="leading" id="i0h-zC-keQ"/> | ||
180 | + <constraint firstItem="xtj-PD-xx6" firstAttribute="top" secondItem="pdh-2h-vVS" secondAttribute="top" constant="30" id="lR8-Ro-Dx1"/> | ||
181 | + </constraints> | ||
182 | + </view> | ||
165 | </subviews> | 183 | </subviews> |
166 | <color key="backgroundColor" red="0.94901960784313721" green="0.94901960784313721" blue="0.95294117647058818" alpha="1" colorSpace="calibratedRGB"/> | 184 | <color key="backgroundColor" red="0.94901960784313721" green="0.94901960784313721" blue="0.95294117647058818" alpha="1" colorSpace="calibratedRGB"/> |
167 | <constraints> | 185 | <constraints> |
186 | + <constraint firstItem="pdh-2h-vVS" firstAttribute="top" secondItem="FoX-v7-tak" secondAttribute="top" id="7Sy-Ik-hSl"/> | ||
168 | <constraint firstItem="KhH-tg-FBN" firstAttribute="top" secondItem="FoX-v7-tak" secondAttribute="top" constant="2" id="DSl-zy-v7y"/> | 187 | <constraint firstItem="KhH-tg-FBN" firstAttribute="top" secondItem="FoX-v7-tak" secondAttribute="top" constant="2" id="DSl-zy-v7y"/> |
169 | <constraint firstAttribute="bottom" secondItem="KhH-tg-FBN" secondAttribute="bottom" id="Dk8-ID-x8T"/> | 188 | <constraint firstAttribute="bottom" secondItem="KhH-tg-FBN" secondAttribute="bottom" id="Dk8-ID-x8T"/> |
170 | <constraint firstItem="5rB-1e-ygb" firstAttribute="top" secondItem="FoX-v7-tak" secondAttribute="top" id="R4t-dF-JMv"/> | 189 | <constraint firstItem="5rB-1e-ygb" firstAttribute="top" secondItem="FoX-v7-tak" secondAttribute="top" id="R4t-dF-JMv"/> |
171 | <constraint firstItem="5rB-1e-ygb" firstAttribute="leading" secondItem="FoX-v7-tak" secondAttribute="leading" id="Yyu-T7-XaB"/> | 190 | <constraint firstItem="5rB-1e-ygb" firstAttribute="leading" secondItem="FoX-v7-tak" secondAttribute="leading" id="Yyu-T7-XaB"/> |
191 | + <constraint firstAttribute="trailing" secondItem="pdh-2h-vVS" secondAttribute="trailing" constant="20" id="b5E-7L-rab"/> | ||
172 | <constraint firstAttribute="trailing" secondItem="5rB-1e-ygb" secondAttribute="trailing" id="h1f-x6-eGo"/> | 192 | <constraint firstAttribute="trailing" secondItem="5rB-1e-ygb" secondAttribute="trailing" id="h1f-x6-eGo"/> |
193 | + <constraint firstItem="pdh-2h-vVS" firstAttribute="leading" secondItem="FoX-v7-tak" secondAttribute="leading" constant="20" id="kkR-L1-aiu"/> | ||
173 | <constraint firstAttribute="bottom" secondItem="5rB-1e-ygb" secondAttribute="bottom" id="mFa-RR-qQj"/> | 194 | <constraint firstAttribute="bottom" secondItem="5rB-1e-ygb" secondAttribute="bottom" id="mFa-RR-qQj"/> |
174 | <constraint firstItem="KhH-tg-FBN" firstAttribute="leading" secondItem="FoX-v7-tak" secondAttribute="leading" id="oXI-zv-0nB"/> | 195 | <constraint firstItem="KhH-tg-FBN" firstAttribute="leading" secondItem="FoX-v7-tak" secondAttribute="leading" id="oXI-zv-0nB"/> |
175 | <constraint firstAttribute="trailing" secondItem="KhH-tg-FBN" secondAttribute="trailing" id="tAn-PH-mZ8"/> | 196 | <constraint firstAttribute="trailing" secondItem="KhH-tg-FBN" secondAttribute="trailing" id="tAn-PH-mZ8"/> |
... | @@ -193,6 +214,9 @@ | ... | @@ -193,6 +214,9 @@ |
193 | <navigationItem key="navigationItem" id="mr8-UG-4rX"/> | 214 | <navigationItem key="navigationItem" id="mr8-UG-4rX"/> |
194 | <connections> | 215 | <connections> |
195 | <outlet property="backgroundImage" destination="5rB-1e-ygb" id="Nxt-Pj-vLK"/> | 216 | <outlet property="backgroundImage" destination="5rB-1e-ygb" id="Nxt-Pj-vLK"/> |
217 | + <outlet property="emptyLabel" destination="xtj-PD-xx6" id="9JM-Kf-e0g"/> | ||
218 | + <outlet property="emptyView" destination="pdh-2h-vVS" id="E7E-54-sSD"/> | ||
219 | + <outlet property="emptyViewHeight" destination="CMi-78-cNv" id="IqX-OJ-1Pb"/> | ||
196 | <outlet property="tableView" destination="KhH-tg-FBN" id="EJH-sF-YPj"/> | 220 | <outlet property="tableView" destination="KhH-tg-FBN" id="EJH-sF-YPj"/> |
197 | </connections> | 221 | </connections> |
198 | </viewController> | 222 | </viewController> | ... | ... |
-
Please register or login to post a comment