Manos Chorianopoulos

add UnifiedCouponsVC empty view

...@@ -3180,13 +3180,13 @@ ...@@ -3180,13 +3180,13 @@
3180 <nil key="highlightedColor"/> 3180 <nil key="highlightedColor"/>
3181 </label> 3181 </label>
3182 <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" numberOfLines="4" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="jeN-eT-NTP"> 3182 <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" numberOfLines="4" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="jeN-eT-NTP">
3183 - <rect key="frame" x="292.5" y="25.5" width="81.5" height="14"/> 3183 + <rect key="frame" x="292.5" y="25" width="81.5" height="15"/>
3184 <fontDescription key="fontDescription" name="PeridotPE-Regular" family="Peridot PE" pointSize="12"/> 3184 <fontDescription key="fontDescription" name="PeridotPE-Regular" family="Peridot PE" pointSize="12"/>
3185 <color key="textColor" red="0.12941176469999999" green="0.12941176469999999" blue="0.12941176469999999" alpha="1" colorSpace="calibratedRGB"/> 3185 <color key="textColor" red="0.12941176469999999" green="0.12941176469999999" blue="0.12941176469999999" alpha="1" colorSpace="calibratedRGB"/>
3186 <nil key="highlightedColor"/> 3186 <nil key="highlightedColor"/>
3187 </label> 3187 </label>
3188 <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="wCr-ft-C3l"> 3188 <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="wCr-ft-C3l">
3189 - <rect key="frame" x="119" y="35.5" width="255" height="14"/> 3189 + <rect key="frame" x="119" y="34.5" width="255" height="15"/>
3190 <fontDescription key="fontDescription" name="PeridotPE-Regular" family="Peridot PE" pointSize="12"/> 3190 <fontDescription key="fontDescription" name="PeridotPE-Regular" family="Peridot PE" pointSize="12"/>
3191 <color key="textColor" red="0.12941176469999999" green="0.12941176469999999" blue="0.12941176469999999" alpha="1" colorSpace="calibratedRGB"/> 3191 <color key="textColor" red="0.12941176469999999" green="0.12941176469999999" blue="0.12941176469999999" alpha="1" colorSpace="calibratedRGB"/>
3192 <nil key="highlightedColor"/> 3192 <nil key="highlightedColor"/>
...@@ -3241,16 +3241,37 @@ ...@@ -3241,16 +3241,37 @@
3241 <outlet property="delegate" destination="3uV-Le-crf" id="3Mq-HR-Udb"/> 3241 <outlet property="delegate" destination="3uV-Le-crf" id="3Mq-HR-Udb"/>
3242 </connections> 3242 </connections>
3243 </tableView> 3243 </tableView>
3244 + <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="U5I-GH-geX">
3245 + <rect key="frame" x="20" y="0.0" width="374" height="0.0"/>
3246 + <subviews>
3247 + <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="VW1-eq-kSh">
3248 + <rect key="frame" x="0.0" y="30" width="374" height="18.5"/>
3249 + <fontDescription key="fontDescription" name="PeridotPE-Regular" family="Peridot PE" pointSize="15"/>
3250 + <color key="textColor" red="0.12941176469999999" green="0.12941176469999999" blue="0.12941176469999999" alpha="1" colorSpace="calibratedRGB"/>
3251 + <nil key="highlightedColor"/>
3252 + </label>
3253 + </subviews>
3254 + <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
3255 + <constraints>
3256 + <constraint firstAttribute="trailing" secondItem="VW1-eq-kSh" secondAttribute="trailing" id="CUA-sb-5E4"/>
3257 + <constraint firstAttribute="height" id="Ooe-1Z-EJ8"/>
3258 + <constraint firstItem="VW1-eq-kSh" firstAttribute="top" secondItem="U5I-GH-geX" secondAttribute="top" constant="30" id="WZg-A7-B3I"/>
3259 + <constraint firstItem="VW1-eq-kSh" firstAttribute="leading" secondItem="U5I-GH-geX" secondAttribute="leading" id="WjY-2G-56p"/>
3260 + </constraints>
3261 + </view>
3244 </subviews> 3262 </subviews>
3245 <color key="backgroundColor" red="0.94901960780000005" green="0.94901960780000005" blue="0.95294117649999999" alpha="1" colorSpace="calibratedRGB"/> 3263 <color key="backgroundColor" red="0.94901960780000005" green="0.94901960780000005" blue="0.95294117649999999" alpha="1" colorSpace="calibratedRGB"/>
3246 <constraints> 3264 <constraints>
3265 + <constraint firstItem="U5I-GH-geX" firstAttribute="top" secondItem="BQW-dX-NwZ" secondAttribute="top" id="0Sl-He-idh"/>
3247 <constraint firstAttribute="bottom" secondItem="YVv-xm-y2W" secondAttribute="bottom" id="2Sd-z8-rwY"/> 3266 <constraint firstAttribute="bottom" secondItem="YVv-xm-y2W" secondAttribute="bottom" id="2Sd-z8-rwY"/>
3248 <constraint firstAttribute="trailing" secondItem="YVv-xm-y2W" secondAttribute="trailing" id="38N-7Z-jr0"/> 3267 <constraint firstAttribute="trailing" secondItem="YVv-xm-y2W" secondAttribute="trailing" id="38N-7Z-jr0"/>
3249 <constraint firstItem="YVv-xm-y2W" firstAttribute="leading" secondItem="BQW-dX-NwZ" secondAttribute="leading" id="93P-If-3rc"/> 3268 <constraint firstItem="YVv-xm-y2W" firstAttribute="leading" secondItem="BQW-dX-NwZ" secondAttribute="leading" id="93P-If-3rc"/>
3250 <constraint firstAttribute="bottom" secondItem="QKV-Lk-E2a" secondAttribute="bottom" id="IeT-AJ-BlK"/> 3269 <constraint firstAttribute="bottom" secondItem="QKV-Lk-E2a" secondAttribute="bottom" id="IeT-AJ-BlK"/>
3251 <constraint firstItem="QKV-Lk-E2a" firstAttribute="top" secondItem="BQW-dX-NwZ" secondAttribute="top" id="TRn-cU-wHn"/> 3270 <constraint firstItem="QKV-Lk-E2a" firstAttribute="top" secondItem="BQW-dX-NwZ" secondAttribute="top" id="TRn-cU-wHn"/>
3271 + <constraint firstItem="U5I-GH-geX" firstAttribute="leading" secondItem="BQW-dX-NwZ" secondAttribute="leading" constant="20" id="U9E-ku-HqF"/>
3252 <constraint firstItem="YVv-xm-y2W" firstAttribute="top" secondItem="BQW-dX-NwZ" secondAttribute="top" constant="2" id="XeB-29-8xb"/> 3272 <constraint firstItem="YVv-xm-y2W" firstAttribute="top" secondItem="BQW-dX-NwZ" secondAttribute="top" constant="2" id="XeB-29-8xb"/>
3253 <constraint firstItem="QKV-Lk-E2a" firstAttribute="leading" secondItem="BQW-dX-NwZ" secondAttribute="leading" id="ZP8-kd-9RI"/> 3273 <constraint firstItem="QKV-Lk-E2a" firstAttribute="leading" secondItem="BQW-dX-NwZ" secondAttribute="leading" id="ZP8-kd-9RI"/>
3274 + <constraint firstAttribute="trailing" secondItem="U5I-GH-geX" secondAttribute="trailing" constant="20" id="ex6-de-ech"/>
3254 <constraint firstAttribute="trailing" secondItem="QKV-Lk-E2a" secondAttribute="trailing" id="tzT-5O-w7Q"/> 3275 <constraint firstAttribute="trailing" secondItem="QKV-Lk-E2a" secondAttribute="trailing" id="tzT-5O-w7Q"/>
3255 </constraints> 3276 </constraints>
3256 <variation key="default"> 3277 <variation key="default">
...@@ -3271,6 +3292,9 @@ ...@@ -3271,6 +3292,9 @@
3271 </view> 3292 </view>
3272 <connections> 3293 <connections>
3273 <outlet property="backgroundImage" destination="QKV-Lk-E2a" id="sWD-ra-Ek8"/> 3294 <outlet property="backgroundImage" destination="QKV-Lk-E2a" id="sWD-ra-Ek8"/>
3295 + <outlet property="emptyLabel" destination="VW1-eq-kSh" id="Lva-nM-uXu"/>
3296 + <outlet property="emptyView" destination="U5I-GH-geX" id="lhU-3z-yKl"/>
3297 + <outlet property="emptyViewHeight" destination="Ooe-1Z-EJ8" id="SRF-jF-7to"/>
3274 <outlet property="tableView" destination="YVv-xm-y2W" id="kle-or-Ckg"/> 3298 <outlet property="tableView" destination="YVv-xm-y2W" id="kle-or-Ckg"/>
3275 </connections> 3299 </connections>
3276 </viewController> 3300 </viewController>
......
...@@ -12,6 +12,9 @@ import SwiftEventBus ...@@ -12,6 +12,9 @@ import SwiftEventBus
12 @objc public class UnifiedCouponsViewController: UIViewController { 12 @objc public class UnifiedCouponsViewController: 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 unifiedCoupons:Array<swiftApi.UnifiedCouponModel> = [] 19 public var unifiedCoupons:Array<swiftApi.UnifiedCouponModel> = []
17 20
...@@ -25,6 +28,14 @@ import SwiftEventBus ...@@ -25,6 +28,14 @@ import SwiftEventBus
25 DispatchQueue.main.async { 28 DispatchQueue.main.async {
26 self.unifiedCoupons = swiftApi().getUnifiedCouponList() 29 self.unifiedCoupons = swiftApi().getUnifiedCouponList()
27 self.tableView.reloadData() 30 self.tableView.reloadData()
31 +
32 + if (self.unifiedCoupons.count == 0) {
33 + self.emptyView.isHidden = false
34 + self.emptyViewHeight.constant = self.emptyView.intrinsicContentSize.height
35 + } else {
36 + self.emptyView.isHidden = true
37 + self.emptyViewHeight.constant = 0
38 + }
28 } 39 }
29 } 40 }
30 41
...@@ -40,6 +51,8 @@ import SwiftEventBus ...@@ -40,6 +51,8 @@ import SwiftEventBus
40 // tableView.layer.cornerRadius = 30 51 // tableView.layer.cornerRadius = 30
41 // tableView.layer.maskedCorners = [ .layerMinXMinYCorner] // Top left corner radius 52 // tableView.layer.maskedCorners = [ .layerMinXMinYCorner] // Top left corner radius
42 tableView.contentInset.top = 30 53 tableView.contentInset.top = 30
54 +
55 + emptyLabel.text = "Αυτήν τη στιγμή δεν έχεις κάποιο ενεργό κουπόνι. Στην ενότητα FOR YOU μπορείς να βρεις κουπόνια αποκλειστικά για σένα!"
43 } 56 }
44 57
45 public override func viewWillAppear(_ animated: Bool) { 58 public override func viewWillAppear(_ animated: Bool) {
...@@ -50,6 +63,14 @@ import SwiftEventBus ...@@ -50,6 +63,14 @@ import SwiftEventBus
50 self.unifiedCoupons = swiftApi().getUnifiedCouponList() 63 self.unifiedCoupons = swiftApi().getUnifiedCouponList()
51 self.tableView.reloadData() 64 self.tableView.reloadData()
52 65
66 + if (self.unifiedCoupons.count == 0) {
67 + self.emptyView.isHidden = false
68 + self.emptyViewHeight.constant = self.emptyView.intrinsicContentSize.height
69 + } else {
70 + self.emptyView.isHidden = true
71 + self.emptyViewHeight.constant = 0
72 + }
73 +
53 self.navigationController?.hideHairline() 74 self.navigationController?.hideHairline()
54 } 75 }
55 76
......