Manos Chorianopoulos

Add Unified Coupons discount value at My Rewards

...@@ -2278,7 +2278,7 @@ ...@@ -2278,7 +2278,7 @@
2278 <color key="textColor" red="0.12941176470588234" green="0.12941176470588234" blue="0.12941176470588234" alpha="1" colorSpace="calibratedRGB"/> 2278 <color key="textColor" red="0.12941176470588234" green="0.12941176470588234" blue="0.12941176470588234" alpha="1" colorSpace="calibratedRGB"/>
2279 <nil key="highlightedColor"/> 2279 <nil key="highlightedColor"/>
2280 </label> 2280 </label>
2281 - <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" numberOfLines="3" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="KJD-Db-B4t"> 2281 + <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" numberOfLines="4" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="KJD-Db-B4t">
2282 <rect key="frame" x="292.5" y="25" width="81.5" height="15"/> 2282 <rect key="frame" x="292.5" y="25" width="81.5" height="15"/>
2283 <fontDescription key="fontDescription" name="PeridotPE-Regular" family="Peridot PE" pointSize="12"/> 2283 <fontDescription key="fontDescription" name="PeridotPE-Regular" family="Peridot PE" pointSize="12"/>
2284 <color key="textColor" red="0.12941176470588234" green="0.12941176470588234" blue="0.12941176470588234" alpha="1" colorSpace="calibratedRGB"/> 2284 <color key="textColor" red="0.12941176470588234" green="0.12941176470588234" blue="0.12941176470588234" alpha="1" colorSpace="calibratedRGB"/>
...@@ -2335,23 +2335,23 @@ ...@@ -2335,23 +2335,23 @@
2335 </connections> 2335 </connections>
2336 </tableViewCell> 2336 </tableViewCell>
2337 <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="none" indentationWidth="10" reuseIdentifier="WalletBadgesTableViewCellId" id="TeS-tP-Ilh" customClass="WalletBadgesTableViewCell" customModule="SwiftWarplyFramework"> 2337 <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="none" indentationWidth="10" reuseIdentifier="WalletBadgesTableViewCellId" id="TeS-tP-Ilh" customClass="WalletBadgesTableViewCell" customModule="SwiftWarplyFramework">
2338 - <rect key="frame" x="0.0" y="947.5" width="414" height="44"/> 2338 + <rect key="frame" x="0.0" y="947.5" width="414" height="260"/>
2339 <autoresizingMask key="autoresizingMask"/> 2339 <autoresizingMask key="autoresizingMask"/>
2340 <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="TeS-tP-Ilh" id="FFV-uA-HHA"> 2340 <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="TeS-tP-Ilh" id="FFV-uA-HHA">
2341 - <rect key="frame" x="0.0" y="0.0" width="414" height="44"/> 2341 + <rect key="frame" x="0.0" y="0.0" width="414" height="260"/>
2342 <autoresizingMask key="autoresizingMask"/> 2342 <autoresizingMask key="autoresizingMask"/>
2343 <subviews> 2343 <subviews>
2344 <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="AV7-t1-eK0"> 2344 <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="AV7-t1-eK0">
2345 - <rect key="frame" x="0.0" y="0.0" width="414" height="44"/> 2345 + <rect key="frame" x="0.0" y="0.0" width="414" height="260"/>
2346 <subviews> 2346 <subviews>
2347 <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="COSMOTE Επιβράβευση" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Z0E-V6-vKD"> 2347 <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="COSMOTE Επιβράβευση" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Z0E-V6-vKD">
2348 - <rect key="frame" x="20" y="30" width="374" height="0.0"/> 2348 + <rect key="frame" x="20" y="30" width="374" height="21"/>
2349 <fontDescription key="fontDescription" name="PFSquareSansPro-Medium" family="PF Square Sans Pro" pointSize="21"/> 2349 <fontDescription key="fontDescription" name="PFSquareSansPro-Medium" family="PF Square Sans Pro" pointSize="21"/>
2350 <color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> 2350 <color key="textColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
2351 <nil key="highlightedColor"/> 2351 <nil key="highlightedColor"/>
2352 </label> 2352 </label>
2353 <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="kge-nO-6ZA" userLabel="BadgesView"> 2353 <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="kge-nO-6ZA" userLabel="BadgesView">
2354 - <rect key="frame" x="0.0" y="44" width="414" height="0.0"/> 2354 + <rect key="frame" x="0.0" y="65" width="414" height="195"/>
2355 <subviews> 2355 <subviews>
2356 <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="wallet_badge_lines" translatesAutoresizingMaskIntoConstraints="NO" id="Cib-tj-hT7"> 2356 <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="wallet_badge_lines" translatesAutoresizingMaskIntoConstraints="NO" id="Cib-tj-hT7">
2357 <rect key="frame" x="7" y="50" width="400" height="80"/> 2357 <rect key="frame" x="7" y="50" width="400" height="80"/>
...@@ -2429,19 +2429,19 @@ ...@@ -2429,19 +2429,19 @@
2429 </constraints> 2429 </constraints>
2430 </view> 2430 </view>
2431 <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Qge-34-vJ3"> 2431 <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Qge-34-vJ3">
2432 - <rect key="frame" x="169.5" y="120" width="75" height="73"/> 2432 + <rect key="frame" x="169.5" y="120" width="75" height="75"/>
2433 <subviews> 2433 <subviews>
2434 <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="wallet_dfy_earn" translatesAutoresizingMaskIntoConstraints="NO" id="gGn-2u-akB"> 2434 <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="wallet_dfy_earn" translatesAutoresizingMaskIntoConstraints="NO" id="gGn-2u-akB">
2435 - <rect key="frame" x="0.0" y="0.0" width="75" height="73"/> 2435 + <rect key="frame" x="0.0" y="0.0" width="75" height="75"/>
2436 </imageView> 2436 </imageView>
2437 <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="0,00€" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="8JV-5a-Jar"> 2437 <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="0,00€" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="8JV-5a-Jar">
2438 - <rect key="frame" x="5" y="44" width="65" height="11"/> 2438 + <rect key="frame" x="5" y="46" width="65" height="11"/>
2439 <fontDescription key="fontDescription" name="PFSquareSansPro-ExtraBlack" family="PF Square Sans Pro" pointSize="11"/> 2439 <fontDescription key="fontDescription" name="PFSquareSansPro-ExtraBlack" family="PF Square Sans Pro" pointSize="11"/>
2440 <color key="textColor" red="0.25490196079999999" green="0.33333333329999998" blue="0.3921568627" alpha="1" colorSpace="calibratedRGB"/> 2440 <color key="textColor" red="0.25490196079999999" green="0.33333333329999998" blue="0.3921568627" alpha="1" colorSpace="calibratedRGB"/>
2441 <nil key="highlightedColor"/> 2441 <nil key="highlightedColor"/>
2442 </label> 2442 </label>
2443 <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="6UC-iU-ey4"> 2443 <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="6UC-iU-ey4">
2444 - <rect key="frame" x="0.0" y="0.0" width="75" height="73"/> 2444 + <rect key="frame" x="0.0" y="0.0" width="75" height="75"/>
2445 <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> 2445 <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
2446 <state key="normal" title="Button"/> 2446 <state key="normal" title="Button"/>
2447 <buttonConfiguration key="configuration" style="plain" title="Button"> 2447 <buttonConfiguration key="configuration" style="plain" title="Button">
...@@ -2562,7 +2562,7 @@ ...@@ -2562,7 +2562,7 @@
2562 </connections> 2562 </connections>
2563 </tableViewCell> 2563 </tableViewCell>
2564 <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="none" indentationWidth="10" reuseIdentifier="WalletBannersTableViewCellId" id="fgI-zL-RPZ" customClass="WalletBannersTableViewCell" customModule="SwiftWarplyFramework"> 2564 <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="none" indentationWidth="10" reuseIdentifier="WalletBannersTableViewCellId" id="fgI-zL-RPZ" customClass="WalletBannersTableViewCell" customModule="SwiftWarplyFramework">
2565 - <rect key="frame" x="0.0" y="991.5" width="414" height="404"/> 2565 + <rect key="frame" x="0.0" y="1207.5" width="414" height="404"/>
2566 <autoresizingMask key="autoresizingMask"/> 2566 <autoresizingMask key="autoresizingMask"/>
2567 <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="fgI-zL-RPZ" id="gNB-PU-R1J"> 2567 <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="fgI-zL-RPZ" id="gNB-PU-R1J">
2568 <rect key="frame" x="0.0" y="0.0" width="414" height="404"/> 2568 <rect key="frame" x="0.0" y="0.0" width="414" height="404"/>
......
...@@ -55,7 +55,7 @@ import AVFoundation ...@@ -55,7 +55,7 @@ import AVFoundation
55 couponImageHeight.constant = 255 //230 // 253 // self.uiscreen.height * 0.25 55 couponImageHeight.constant = 255 //230 // 253 // self.uiscreen.height * 0.25
56 56
57 nameLabel.text = "Εκπτωτικό κουπόνι COSMOTE SuperMarket Deals!" 57 nameLabel.text = "Εκπτωτικό κουπόνι COSMOTE SuperMarket Deals!"
58 - discriptionLabel.text = "Χρησιμοποίησε τον παρακάτω κωδικό και πάρε έκπτωση στα ενεργά κουπόνια προσφορών." 58 +// discriptionLabel.text = "Χρησιμοποίησε τον παρακάτω κωδικό και πάρε έκπτωση στα ενεργά κουπόνια προσφορών."
59 59
60 merchantDescrTextView.text = "" 60 merchantDescrTextView.text = ""
61 merchantDescrTextViewTopSpace.constant = CGFloat(0) 61 merchantDescrTextViewTopSpace.constant = CGFloat(0)
...@@ -126,6 +126,26 @@ import AVFoundation ...@@ -126,6 +126,26 @@ import AVFoundation
126 couponNumberLabel.text = coupon?._barcode ?? "" 126 couponNumberLabel.text = coupon?._barcode ?? ""
127 couponView.frame = CGRect(x: 0.0, y: 0.0, width: couponView.intrinsicContentSize.width, height: 55) 127 couponView.frame = CGRect(x: 0.0, y: 0.0, width: couponView.intrinsicContentSize.width, height: 55)
128 128
129 +
130 + let activeCoupons = coupon?._coupons.filter { $0.status == 1 }
131 + let activeCouponsDiscount = (activeCoupons?.reduce(0) { $0 + (Float($1.discount ?? "0") ?? 0) }) ?? 0
132 +
133 +// discriptionLabel.text = "Χρησιμοποίησε τον παρακάτω κωδικό και πάρε έκπτωση στα ενεργά κουπόνια προσφορών αξίας " + String(activeCouponsDiscount) + "€."
134 +
135 + // ========
136 + let discrNormalText1 = "Χρησιμοποίησε τον παρακάτω κωδικό και πάρε έκπτωση στα ενεργά κουπόνια προσφορών αξίας "
137 + let discrBoldText = String(activeCouponsDiscount) + "€."
138 +
139 + let attrRegular = [NSAttributedString.Key.font : UIFont(name: "PeridotPE-Regular", size: 16) ?? UIFont.systemFont(ofSize: 15), NSAttributedString.Key.foregroundColor: UIColor(red: 0.13, green: 0.13, blue: 0.13, alpha: 1.00)]
140 + let attrBold = [NSAttributedString.Key.font : UIFont(name: "PeridotPE-Bold", size: 16) ?? UIFont.boldSystemFont(ofSize: 15), NSAttributedString.Key.foregroundColor: UIColor(red: 0.13, green: 0.13, blue: 0.13, alpha: 1.00)]
141 +
142 + let sumAttributedString = NSMutableAttributedString(string:discrNormalText1, attributes:attrRegular)
143 + let sumBoldString = NSMutableAttributedString(string: discrBoldText, attributes:attrBold)
144 +
145 + sumAttributedString.append(sumBoldString)
146 + discriptionLabel.attributedText = sumAttributedString
147 + // ========
148 +
129 // let barcodeString = constructBarcode(coupon: coupon) ?? "" 149 // let barcodeString = constructBarcode(coupon: coupon) ?? ""
130 let barcodeString = coupon?._barcode ?? "" 150 let barcodeString = coupon?._barcode ?? ""
131 barcodeLabel.text = barcodeString 151 barcodeLabel.text = barcodeString
......
...@@ -51,6 +51,7 @@ import UIKit ...@@ -51,6 +51,7 @@ import UIKit
51 func configureCell(coupon: swiftApi.UnifiedCouponModel) { 51 func configureCell(coupon: swiftApi.UnifiedCouponModel) {
52 let activeCoupons = coupon._coupons.filter { $0.status == 1 } 52 let activeCoupons = coupon._coupons.filter { $0.status == 1 }
53 let activeCouponsCount = activeCoupons.count 53 let activeCouponsCount = activeCoupons.count
54 + let activeCouponsDiscount = activeCoupons.reduce(0) { $0 + (Float($1.discount ?? "0") ?? 0) }
54 55
55 // var activeCouponsCount:Int = 0 56 // var activeCouponsCount:Int = 0
56 // for coupon in coupon._coupons { 57 // for coupon in coupon._coupons {
...@@ -62,8 +63,11 @@ import UIKit ...@@ -62,8 +63,11 @@ import UIKit
62 nameLabel.text = "COSMOTE SuperMarket Deals" 63 nameLabel.text = "COSMOTE SuperMarket Deals"
63 64
64 discriptionLabel.text = 65 discriptionLabel.text =
65 - activeCouponsCount == 1 ? "έχεις " + String(activeCouponsCount) + " ενεργό κουπόνι" 66 + "έχεις " + String(activeCouponsCount) +
66 - : "έχεις " + String(activeCouponsCount) + " ενεργά κουπόνια" 67 + (
68 + activeCouponsCount == 1 ? " ενεργό κουπόνι" : " ενεργά κουπόνια"
69 + )
70 + + " αξίας " + String(activeCouponsDiscount) + "€"
67 71
68 if let earliestExpiration = activeCoupons.min(by: { ($0.expiration ?? "") < ($1.expiration ?? "") }) { 72 if let earliestExpiration = activeCoupons.min(by: { ($0.expiration ?? "") < ($1.expiration ?? "") }) {
69 expirationLabel.text = "Ισχύει έως " + (earliestExpiration.expiration ?? "") 73 expirationLabel.text = "Ισχύει έως " + (earliestExpiration.expiration ?? "")
......