Manos Chorianopoulos

update wallet with LoyaltyBadgeModel

......@@ -34,6 +34,7 @@ import SwiftEventBus
public var coupons:Array<swiftApi.CouponItemModel> = swiftApi().getCouponList()
public var dfyCoupons:Array<swiftApi.ActiveDFYCouponModel> = swiftApi().getActiveDFYCoupons()
public var loyaltyBadge:swiftApi.LoyaltyBadgeModel = swiftApi().getLoyaltyBadge()
public override func viewDidLoad() {
super.viewDidLoad()
......@@ -100,11 +101,10 @@ import SwiftEventBus
couponEarnView.layer.shadowOpacity = 1.0
couponEarnView.layer.shadowRadius = 3.0
var totalCouponDiscount = coupons.reduce(0) { $0 + (Float($1.discount ?? "") ?? 0) }
totalCouponDiscount = Float(round(100 * totalCouponDiscount) / 100)
let totalCouponDiscount = Float(round(100 * loyaltyBadge._value) / 100)
let totalCouponDiscountString = String(format: "%.2f", totalCouponDiscount).replacingOccurrences(of: ".", with: ",", options: .literal, range: nil)
couponEarnLabel.text = "Μέχρι τώρα έχεις κερδίσει " + totalCouponDiscountString + "€ σε προσφορές από " + String(coupons.count) + " κουπόνια!"
couponEarnLabel.text = "Μέχρι τώρα έχεις κερδίσει " + totalCouponDiscountString + "€ σε προσφορές από " + String(loyaltyBadge._couponCount) + " κουπόνια!"
couponEarnAmountLabel.text = totalCouponDiscountString + "€"
activeCodeView.layer.cornerRadius = 5.0
......