Manos Chorianopoulos

box redesign MyRewards

......@@ -417,15 +417,12 @@ import SwiftEventBus
@IBAction func boxBannerButtonAction(_ sender: Any) {
print("BOX coupon banner pressed!")
// // box_analysis_pressed event
// let dealsAnalysis = swiftApi.WarplyDealsAnalysisEventModel()
// dealsAnalysis._isPressed = true
// SwiftEventBus.post("box_analysis_pressed", sender: dealsAnalysis)
// box_analysis_pressed event
let dealsAnalysis = swiftApi.WarplyDealsAnalysisEventModel()
let dealsAnalysis = swiftApi.WarplyBoxAnalysisEventModel()
dealsAnalysis._isPressed = true
SwiftEventBus.post("box_analysis_pressed")
SwiftEventBus.post("box_analysis_pressed", sender: dealsAnalysis)
// SwiftEventBus.post("box_analysis_pressed")
let firebaseEvent = swiftApi.LoyaltySDKFirebaseEventModel()
firebaseEvent._eventName = "did_tap_box_badge"
......
This diff could not be displayed because it is too large.
......@@ -8,13 +8,51 @@
import UIKit
@objc public class WalletActiveCouponCollectionViewCell: UICollectionViewCell {
@IBOutlet weak var badgeViewParent: UIView!
@IBOutlet weak var badgeView: UIView!
@IBOutlet weak var badgeImage: UIImageView!
@IBOutlet weak var badgeLabel: UILabel!
@IBOutlet weak var badgeCountView: UIView!
@IBOutlet weak var badgeCountLabel: UILabel!
public override func awakeFromNib() {
super.awakeFromNib()
// Badge Banner
// badgeViewParent.backgroundColor = UIColor(red: 0.95, green: 0.95, blue: 0.95, alpha: 1.00)
badgeViewParent.backgroundColor = .white
badgeViewParent.layer.cornerRadius = 16.0
badgeViewParent.layer.shadowColor = UIColor(red: 0.00, green: 0.00, blue: 0.00, alpha: 0.2).cgColor
badgeViewParent.layer.shadowOffset = CGSize(width: 0.0, height: 1.0)
badgeViewParent.layer.shadowOpacity = 1.0
badgeViewParent.layer.shadowRadius = 2.0
// badgeView.backgroundColor = UIColor(red: 0.46, green: 0.75, blue: 0.45, alpha: 0.05)
badgeView.backgroundColor = .white
badgeView.layer.cornerRadius = 16.0
badgeCountView.layer.cornerRadius = 4.0
badgeCountView.backgroundColor = UIColor(red: 0.92, green: 0.75, blue: 0.41, alpha: 1.00)
}
func configureCell() {
func configureCell(badgeId: String, badgeCount: Int) {
if (badgeId == "dfy") {
badgeImage.image = UIImage(named: "wallet_banner_dfy", in: MyEmptyClass.resourceBundle(), compatibleWith: nil)
badgeLabel.text = "DEALS FOR YOU"
} else if (badgeId == "sm") {
badgeImage.image = UIImage(named: "wallet_banner_sm", in: MyEmptyClass.resourceBundle(), compatibleWith: nil)
badgeLabel.text = "SUPERMARKET DEALS"
} else if (badgeId == "gfy") {
badgeImage.image = UIImage(named: "wallet_banner_gfy", in: MyEmptyClass.resourceBundle(), compatibleWith: nil)
badgeLabel.text = "FREE COUPONS"
} else if (badgeId == "box") {
badgeImage.image = UIImage(named: "wallet_banner_box", in: MyEmptyClass.resourceBundle(), compatibleWith: nil)
badgeLabel.text = "BOX"
}
badgeCountLabel.text = String(badgeCount)
}
}
......
......@@ -6,30 +6,22 @@
//
import UIKit
import SwiftEventBus
@objc public class WalletActiveCouponsScrollTableViewCell: UITableViewCell {
@IBOutlet weak var sectionTitleLabel: UILabel!
@IBOutlet weak var historyButtonImage: UIImageView!
@IBOutlet weak var dfyViewParent: UIView!
@IBOutlet weak var dfyView: UIView!
@IBOutlet weak var dfyImage: UIImageView!
@IBOutlet weak var dfyLabel: UILabel!
@IBOutlet weak var dfyCountView: UIView!
@IBOutlet weak var dfyCountLabel: UILabel!
@IBOutlet weak var smView: UIView!
@IBOutlet weak var smImage: UIImageView!
@IBOutlet weak var smLabel: UILabel!
@IBOutlet weak var smCountView: UIView!
@IBOutlet weak var smCountLabel: UILabel!
@IBOutlet weak var gfyView: UIView!
@IBOutlet weak var gfyImage: UIImageView!
@IBOutlet weak var gfyLabel: UILabel!
@IBOutlet weak var gfyCountView: UIView!
@IBOutlet weak var gfyCountLabel: UILabel!
@IBOutlet weak var collectionView: UICollectionView!
@IBOutlet weak var dotLeft: UIView!
@IBOutlet weak var dotLeftWidth: NSLayoutConstraint!
@IBOutlet weak var dotLeftHeight: NSLayoutConstraint!
@IBOutlet weak var dotRight: UIView!
@IBOutlet weak var dotRightWidth: NSLayoutConstraint!
@IBOutlet weak var dotRightHeight: NSLayoutConstraint!
var parent: UIViewController?
public var activeCouponBadges:Array<swiftApi.WalletActiveCouponBadgeModel> = []
public override func awakeFromNib() {
super.awakeFromNib()
......@@ -41,71 +33,186 @@ import UIKit
historyButtonImage.image = historyButtonImage.image?.withRenderingMode(.alwaysTemplate)
historyButtonImage.tintColor = UIColor(red: 0.13, green: 0.13, blue: 0.13, alpha: 1.00)
// DFY Banner
// dfyViewParent.backgroundColor = UIColor(red: 0.95, green: 0.95, blue: 0.95, alpha: 1.00)
dfyViewParent.backgroundColor = .white
dfyViewParent.layer.cornerRadius = 16.0
dfyViewParent.layer.shadowColor = UIColor(red: 0.00, green: 0.00, blue: 0.00, alpha: 0.2).cgColor
dfyViewParent.layer.shadowOffset = CGSize(width: 0.0, height: 1.0)
dfyViewParent.layer.shadowOpacity = 1.0
dfyViewParent.layer.shadowRadius = 2.0
collectionView.contentInset.left = 17
collectionView.contentInset.right = 17
// dfyView.backgroundColor = UIColor(red: 0.46, green: 0.75, blue: 0.45, alpha: 0.05)
dfyView.backgroundColor = .white
dfyView.layer.cornerRadius = 16.0
dotLeftWidth.constant = 12
dotLeftHeight.constant = 12
dotLeft.layer.cornerRadius = 6
dfyImage.image = UIImage(named: "wallet_banner_dfy", in: MyEmptyClass.resourceBundle(), compatibleWith: nil)
dotRightWidth.constant = 8
dotRightHeight.constant = 8
dotRight.layer.cornerRadius = 4
dfyLabel.text = "DEALS FOR YOU"
}
public override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
func configureCell(dfyCount: Int, smCount: Int, gfyCount: Int, boxCount: Int) {
sortBadges(dfyCount, smCount, gfyCount, boxCount)
}
func sortBadges(_ dfyCount: Int, _ smCount: Int, _ gfyCount: Int, _ boxCount: Int) {
// deals weight 3
// sm weight 2
// free weight 1
// box weight 0
dfyCountView.layer.cornerRadius = 4.0
dfyCountView.backgroundColor = UIColor(red: 0.92, green: 0.75, blue: 0.41, alpha: 1.00)
let DFYBadge = swiftApi.WalletActiveCouponBadgeModel()
DFYBadge._id = "dfy"
DFYBadge._count = dfyCount
DFYBadge._weight = 3
// SM Banner
// smView.backgroundColor = UIColor(red: 1.00, green: 0.99, blue: 0.97, alpha: 1.00)
smView.backgroundColor = .white
smView.layer.cornerRadius = 16.0
smView.layer.shadowColor = UIColor(red: 0.00, green: 0.00, blue: 0.00, alpha: 0.2).cgColor
smView.layer.shadowOffset = CGSize(width: 0.0, height: 1.0)
smView.layer.shadowOpacity = 1.0
smView.layer.shadowRadius = 2.0
let SMBadge = swiftApi.WalletActiveCouponBadgeModel()
SMBadge._id = "sm"
SMBadge._count = smCount
SMBadge._weight = 2
smImage.image = UIImage(named: "wallet_banner_sm", in: MyEmptyClass.resourceBundle(), compatibleWith: nil)
let GFYBadge = swiftApi.WalletActiveCouponBadgeModel()
GFYBadge._id = "gfy"
GFYBadge._count = gfyCount
GFYBadge._weight = 1
smLabel.text = "SUPERMARKET DEALS"
let BOXBadge = swiftApi.WalletActiveCouponBadgeModel()
BOXBadge._id = "box"
BOXBadge._count = boxCount
BOXBadge._weight = 0
smCountView.layer.cornerRadius = 4.0
smCountView.backgroundColor = UIColor(red: 0.92, green: 0.75, blue: 0.41, alpha: 1.00)
let tempActiveCouponBadges:Array<swiftApi.WalletActiveCouponBadgeModel> = [DFYBadge, SMBadge, GFYBadge, BOXBadge]
// var tempActiveCouponBadges:Array<swiftApi.WalletActiveCouponBadgeModel> = []
// tempActiveCouponBadges.append(DFYBadge)
// tempActiveCouponBadges.append(SMBadge)
// tempActiveCouponBadges.append(GFYBadge)
// tempActiveCouponBadges.append(BOXBadge)
// GFY Banner
// gfyView.backgroundColor = UIColor(red: 0.96, green: 0.97, blue: 0.98, alpha: 1.00)
gfyView.backgroundColor = .white
gfyView.layer.cornerRadius = 16.0
gfyView.layer.shadowColor = UIColor(red: 0.00, green: 0.00, blue: 0.00, alpha: 0.2).cgColor
gfyView.layer.shadowOffset = CGSize(width: 0.0, height: 1.0)
gfyView.layer.shadowOpacity = 1.0
gfyView.layer.shadowRadius = 2.0
let sortedActiveCouponBadges = tempActiveCouponBadges.sorted {
($0._weight) > ($1._weight)
}
.sorted {
($0._count) > ($1._count)
}
gfyImage.image = UIImage(named: "wallet_banner_gfy", in: MyEmptyClass.resourceBundle(), compatibleWith: nil)
activeCouponBadges = sortedActiveCouponBadges
// gfyLabel.text = "GIFTS FOR YOU"
// gfyLabel.text = "Free coupons"
gfyLabel.text = "FREE COUPONS"
collectionView.reloadData();
gfyCountView.layer.cornerRadius = 4.0
gfyCountView.backgroundColor = UIColor(red: 0.92, green: 0.75, blue: 0.41, alpha: 1.00)
}
}
public override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
extension WalletActiveCouponsScrollTableViewCell: UIScrollViewDelegate {
public func scrollViewDidScroll(_ scrollView: UIScrollView) {
let contentOffsetX = scrollView.contentOffset.x
if contentOffsetX >= (scrollView.contentSize.width - scrollView.bounds.width) - 20 {
dotLeftWidth.constant = 8
dotLeftHeight.constant = 8
dotLeft.layer.cornerRadius = 4
dotRightWidth.constant = 12
dotRightHeight.constant = 12
dotRight.layer.cornerRadius = 6
} else {
dotLeftWidth.constant = 12
dotLeftHeight.constant = 12
dotLeft.layer.cornerRadius = 6
dotRightWidth.constant = 8
dotRightHeight.constant = 8
dotRight.layer.cornerRadius = 4
}
}
}
// Configure the view for the selected state
extension WalletActiveCouponsScrollTableViewCell: UICollectionViewDataSource,UICollectionViewDelegate {
public func numberOfSections(in collectionView: UICollectionView) -> Int {
return 1
}
func configureCell(dfyCount: Int, smCount: Int, gfyCount: Int) {
dfyCountLabel.text = String(dfyCount)
smCountLabel.text = String(smCount)
gfyCountLabel.text = String(gfyCount)
public func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return activeCouponBadges.count
}
public func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let badgeId = activeCouponBadges[indexPath.row]._id;
let badgeCount = activeCouponBadges[indexPath.row]._count;
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "WalletActiveCouponCollectionViewCellId", for: indexPath) as! WalletActiveCouponCollectionViewCell
cell.configureCell(badgeId: badgeId, badgeCount: badgeCount)
return cell;
}
public func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
let badgeId = activeCouponBadges[indexPath.row]._id
if (badgeId == "dfy") {
print("Active DFY coupon banner Tapped!")
swiftApi().logTrackersEvent("click", ("LoyaltyWalletScreen:" + "ActiveDealsBanner"))
let couponDetails = swiftApi.ActiveDFYCouponEventModel()
couponDetails._isPressed = true
SwiftEventBus.post("dfy_coupon_details", sender: couponDetails)
} else if (badgeId == "sm") {
let firebaseEvent = swiftApi.LoyaltySDKFirebaseEventModel()
firebaseEvent._eventName = "did_tap_market_active_badge"
firebaseEvent.setParameter = ("screen", "Loyalty Wallet")
SwiftEventBus.post("firebase", sender: firebaseEvent)
swiftApi().logTrackersEvent("click", ("LoyaltyWalletScreen:" + "ActiveMarketBanner"))
let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self))
let vc = storyboard.instantiateViewController(withIdentifier: "UnifiedCouponsViewController") as! SwiftWarplyFramework.UnifiedCouponsViewController
parent?.navigationController?.pushViewController(vc, animated: true)
} else if (badgeId == "gfy") {
let firebaseEvent = swiftApi.LoyaltySDKFirebaseEventModel()
firebaseEvent._eventName = "did_tap_gifts_for_you_active_badge"
firebaseEvent.setParameter = ("screen", "Loyalty Wallet")
SwiftEventBus.post("firebase", sender: firebaseEvent)
swiftApi().logTrackersEvent("click", ("LoyaltyWalletScreen:" + "ActiveLoyaltyBanner"))
let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: SwiftWarplyFramework.CouponsViewController.self))
if let vc = storyboard.instantiateViewController(withIdentifier: "CouponsViewController") as? SwiftWarplyFramework.CouponsViewController{
parent?.navigationController?.pushViewController(vc,animated: true)
}
} else if (badgeId == "box") {
print("Active BOX coupon banner Tapped!")
let firebaseEvent = swiftApi.LoyaltySDKFirebaseEventModel()
firebaseEvent._eventName = "did_tap_box_active_badge"
firebaseEvent.setParameter = ("screen", "Loyalty Wallet")
SwiftEventBus.post("firebase", sender: firebaseEvent)
swiftApi().logTrackersEvent("click", ("LoyaltyWalletScreen:" + "ActiveBoxBanner"))
// SwiftEventBus.post("box_coupon_details")
let couponDetails = swiftApi.ActiveBoxCouponEventModel()
couponDetails._isPressed = true
SwiftEventBus.post("box_coupon_details", sender: couponDetails)
}
}
// Distance Between Item Cells
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat {
return 5
}
// Cell Margin
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -> UIEdgeInsets {
return UIEdgeInsets(top: 0, left: 5, bottom: 0, right: 0)
}
}
......
......@@ -69,6 +69,7 @@ import SwiftEventBus
public var loyaltyBadge:swiftApi.LoyaltyBadgeModel = swiftApi().getLoyaltyBadge()
public var profile:swiftApi.ProfileModel? = swiftApi().getConsumer()
public var unifiedCoupons:Array<swiftApi.UnifiedCouponModel> = []
public var boxCoupons:Array<swiftApi.ActiveBoxCouponModel> = swiftApi().getActiveBoxCoupons()
var timerWallet: DispatchSourceTimer?
var seconds: Int = 0
......@@ -1386,8 +1387,9 @@ extension WalletViewController: UITableViewDelegate, UITableViewDataSource{
if (indexPath.section == 0) {
let cell = tableView.dequeueReusableCell(withIdentifier: "WalletActiveCouponsTableViewCellId", for: indexPath) as! WalletActiveCouponsTableViewCell
cell.configureCell(dfyCount: self.dfyCoupons.count, smCount: self.unifiedCoupons.count, gfyCount: self.coupons.count)
let cell = tableView.dequeueReusableCell(withIdentifier: "WalletActiveCouponsScrollTableViewCellId", for: indexPath) as! WalletActiveCouponsScrollTableViewCell
cell.configureCell(dfyCount: self.dfyCoupons.count, smCount: self.unifiedCoupons.count, gfyCount: self.coupons.count, boxCount: self.boxCoupons.count)
cell.parent = self
return cell
} else if (indexPath.section == 1) {
......
......@@ -4920,6 +4920,24 @@ public class swiftApi {
}
public class WarplyBoxAnalysisEventModel {
private var isPressed: Bool
public init() {
self.isPressed = false
}
public var _isPressed: Bool {
get { // getter
return self.isPressed
}
set(newValue) { //setter
self.isPressed = newValue
}
}
}
public class ActiveDFYCouponEventModel {
private var isPressed: Bool
......@@ -4938,6 +4956,24 @@ public class swiftApi {
}
public class ActiveBoxCouponEventModel {
private var isPressed: Bool
public init() {
self.isPressed = false
}
public var _isPressed: Bool {
get { // getter
return self.isPressed
}
set(newValue) { //setter
self.isPressed = newValue
}
}
}
public class WarplyCCMSEnabledModel {
private var isActivated: Bool
......