Manos Chorianopoulos

webview sm coupons and active coupons fixes

......@@ -749,7 +749,17 @@ var timer2: DispatchSourceTimer?
} else if (eventArray[1] == "loyaltyWallet") {
// event:loyaltyWallet
SwiftEventBus.post("refresh_vouchers")
SwiftEventBus.post("open_my_rewards")
// SwiftEventBus.post("open_my_rewards")
swiftApi().getUnifiedCouponsDeals { unifiedCoupons in
let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self))
let vc = storyboard.instantiateViewController(withIdentifier: "UnifiedCouponsViewController") as! SwiftWarplyFramework.UnifiedCouponsViewController
self.navigationController?.pushViewController(vc, animated: true)
} failureCallback: { errorCode in
let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self))
let vc = storyboard.instantiateViewController(withIdentifier: "UnifiedCouponsViewController") as! SwiftWarplyFramework.UnifiedCouponsViewController
self.navigationController?.pushViewController(vc, animated: true)
}
// let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self))
// let vc = storyboard.instantiateViewController(withIdentifier: "WalletViewController") as! SwiftWarplyFramework.WalletViewController
......@@ -803,14 +813,33 @@ var timer2: DispatchSourceTimer?
} else if (eventArray[1] == "activeCoupons") {
// event:activeCoupons
swiftApi().getUnifiedCouponsDeals { unifiedCoupons in
let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self))
let vc = storyboard.instantiateViewController(withIdentifier: "UnifiedCouponsViewController") as! SwiftWarplyFramework.UnifiedCouponsViewController
self.navigationController?.pushViewController(vc, animated: true)
} failureCallback: { errorCode in
let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self))
let vc = storyboard.instantiateViewController(withIdentifier: "UnifiedCouponsViewController") as! SwiftWarplyFramework.UnifiedCouponsViewController
self.navigationController?.pushViewController(vc, animated: true)
swiftApi().getCouponsAsync(getCouponsCallback, failureCallback: {errorCode in })
func getCouponsCallback (_ couponsData: Array<swiftApi.CouponItemModel>?) -> Void {
if (couponsData != nil) {
DispatchQueue.main.async {
SwiftEventBus.post("coupons_fetched")
}
} else {
}
}
swiftApi().getCampaignsAsyncNew(language: "en", filters: [String : Any](), getCampaignsCallback, failureCallback: {errorCode in })
func getCampaignsCallback (_ campaignsData: Array<swiftApi.CampaignItemModel>?) -> Void {
if (campaignsData != nil) {
DispatchQueue.main.async {
SwiftEventBus.post("campaigns_retrieved")
}
} else {
}
}
DispatchQueue.main.asyncAfter(deadline: .now() + 1.5) {
let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: SwiftWarplyFramework.CouponsViewController.self))
if let vc = storyboard.instantiateViewController(withIdentifier: "CouponsViewController") as? SwiftWarplyFramework.CouponsViewController{
self.navigationController?.pushViewController(vc,animated: true)
}
}
}
......