Manos Chorianopoulos

add firebase events v1

......@@ -235,6 +235,11 @@ var timer2: DispatchSourceTimer?
SwiftEventBus.post("pacing", sender: pacingEvent)
if (swiftApi().getTrackingStepsEnabled() == false) {
let firebaseEvent = swiftApi.LoyaltySDKFirebaseEventModel()
firebaseEvent._eventName = "lovalty_steps_activation"
firebaseEvent._parameters = nil
SwiftEventBus.post("firebase", sender: firebaseEvent)
self.startTrackingSteps()
}
......
......@@ -151,6 +151,13 @@ extension GiftsViewController: UITableViewDelegate, UITableViewDataSource{
public func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if (campaigns[indexPath.row]._ccms != nil) {
let firebaseEvent = swiftApi.LoyaltySDKFirebaseEventModel()
firebaseEvent._eventName = "loyalty_sdk_offer_selected"
firebaseEvent.setParameter = ("name", (campaigns[indexPath.row]._ccms?._title ?? ""))
firebaseEvent.setParameter = ("type", "gift")
SwiftEventBus.post("firebase", sender: firebaseEvent)
let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self))
let vc = storyboard.instantiateViewController(withIdentifier: "ContextualViewController") as! SwiftWarplyFramework.ContextualViewController
vc.ccms = campaigns[indexPath.row]._ccms
......@@ -189,6 +196,13 @@ extension GiftsViewController: UITableViewDelegate, UITableViewDataSource{
for item in couponsetsList {
if (item.uuid == couponsetUuid) {
let firebaseEvent = swiftApi.LoyaltySDKFirebaseEventModel()
firebaseEvent._eventName = "loyalty_sdk_offer_selected"
firebaseEvent.setParameter = ("name", (item?.name ?? ""))
firebaseEvent.setParameter = ("type", "coupon")
SwiftEventBus.post("firebase", sender: firebaseEvent)
let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self))
let vc = storyboard.instantiateViewController(withIdentifier: "CouponViewController") as! SwiftWarplyFramework.CouponViewController
vc.couponset = item
......
......@@ -125,6 +125,13 @@ extension MFYViewController: UITableViewDelegate, UITableViewDataSource{
public func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if (campaigns[indexPath.row]._ccms != nil) {
let firebaseEvent = swiftApi.LoyaltySDKFirebaseEventModel()
firebaseEvent._eventName = "loyalty_sdk_offer_selected"
firebaseEvent.setParameter = ("name", (campaigns[indexPath.row]._ccms?._title ?? ""))
firebaseEvent.setParameter = ("type", "gift")
SwiftEventBus.post("firebase", sender: firebaseEvent)
let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self))
let vc = storyboard.instantiateViewController(withIdentifier: "ContextualViewController") as! SwiftWarplyFramework.ContextualViewController
vc.ccms = campaigns[indexPath.row]._ccms
......@@ -162,6 +169,13 @@ extension MFYViewController: UITableViewDelegate, UITableViewDataSource{
for item in couponsetsList {
if (item.uuid == couponsetUuid) {
let firebaseEvent = swiftApi.LoyaltySDKFirebaseEventModel()
firebaseEvent._eventName = "loyalty_sdk_offer_selected"
firebaseEvent.setParameter = ("name", (item?.name ?? ""))
firebaseEvent.setParameter = ("type", "coupon")
SwiftEventBus.post("firebase", sender: firebaseEvent)
let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self))
let vc = storyboard.instantiateViewController(withIdentifier: "CouponViewController") as! SwiftWarplyFramework.CouponViewController
vc.couponset = item
......
......@@ -375,9 +375,19 @@ import SwiftEventBus
let dealsAnalysis = swiftApi.WarplyDealsAnalysisEventModel()
dealsAnalysis._isPressed = true
SwiftEventBus.post("analysis_pressed", sender: dealsAnalysis)
let firebaseEvent = swiftApi.LoyaltySDKFirebaseEventModel()
firebaseEvent._eventName = "did_tap_gifts_for_you_badge"
firebaseEvent.setParameter = ("screen", "Loyalty Wallet")
SwiftEventBus.post("firebase", sender: firebaseEvent)
}
@IBAction func couponEarnButtonAction(_ sender: Any) {
let firebaseEvent = swiftApi.LoyaltySDKFirebaseEventModel()
firebaseEvent._eventName = "did_tap_deals_for_you_badge"
firebaseEvent.setParameter = ("screen", "Loyalty Wallet")
SwiftEventBus.post("firebase", sender: firebaseEvent)
let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self))
let vc = storyboard.instantiateViewController(withIdentifier: "LoyaltyAnalysisViewController") as! SwiftWarplyFramework.LoyaltyAnalysisViewController
self.navigationController?.pushViewController(vc, animated: true)
......
......@@ -2675,7 +2675,7 @@ public class swiftApi {
public class LoyaltySDKFirebaseEventModel {
private var eventName: String
private var parameters: [String: String]
private var parameters: [String: String]?
public init() {
......@@ -2693,7 +2693,7 @@ public class swiftApi {
}
}
public var _parameters: [String: String] {
public var _parameters: [String: String]? {
get { // getter
return self.parameters
}
......@@ -2709,7 +2709,7 @@ public class swiftApi {
return (key: "", value: "")
}
set(newValue) { //setter
self.parameters.updateValue(newValue.1, forKey: newValue.0)
self.parameters?.updateValue(newValue.1, forKey: newValue.0)
}
}
......@@ -4936,6 +4936,13 @@ public class swiftApi {
for item in couponsetsList {
if (item.uuid == couponsetUuid) {
let firebaseEvent = swiftApi.LoyaltySDKFirebaseEventModel()
firebaseEvent._eventName = "loyalty_sdk_offer_selected"
firebaseEvent.setParameter = ("name", (item.name ?? ""))
firebaseEvent.setParameter = ("type", "coupon")
SwiftEventBus.post("firebase", sender: firebaseEvent)
let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self))
let vc = storyboard.instantiateViewController(withIdentifier: "CouponViewController") as! SwiftWarplyFramework.CouponViewController
vc.couponset = item
......@@ -4983,6 +4990,13 @@ public class swiftApi {
// if (((ccms._loyaltyCampaignId == "") || (ccms._loyaltyCampaignId == "NA")) && ((ccms._zone == "COSMOTE_APP_GIFTS4U") || (ccms._zone == "COSMOTE_APP_MORE4U"))) {
if ((ccms._loyaltyCampaignId == "") || (ccms._loyaltyCampaignId == "NA")) {
let firebaseEvent = swiftApi.LoyaltySDKFirebaseEventModel()
firebaseEvent._eventName = "loyalty_sdk_offer_selected"
firebaseEvent.setParameter = ("name", (ccms._title))
firebaseEvent.setParameter = ("type", "gift")
SwiftEventBus.post("firebase", sender: firebaseEvent)
let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self))
let vc = storyboard.instantiateViewController(withIdentifier: "ContextualViewController") as! SwiftWarplyFramework.ContextualViewController
vc.ccms = ccms
......