Showing
3 changed files
with
66 additions
and
1 deletions
No preview for this file type
| ... | @@ -36,14 +36,23 @@ import SwiftEventBus | ... | @@ -36,14 +36,23 @@ import SwiftEventBus |
| 36 | @IBOutlet weak var couponBadgeLabel: UILabel! | 36 | @IBOutlet weak var couponBadgeLabel: UILabel! |
| 37 | @IBOutlet weak var gfyBannerLabel: UILabel! | 37 | @IBOutlet weak var gfyBannerLabel: UILabel! |
| 38 | 38 | ||
| 39 | + @IBOutlet weak var boxBannerParentView: UIView! | ||
| 40 | + @IBOutlet weak var boxBannerInnerParentView: UIView! | ||
| 41 | + @IBOutlet weak var boxBannerInnerView: UIView! | ||
| 42 | + @IBOutlet weak var boxBadgeImage: UIImageView! | ||
| 43 | + @IBOutlet weak var boxBadgeLabel: UILabel! | ||
| 44 | + @IBOutlet weak var boxBannerLabel: UILabel! | ||
| 45 | + | ||
| 39 | public var coupons:Array<swiftApi.CouponItemModel> = swiftApi().getCouponList() | 46 | public var coupons:Array<swiftApi.CouponItemModel> = swiftApi().getCouponList() |
| 40 | public var dfyCoupons:Array<swiftApi.ActiveDFYCouponModel> = swiftApi().getActiveDFYCoupons() | 47 | public var dfyCoupons:Array<swiftApi.ActiveDFYCouponModel> = swiftApi().getActiveDFYCoupons() |
| 41 | public var unifiedCoupons:Array<swiftApi.UnifiedCouponModel> = [] | 48 | public var unifiedCoupons:Array<swiftApi.UnifiedCouponModel> = [] |
| 42 | public var loyaltyBadge:swiftApi.LoyaltyBadgeModel = swiftApi().getLoyaltyBadge() | 49 | public var loyaltyBadge:swiftApi.LoyaltyBadgeModel = swiftApi().getLoyaltyBadge() |
| 50 | + public var boxCoupons:Array<swiftApi.ActiveBoxCouponModel> = swiftApi().getActiveBoxCoupons() | ||
| 43 | 51 | ||
| 44 | var totalCouponValue = swiftApi().getDealsCouponsSum() | 52 | var totalCouponValue = swiftApi().getDealsCouponsSum() |
| 45 | var totalCouponDiscount = Float(round(100 * swiftApi().getLoyaltyBadge()._value) / 100) | 53 | var totalCouponDiscount = Float(round(100 * swiftApi().getLoyaltyBadge()._value) / 100) |
| 46 | var unifiedCouponsDiscount:Float = 0.0 | 54 | var unifiedCouponsDiscount:Float = 0.0 |
| 55 | + var boxCouponValue = swiftApi().getBoxCouponsSum() | ||
| 47 | 56 | ||
| 48 | 57 | ||
| 49 | public override func viewDidLoad() { | 58 | public override func viewDidLoad() { |
| ... | @@ -91,6 +100,7 @@ import SwiftEventBus | ... | @@ -91,6 +100,7 @@ import SwiftEventBus |
| 91 | dfyBadgeImage.image = UIImage(named: "history_banner_dfy", in: MyEmptyClass.resourceBundle(), compatibleWith: nil) | 100 | dfyBadgeImage.image = UIImage(named: "history_banner_dfy", in: MyEmptyClass.resourceBundle(), compatibleWith: nil) |
| 92 | marketBadgeImage.image = UIImage(named: "history_banner_sm", in: MyEmptyClass.resourceBundle(), compatibleWith: nil) | 101 | marketBadgeImage.image = UIImage(named: "history_banner_sm", in: MyEmptyClass.resourceBundle(), compatibleWith: nil) |
| 93 | couponBadgeImage.image = UIImage(named: "history_banner_gfy", in: MyEmptyClass.resourceBundle(), compatibleWith: nil) | 102 | couponBadgeImage.image = UIImage(named: "history_banner_gfy", in: MyEmptyClass.resourceBundle(), compatibleWith: nil) |
| 103 | + boxBadgeImage.image = UIImage(named: "history_banner_box", in: MyEmptyClass.resourceBundle(), compatibleWith: nil) | ||
| 94 | 104 | ||
| 95 | sectionTitleLabel.text = "Εξαργυρωμένα κουπόνια" | 105 | sectionTitleLabel.text = "Εξαργυρωμένα κουπόνια" |
| 96 | 106 | ||
| ... | @@ -118,6 +128,7 @@ import SwiftEventBus | ... | @@ -118,6 +128,7 @@ import SwiftEventBus |
| 118 | self.coupons = swiftApi().getCouponList() | 128 | self.coupons = swiftApi().getCouponList() |
| 119 | self.unifiedCoupons = swiftApi().getUnifiedCouponList() | 129 | self.unifiedCoupons = swiftApi().getUnifiedCouponList() |
| 120 | self.dfyCoupons = swiftApi().getActiveDFYCoupons() | 130 | self.dfyCoupons = swiftApi().getActiveDFYCoupons() |
| 131 | + self.boxCoupons = swiftApi().getActiveBoxCoupons() | ||
| 121 | 132 | ||
| 122 | self.matchOldSMCoupons() | 133 | self.matchOldSMCoupons() |
| 123 | self.updateMarketBadge() | 134 | self.updateMarketBadge() |
| ... | @@ -205,7 +216,7 @@ import SwiftEventBus | ... | @@ -205,7 +216,7 @@ import SwiftEventBus |
| 205 | 216 | ||
| 206 | // === SUM banner === // | 217 | // === SUM banner === // |
| 207 | 218 | ||
| 208 | - let sumRewards = totalCouponValue + totalCouponDiscount + unifiedCouponsDiscount | 219 | + let sumRewards = totalCouponValue + totalCouponDiscount + unifiedCouponsDiscount + boxCouponValue |
| 209 | 220 | ||
| 210 | // sumRewards = Float(round(100 * sumRewards) / 100) | 221 | // sumRewards = Float(round(100 * sumRewards) / 100) |
| 211 | var sumRewardsString = "0" | 222 | var sumRewardsString = "0" |
| ... | @@ -309,6 +320,40 @@ import SwiftEventBus | ... | @@ -309,6 +320,40 @@ import SwiftEventBus |
| 309 | gfyAttributedString.append(gfyBoldString) | 320 | gfyAttributedString.append(gfyBoldString) |
| 310 | gfyAttributedString.append(gfyNormalString) | 321 | gfyAttributedString.append(gfyNormalString) |
| 311 | gfyBannerLabel.attributedText = gfyAttributedString | 322 | gfyBannerLabel.attributedText = gfyAttributedString |
| 323 | + | ||
| 324 | + // === BOX banner === // | ||
| 325 | + | ||
| 326 | + boxBannerParentView.backgroundColor = .clear | ||
| 327 | + boxBannerInnerParentView.backgroundColor = .white | ||
| 328 | +// boxBannerInnerView.backgroundColor = UIColor(red: 0.46, green: 0.75, blue: 0.45, alpha: 0.05) | ||
| 329 | + boxBannerInnerView.backgroundColor = .white | ||
| 330 | + boxBannerInnerParentView.layer.cornerRadius = 16.0 | ||
| 331 | + boxBannerInnerView.layer.cornerRadius = 16.0 | ||
| 332 | + // boxBannerInnerView.layer.borderWidth = 1 | ||
| 333 | + // boxBannerInnerView.layer.borderColor = UIColor(red: 0.90, green: 0.90, blue: 0.90, alpha: 1.00).cgColor | ||
| 334 | + | ||
| 335 | + boxBannerParentView.layer.shadowColor = UIColor(red: 0.00, green: 0.00, blue: 0.00, alpha: 0.2).cgColor | ||
| 336 | + boxBannerParentView.layer.shadowOffset = CGSize(width: 0.0, height: 1.0) | ||
| 337 | + boxBannerParentView.layer.shadowOpacity = 1.0 | ||
| 338 | + boxBannerParentView.layer.shadowRadius = 2.0 | ||
| 339 | + | ||
| 340 | + let boxCouponValueFixed = Float(round(100 * boxCouponValue) / 100) | ||
| 341 | + var boxCouponValueString = "0" | ||
| 342 | + boxCouponValueString = String(format: "%.2f", boxCouponValueFixed).replacingOccurrences(of: ".", with: ",", options: .literal, range: nil) | ||
| 343 | + boxBadgeLabel.text = boxCouponValueString + "€" | ||
| 344 | + | ||
| 345 | + let boxNormalText1 = "Μέχρι τώρα έχεις όφελος " | ||
| 346 | + let boxBoldText = boxCouponValueString + "€" | ||
| 347 | + let boxNormalText2 = " από το BOX" | ||
| 348 | + | ||
| 349 | + let boxAttributedString = NSMutableAttributedString(string:boxNormalText1, attributes:attrRegular) | ||
| 350 | + let boxBoldString = NSMutableAttributedString(string: boxBoldText, attributes:attrBold) | ||
| 351 | + let boxNormalString = NSMutableAttributedString(string:boxNormalText2, attributes:attrRegular) | ||
| 352 | + | ||
| 353 | + boxAttributedString.append(boxBoldString) | ||
| 354 | + boxAttributedString.append(boxNormalString) | ||
| 355 | + boxBannerLabel.attributedText = boxAttributedString | ||
| 356 | + | ||
| 312 | } | 357 | } |
| 313 | 358 | ||
| 314 | // MARK: - Actions | 359 | // MARK: - Actions |
| ... | @@ -369,4 +414,24 @@ import SwiftEventBus | ... | @@ -369,4 +414,24 @@ import SwiftEventBus |
| 369 | self.navigationController?.pushViewController(vc, animated: true) | 414 | self.navigationController?.pushViewController(vc, animated: true) |
| 370 | // } | 415 | // } |
| 371 | } | 416 | } |
| 417 | + | ||
| 418 | + @IBAction func boxBannerButtonAction(_ sender: Any) { | ||
| 419 | + print("BOX coupon banner pressed!") | ||
| 420 | +// // box_analysis_pressed event | ||
| 421 | +// let dealsAnalysis = swiftApi.WarplyDealsAnalysisEventModel() | ||
| 422 | +// dealsAnalysis._isPressed = true | ||
| 423 | +// SwiftEventBus.post("box_analysis_pressed", sender: dealsAnalysis) | ||
| 424 | + | ||
| 425 | + // box_analysis_pressed event | ||
| 426 | + let dealsAnalysis = swiftApi.WarplyDealsAnalysisEventModel() | ||
| 427 | + dealsAnalysis._isPressed = true | ||
| 428 | + SwiftEventBus.post("box_analysis_pressed") | ||
| 429 | + | ||
| 430 | + let firebaseEvent = swiftApi.LoyaltySDKFirebaseEventModel() | ||
| 431 | + firebaseEvent._eventName = "did_tap_box_badge" | ||
| 432 | + firebaseEvent.setParameter = ("screen", "Loyalty History") | ||
| 433 | + SwiftEventBus.post("firebase", sender: firebaseEvent) | ||
| 434 | + | ||
| 435 | + swiftApi().logTrackersEvent("click", ("LoyaltyHistoryScreen:" + "BoxBanner")) | ||
| 436 | + } | ||
| 372 | } | 437 | } | ... | ... |
This diff is collapsed. Click to expand it.
-
Please register or login to post a comment