Showing
4 changed files
with
133 additions
and
23 deletions
No preview for this file type
This diff could not be displayed because it is too large.
| ... | @@ -41,6 +41,8 @@ class UnifiedCouponsTableViewCell: UITableViewCell { | ... | @@ -41,6 +41,8 @@ class UnifiedCouponsTableViewCell: UITableViewCell { |
| 41 | // Initialization code | 41 | // Initialization code |
| 42 | 42 | ||
| 43 | couponBgImage.image = UIImage(named: "coupon_bg", in: MyEmptyClass.resourceBundle(), compatibleWith: nil) | 43 | couponBgImage.image = UIImage(named: "coupon_bg", in: MyEmptyClass.resourceBundle(), compatibleWith: nil) |
| 44 | + couponImage.image = UIImage(named: "coupon_market", in: MyEmptyClass.resourceBundle(), compatibleWith: nil) | ||
| 45 | + | ||
| 44 | 46 | ||
| 45 | borderView.addDashedBorderVertical(color: UIColor(red: 0.44, green: 0.44, blue: 0.44, alpha: 1.00), width: 1.0, height: 110.0) | 47 | borderView.addDashedBorderVertical(color: UIColor(red: 0.44, green: 0.44, blue: 0.44, alpha: 1.00), width: 1.0, height: 110.0) |
| 46 | } | 48 | } |
| ... | @@ -73,7 +75,7 @@ class UnifiedCouponsTableViewCell: UITableViewCell { | ... | @@ -73,7 +75,7 @@ class UnifiedCouponsTableViewCell: UITableViewCell { |
| 73 | for merchant in merchantList { | 75 | for merchant in merchantList { |
| 74 | if (merchant._uuid == couponSetData?.merchant_uuid) { | 76 | if (merchant._uuid == couponSetData?.merchant_uuid) { |
| 75 | // couponImage.load(link: merchant._img_preview, placeholder: UIImage(), cache: URLCache()) | 77 | // couponImage.load(link: merchant._img_preview, placeholder: UIImage(), cache: URLCache()) |
| 76 | - self.postImageURL = merchant._img_preview | 78 | +// self.postImageURL = merchant._img_preview |
| 77 | nameLabel.text = merchant._admin_name | 79 | nameLabel.text = merchant._admin_name |
| 78 | break; | 80 | break; |
| 79 | } | 81 | } | ... | ... |
| ... | @@ -54,6 +54,7 @@ import SwiftEventBus | ... | @@ -54,6 +54,7 @@ import SwiftEventBus |
| 54 | @IBOutlet weak var couponBadgeLabel: UILabel! | 54 | @IBOutlet weak var couponBadgeLabel: UILabel! |
| 55 | @IBOutlet weak var marketBadgeImage: UIImageView! | 55 | @IBOutlet weak var marketBadgeImage: UIImageView! |
| 56 | @IBOutlet weak var marketBadgeLabel: UILabel! | 56 | @IBOutlet weak var marketBadgeLabel: UILabel! |
| 57 | + @IBOutlet weak var badgeLinesImage: UIImageView! | ||
| 57 | 58 | ||
| 58 | public var coupons:Array<swiftApi.CouponItemModel> = swiftApi().getCouponList() | 59 | public var coupons:Array<swiftApi.CouponItemModel> = swiftApi().getCouponList() |
| 59 | public var dfyCoupons:Array<swiftApi.ActiveDFYCouponModel> = swiftApi().getActiveDFYCoupons() | 60 | public var dfyCoupons:Array<swiftApi.ActiveDFYCouponModel> = swiftApi().getActiveDFYCoupons() |
| ... | @@ -71,27 +72,27 @@ import SwiftEventBus | ... | @@ -71,27 +72,27 @@ import SwiftEventBus |
| 71 | self.hidesBottomBarWhenPushed = true | 72 | self.hidesBottomBarWhenPushed = true |
| 72 | 73 | ||
| 73 | // TODO: DELETE ===> | 74 | // TODO: DELETE ===> |
| 74 | - // let coupon = swiftApi.ActiveDFYCouponModel() | 75 | +// let coupon = swiftApi.ActiveDFYCouponModel() |
| 75 | - // coupon._value = "12" | 76 | +// coupon._value = "12" |
| 76 | - // // coupon._date = "2022-12-05 01:55:01" | 77 | +// // coupon._date = "2022-12-05 01:55:01" |
| 77 | - // coupon._date = "2022-10-26 23:59:01" | 78 | +// coupon._date = "2022-10-26 23:59:01" |
| 78 | - // coupon._code = "123456789" | 79 | +// coupon._code = "123456789" |
| 79 | - | 80 | +// |
| 80 | - // let coupon2 = swiftApi.ActiveDFYCouponModel() | 81 | +// let coupon2 = swiftApi.ActiveDFYCouponModel() |
| 81 | - // coupon2._value = "23" | 82 | +// coupon2._value = "23" |
| 82 | - // coupon2._date = "2022-11-05 01:55" | 83 | +// coupon2._date = "2022-11-05 01:55" |
| 83 | - // coupon2._code = "234567891" | 84 | +// coupon2._code = "234567891" |
| 84 | - | 85 | +// |
| 85 | - // let coupon3 = swiftApi.ActiveDFYCouponModel() | 86 | +// let coupon3 = swiftApi.ActiveDFYCouponModel() |
| 86 | - // coupon3._value = "34" | 87 | +// coupon3._value = "34" |
| 87 | - // coupon3._date = "2022-07-01 01:55" | 88 | +// coupon3._date = "2022-07-01 01:55" |
| 88 | - // coupon3._code = "345678912" | 89 | +// coupon3._code = "345678912" |
| 89 | - | 90 | +// |
| 90 | - // let couponsArray: Array<swiftApi.ActiveDFYCouponModel> = [coupon, coupon2, coupon3, coupon3, coupon3] | 91 | +// let couponsArray: Array<swiftApi.ActiveDFYCouponModel> = [coupon, coupon2, coupon3, coupon3, coupon3] |
| 91 | - | 92 | +// |
| 92 | - // swiftApi().setActiveDFYCoupons(dfyCoupons: couponsArray) | 93 | +// swiftApi().setActiveDFYCoupons(dfyCoupons: couponsArray) |
| 93 | - | 94 | +// |
| 94 | - // dfyCoupons = swiftApi().getActiveDFYCoupons() | 95 | +// dfyCoupons = swiftApi().getActiveDFYCoupons() |
| 95 | // TODO: DELETE <=== | 96 | // TODO: DELETE <=== |
| 96 | 97 | ||
| 97 | setBackButton() | 98 | setBackButton() |
| ... | @@ -112,6 +113,9 @@ import SwiftEventBus | ... | @@ -112,6 +113,9 @@ import SwiftEventBus |
| 112 | couponEarnImage.image = UIImage(named: "wallet_coupons_2", in: MyEmptyClass.resourceBundle(), compatibleWith: nil) | 113 | couponEarnImage.image = UIImage(named: "wallet_coupons_2", in: MyEmptyClass.resourceBundle(), compatibleWith: nil) |
| 113 | dfyLogoImage.image = UIImage(named: "dfy_logo_white", in: MyEmptyClass.resourceBundle(), compatibleWith: nil) | 114 | dfyLogoImage.image = UIImage(named: "dfy_logo_white", in: MyEmptyClass.resourceBundle(), compatibleWith: nil) |
| 114 | activeCodeImage.image = UIImage(named: "active_code_logo", in: MyEmptyClass.resourceBundle(), compatibleWith: nil) | 115 | activeCodeImage.image = UIImage(named: "active_code_logo", in: MyEmptyClass.resourceBundle(), compatibleWith: nil) |
| 116 | + sumBadgeImage.image = UIImage(named: "wallet_summary", in: MyEmptyClass.resourceBundle(), compatibleWith: nil) | ||
| 117 | + badgeLinesImage.image = UIImage(named: "wallet_badge_lines", in: MyEmptyClass.resourceBundle(), compatibleWith: nil) | ||
| 118 | + | ||
| 115 | 119 | ||
| 116 | profileImage.layer.cornerRadius = 32.5 | 120 | profileImage.layer.cornerRadius = 32.5 |
| 117 | profileImage.layer.borderWidth = 1 | 121 | profileImage.layer.borderWidth = 1 |
| ... | @@ -154,6 +158,9 @@ import SwiftEventBus | ... | @@ -154,6 +158,9 @@ import SwiftEventBus |
| 154 | 158 | ||
| 155 | questionnaireButton.layer.cornerRadius = 7.0 | 159 | questionnaireButton.layer.cornerRadius = 7.0 |
| 156 | 160 | ||
| 161 | + // Rewards View | ||
| 162 | + rewardsLabel.text = "COSMOTE Επιβράβευση" | ||
| 163 | + | ||
| 157 | dfyEarnBannerView.layer.cornerRadius = 5.0 | 164 | dfyEarnBannerView.layer.cornerRadius = 5.0 |
| 158 | dfyEarnBannerView.layer.shadowColor = UIColor(red: 0.00, green: 0.00, blue: 0.00, alpha: 0.16).cgColor | 165 | dfyEarnBannerView.layer.shadowColor = UIColor(red: 0.00, green: 0.00, blue: 0.00, alpha: 0.16).cgColor |
| 159 | dfyEarnBannerView.layer.shadowOffset = CGSize(width: 0.0, height: 3.0) | 166 | dfyEarnBannerView.layer.shadowOffset = CGSize(width: 0.0, height: 3.0) |
| ... | @@ -166,10 +173,19 @@ import SwiftEventBus | ... | @@ -166,10 +173,19 @@ import SwiftEventBus |
| 166 | dfyEarnBannerView.isHidden = true | 173 | dfyEarnBannerView.isHidden = true |
| 167 | dfyEarnBannerHeight.constant = 0 | 174 | dfyEarnBannerHeight.constant = 0 |
| 168 | dfyEarnBannerTopSpace.constant = 0 | 175 | dfyEarnBannerTopSpace.constant = 0 |
| 176 | + | ||
| 177 | + // Rewards View | ||
| 178 | + dfyBadgeImage.image = UIImage(named: "wallet_dfy_empty", in: MyEmptyClass.resourceBundle(), compatibleWith: nil) | ||
| 179 | + dfyBadgeLabel.isHidden = true | ||
| 180 | + | ||
| 169 | } else { | 181 | } else { |
| 170 | dfyEarnBannerView.isHidden = false | 182 | dfyEarnBannerView.isHidden = false |
| 171 | dfyEarnBannerHeight.constant = 75 | 183 | dfyEarnBannerHeight.constant = 75 |
| 172 | dfyEarnBannerTopSpace.constant = 30 | 184 | dfyEarnBannerTopSpace.constant = 30 |
| 185 | + | ||
| 186 | + // Rewards View | ||
| 187 | + dfyBadgeImage.image = UIImage(named: "wallet_dfy_2", in: MyEmptyClass.resourceBundle(), compatibleWith: nil) | ||
| 188 | + dfyBadgeLabel.isHidden = false | ||
| 173 | } | 189 | } |
| 174 | 190 | ||
| 175 | totalCouponValue = Float(round(100 * totalCouponValue) / 100) | 191 | totalCouponValue = Float(round(100 * totalCouponValue) / 100) |
| ... | @@ -195,14 +211,25 @@ import SwiftEventBus | ... | @@ -195,14 +211,25 @@ import SwiftEventBus |
| 195 | 211 | ||
| 196 | dfyEarnAmountLabel.text = totalCouponValueString + "€" | 212 | dfyEarnAmountLabel.text = totalCouponValueString + "€" |
| 197 | 213 | ||
| 214 | + // Rewards View | ||
| 215 | + dfyBadgeLabel.text = totalCouponValueString + "€" | ||
| 216 | + | ||
| 198 | if (loyaltyBadge._couponCount == 0) { | 217 | if (loyaltyBadge._couponCount == 0) { |
| 199 | couponEarnView.isHidden = true | 218 | couponEarnView.isHidden = true |
| 200 | couponEarnViewHeight.constant = 0 | 219 | couponEarnViewHeight.constant = 0 |
| 201 | couponEarnViewTopSpace.constant = 0 | 220 | couponEarnViewTopSpace.constant = 0 |
| 221 | + | ||
| 222 | + // Rewards View | ||
| 223 | + couponBadgeImage.image = UIImage(named: "wallet_coupons_empty", in: MyEmptyClass.resourceBundle(), compatibleWith: nil) | ||
| 224 | + couponBadgeLabel.isHidden = true | ||
| 202 | } else { | 225 | } else { |
| 203 | couponEarnView.isHidden = false | 226 | couponEarnView.isHidden = false |
| 204 | couponEarnViewHeight.constant = 75 | 227 | couponEarnViewHeight.constant = 75 |
| 205 | couponEarnViewTopSpace.constant = 30 | 228 | couponEarnViewTopSpace.constant = 30 |
| 229 | + | ||
| 230 | + // Rewards View | ||
| 231 | + couponBadgeImage.image = UIImage(named: "wallet_coupons_3", in: MyEmptyClass.resourceBundle(), compatibleWith: nil) | ||
| 232 | + couponBadgeLabel.isHidden = false | ||
| 206 | } | 233 | } |
| 207 | 234 | ||
| 208 | couponEarnView.layer.cornerRadius = 5.0 | 235 | couponEarnView.layer.cornerRadius = 5.0 |
| ... | @@ -237,9 +264,34 @@ import SwiftEventBus | ... | @@ -237,9 +264,34 @@ import SwiftEventBus |
| 237 | 264 | ||
| 238 | couponEarnAmountLabel.text = totalCouponDiscountString + "€" | 265 | couponEarnAmountLabel.text = totalCouponDiscountString + "€" |
| 239 | 266 | ||
| 267 | + // Rewards View | ||
| 268 | + couponBadgeLabel.text = totalCouponDiscountString + "€" | ||
| 269 | + | ||
| 240 | print("Loyalty Badge Value: " + totalCouponDiscountString) | 270 | print("Loyalty Badge Value: " + totalCouponDiscountString) |
| 241 | print("Loyalty Badge Count: " + String(loyaltyBadge._couponCount)) | 271 | print("Loyalty Badge Count: " + String(loyaltyBadge._couponCount)) |
| 242 | 272 | ||
| 273 | + // Rewards View - Market Badge | ||
| 274 | + // TODO: Fix empty check | ||
| 275 | + if (false) { | ||
| 276 | + marketBadgeImage.image = UIImage(named: "wallet_market_empty", in: MyEmptyClass.resourceBundle(), compatibleWith: nil) | ||
| 277 | + marketBadgeLabel.isHidden = true | ||
| 278 | + | ||
| 279 | + } else { | ||
| 280 | + marketBadgeImage.image = UIImage(named: "wallet_market", in: MyEmptyClass.resourceBundle(), compatibleWith: nil) | ||
| 281 | + marketBadgeLabel.isHidden = false | ||
| 282 | + } | ||
| 283 | + // TODO: Fix dynamic value | ||
| 284 | + marketBadgeLabel.text = "10,00" + "€" | ||
| 285 | + | ||
| 286 | + // Rewards View | ||
| 287 | + // TODO: Add market value | ||
| 288 | + let sumRewards = totalCouponValue + totalCouponDiscount | ||
| 289 | +// sumRewards = Float(round(100 * sumRewards) / 100) | ||
| 290 | + var sumRewardsString = "0" | ||
| 291 | + sumRewardsString = String(format: "%.2f", sumRewards).replacingOccurrences(of: ".", with: ",", options: .literal, range: nil) | ||
| 292 | + sumBadgeLabel.text = sumRewardsString + "€" | ||
| 293 | + | ||
| 294 | + // activeCodeView | ||
| 243 | activeCodeView.layer.cornerRadius = 5.0 | 295 | activeCodeView.layer.cornerRadius = 5.0 |
| 244 | activeCodeView.layer.shadowColor = UIColor(red: 0.00, green: 0.00, blue: 0.00, alpha: 0.16).cgColor | 296 | activeCodeView.layer.shadowColor = UIColor(red: 0.00, green: 0.00, blue: 0.00, alpha: 0.16).cgColor |
| 245 | activeCodeView.layer.shadowOffset = CGSize(width: 0.0, height: 0.0) | 297 | activeCodeView.layer.shadowOffset = CGSize(width: 0.0, height: 0.0) |
| ... | @@ -377,7 +429,15 @@ import SwiftEventBus | ... | @@ -377,7 +429,15 @@ import SwiftEventBus |
| 377 | 429 | ||
| 378 | emptyImage.image = UIImage(named: "ic_empty_wallet", in: MyEmptyClass.resourceBundle(), compatibleWith: nil) | 430 | emptyImage.image = UIImage(named: "ic_empty_wallet", in: MyEmptyClass.resourceBundle(), compatibleWith: nil) |
| 379 | emptyLabel.text = "Δεν έχεις κάποιον ενεργό κωδικό ή κουπόνι! Μπες τώρα στην ενότητα COSMOTE For You και βρες αποκλειστικές προσφορές!" | 431 | emptyLabel.text = "Δεν έχεις κάποιον ενεργό κωδικό ή κουπόνι! Μπες τώρα στην ενότητα COSMOTE For You και βρες αποκλειστικές προσφορές!" |
| 380 | - // TODO: FIX emptyView check | 432 | + |
| 433 | + // TODO: FIX emptyView check - add market badge check | ||
| 434 | + if (totalCouponValue == 0.0 && loyaltyBadge._couponCount == 0) { | ||
| 435 | + rewardsView.isHidden = true | ||
| 436 | + } else { | ||
| 437 | + rewardsView.isHidden = false | ||
| 438 | + } | ||
| 439 | + | ||
| 440 | + // TODO: FIX emptyView check - add market badge check | ||
| 381 | // if (totalCouponValue == 0.0 && loyaltyBadge._couponCount == 0 && dfyCoupons.count == 0 && coupons.count == 0) { | 441 | // if (totalCouponValue == 0.0 && loyaltyBadge._couponCount == 0 && dfyCoupons.count == 0 && coupons.count == 0) { |
| 382 | if (totalCouponValue == 0.0 && loyaltyBadge._couponCount == 0 && dfyCoupons.count == 0 && coupons.count == 0 && unifiedCoupons.count == 0) { | 442 | if (totalCouponValue == 0.0 && loyaltyBadge._couponCount == 0 && dfyCoupons.count == 0 && coupons.count == 0 && unifiedCoupons.count == 0) { |
| 383 | emptyView.isHidden = false | 443 | emptyView.isHidden = false |
| ... | @@ -555,6 +615,44 @@ import SwiftEventBus | ... | @@ -555,6 +615,44 @@ import SwiftEventBus |
| 555 | SwiftEventBus.post("dfy_coupon_details", sender: couponDetails) | 615 | SwiftEventBus.post("dfy_coupon_details", sender: couponDetails) |
| 556 | } | 616 | } |
| 557 | 617 | ||
| 618 | + @IBAction func dfyBadgeButtonAction(_ sender: Any) { | ||
| 619 | + var totalCouponValue = swiftApi().getDealsCouponsSum() | ||
| 620 | + if (totalCouponValue > 0.0) { | ||
| 621 | + print("DFY coupon banner pressed!") | ||
| 622 | + // analysis_pressed event | ||
| 623 | + let dealsAnalysis = swiftApi.WarplyDealsAnalysisEventModel() | ||
| 624 | + dealsAnalysis._isPressed = true | ||
| 625 | + SwiftEventBus.post("analysis_pressed", sender: dealsAnalysis) | ||
| 626 | + | ||
| 627 | + let firebaseEvent = swiftApi.LoyaltySDKFirebaseEventModel() | ||
| 628 | + firebaseEvent._eventName = "did_tap_gifts_for_you_badge" | ||
| 629 | + firebaseEvent.setParameter = ("screen", "Loyalty Wallet") | ||
| 630 | + SwiftEventBus.post("firebase", sender: firebaseEvent) | ||
| 631 | + | ||
| 632 | + swiftApi().logTrackersEvent("click", ("LoyaltyWalletScreen:" + "DealsBanner")) | ||
| 633 | + } | ||
| 634 | + } | ||
| 635 | + | ||
| 636 | + @IBAction func couponBadgeButtonAction(_ sender: Any) { | ||
| 637 | + if (loyaltyBadge._couponCount > 0) { | ||
| 638 | + let firebaseEvent = swiftApi.LoyaltySDKFirebaseEventModel() | ||
| 639 | + firebaseEvent._eventName = "did_tap_deals_for_you_badge" | ||
| 640 | + firebaseEvent.setParameter = ("screen", "Loyalty Wallet") | ||
| 641 | + SwiftEventBus.post("firebase", sender: firebaseEvent) | ||
| 642 | + | ||
| 643 | + swiftApi().logTrackersEvent("click", ("LoyaltyWalletScreen:" + "LoyaltyBanner")) | ||
| 644 | + | ||
| 645 | + let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self)) | ||
| 646 | + let vc = storyboard.instantiateViewController(withIdentifier: "LoyaltyAnalysisViewController") as! SwiftWarplyFramework.LoyaltyAnalysisViewController | ||
| 647 | + self.navigationController?.pushViewController(vc, animated: true) | ||
| 648 | + } | ||
| 649 | + } | ||
| 650 | + | ||
| 651 | + @IBAction func marketBadgeButtonAction(_ sender: Any) { | ||
| 652 | + print("Market Badge pressed!") | ||
| 653 | + // TODO: add action - open marketHistory after check | ||
| 654 | + } | ||
| 655 | + | ||
| 558 | } | 656 | } |
| 559 | 657 | ||
| 560 | // MARK: - TableView | 658 | // MARK: - TableView |
| ... | @@ -570,7 +668,11 @@ extension WalletViewController: UITableViewDelegate, UITableViewDataSource{ | ... | @@ -570,7 +668,11 @@ extension WalletViewController: UITableViewDelegate, UITableViewDataSource{ |
| 570 | return 3 | 668 | return 3 |
| 571 | // return self.unifiedCoupons.count | 669 | // return self.unifiedCoupons.count |
| 572 | } else if (section == 1) { | 670 | } else if (section == 1) { |
| 671 | + if (self.dfyCoupons.count > 0) { | ||
| 573 | return 1 | 672 | return 1 |
| 673 | + } else { | ||
| 674 | + return 0 | ||
| 675 | + } | ||
| 574 | } | 676 | } |
| 575 | return self.coupons.count | 677 | return self.coupons.count |
| 576 | } | 678 | } |
| ... | @@ -613,6 +715,7 @@ extension WalletViewController: UITableViewDelegate, UITableViewDataSource{ | ... | @@ -613,6 +715,7 @@ extension WalletViewController: UITableViewDelegate, UITableViewDataSource{ |
| 613 | return view | 715 | return view |
| 614 | 716 | ||
| 615 | } else if (section == 1) { | 717 | } else if (section == 1) { |
| 718 | + if (self.dfyCoupons.count > 0) { | ||
| 616 | let view = UIView(frame: CGRect(x: 0, y: 0, width: tableView.frame.width, height: 68)) | 719 | let view = UIView(frame: CGRect(x: 0, y: 0, width: tableView.frame.width, height: 68)) |
| 617 | view.backgroundColor = .clear | 720 | view.backgroundColor = .clear |
| 618 | 721 | ||
| ... | @@ -627,6 +730,11 @@ extension WalletViewController: UITableViewDelegate, UITableViewDataSource{ | ... | @@ -627,6 +730,11 @@ extension WalletViewController: UITableViewDelegate, UITableViewDataSource{ |
| 627 | return view | 730 | return view |
| 628 | 731 | ||
| 629 | } else { | 732 | } else { |
| 733 | + return nil | ||
| 734 | + } | ||
| 735 | + | ||
| 736 | + | ||
| 737 | + } else { | ||
| 630 | // let view = UIView(frame: CGRect(x: 0, y: 0, width: tableView.frame.width, height: 71)) | 738 | // let view = UIView(frame: CGRect(x: 0, y: 0, width: tableView.frame.width, height: 71)) |
| 631 | let view = UIView(frame: CGRect(x: 0, y: 0, width: tableView.frame.width, height: 65)) | 739 | let view = UIView(frame: CGRect(x: 0, y: 0, width: tableView.frame.width, height: 65)) |
| 632 | view.backgroundColor = .clear | 740 | view.backgroundColor = .clear | ... | ... |
-
Please register or login to post a comment