Showing
1 changed file
with
60 additions
and
0 deletions
| ... | @@ -3678,4 +3678,64 @@ public class swiftApi { | ... | @@ -3678,4 +3678,64 @@ public class swiftApi { |
| 3678 | } | 3678 | } |
| 3679 | } | 3679 | } |
| 3680 | 3680 | ||
| 3681 | + | ||
| 3682 | + public func handleLoyaltyCampaigns(_ campaign: CampaignItemModel, _ controller: UIViewController) -> Void { | ||
| 3683 | + if (campaign._campaign_type == "coupon") { | ||
| 3684 | + let couponsetUuid = campaign._couponset | ||
| 3685 | + | ||
| 3686 | + if (couponsetUuid != "") { | ||
| 3687 | + let couponsetsList = swiftApi().getCouponSetList() | ||
| 3688 | + | ||
| 3689 | + for item in couponsetsList { | ||
| 3690 | + if (item.uuid == couponsetUuid) { | ||
| 3691 | + let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self)) | ||
| 3692 | + let vc = storyboard.instantiateViewController(withIdentifier: "CouponViewController") as! SwiftWarplyFramework.CouponViewController | ||
| 3693 | + vc.couponset = item | ||
| 3694 | + vc.campaign = campaign | ||
| 3695 | + controller.navigationController?.pushViewController(vc, animated: true) | ||
| 3696 | + | ||
| 3697 | + break; | ||
| 3698 | + } | ||
| 3699 | + } | ||
| 3700 | + } | ||
| 3701 | + | ||
| 3702 | + } else { | ||
| 3703 | + let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self)) | ||
| 3704 | + let vc = storyboard.instantiateViewController(withIdentifier: "CampaignViewController") as! SwiftWarplyFramework.CampaignViewController | ||
| 3705 | + | ||
| 3706 | + vc.campaignUrl = swiftApi().constructCampaignUrl(campaign) | ||
| 3707 | + controller.navigationController?.pushViewController(vc, animated: true) | ||
| 3708 | + } | ||
| 3709 | + } | ||
| 3710 | + | ||
| 3711 | + | ||
| 3712 | + public func handleContextualCampaigns(_ ccms: LoyaltyContextualOfferModel, _ controller: UIViewController) -> Void { | ||
| 3713 | + | ||
| 3714 | + let allCampaigns = swiftApi().getAllCampaignList() | ||
| 3715 | + | ||
| 3716 | + for loyaltyCampaign in allCampaigns { | ||
| 3717 | + let isCcmsOffer = (loyaltyCampaign.ccms_offer != nil) && (loyaltyCampaign.ccms_offer != "") && (loyaltyCampaign.ccms_offer == "true") | ||
| 3718 | + let isTelco = (loyaltyCampaign._type != nil && loyaltyCampaign._type == "telco") | ||
| 3719 | + | ||
| 3720 | + if (isCcmsOffer && (loyaltyCampaign.session_uuid == ccms._loyaltyCampaignId)) { | ||
| 3721 | + | ||
| 3722 | + let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self)) | ||
| 3723 | + let vc = storyboard.instantiateViewController(withIdentifier: "CampaignViewController") as! SwiftWarplyFramework.CampaignViewController | ||
| 3724 | + vc.campaignUrl = swiftApi().constructCcmsUrl(loyaltyCampaign, ccms) | ||
| 3725 | + controller.navigationController?.pushViewController(vc, animated: true) | ||
| 3726 | + break; | ||
| 3727 | + | ||
| 3728 | + } else if (isTelco && (loyaltyCampaign.session_uuid == ccms._loyaltyCampaignId)) { | ||
| 3729 | + | ||
| 3730 | + let storyboard = UIStoryboard(name: "Main", bundle: Bundle(for: MyEmptyClass.self)) | ||
| 3731 | + let vc = storyboard.instantiateViewController(withIdentifier: "TelcoViewController") as! SwiftWarplyFramework.TelcoViewController | ||
| 3732 | + vc.ccms = ccms | ||
| 3733 | + vc.campaign = loyaltyCampaign | ||
| 3734 | + controller.navigationController?.pushViewController(vc, animated: true) | ||
| 3735 | + break; | ||
| 3736 | + | ||
| 3737 | + } | ||
| 3738 | + } | ||
| 3739 | + } | ||
| 3740 | + | ||
| 3681 | } | 3741 | } | ... | ... |
-
Please register or login to post a comment