Showing
7 changed files
with
166 additions
and
0 deletions
... | @@ -173,6 +173,10 @@ extension GiftsViewController: UITableViewDelegate, UITableViewDataSource{ | ... | @@ -173,6 +173,10 @@ extension GiftsViewController: UITableViewDelegate, UITableViewDataSource{ |
173 | vc.ccms = campaigns[indexPath.row]._ccms | 173 | vc.ccms = campaigns[indexPath.row]._ccms |
174 | self.navigationController?.pushViewController(vc, animated: true) | 174 | self.navigationController?.pushViewController(vc, animated: true) |
175 | 175 | ||
176 | + if let sessionUuid = campaigns[indexPath.row].session_uuid { | ||
177 | + getSingleCampaignAsyncRequest(sessionUuid: sessionUuid) | ||
178 | + } | ||
179 | + | ||
176 | } else if (campaigns[indexPath.row]._type != nil && campaigns[indexPath.row]._type == "telco") { | 180 | } else if (campaigns[indexPath.row]._type != nil && campaigns[indexPath.row]._type == "telco") { |
177 | let ccmsCampaigns = swiftApi().getCCMSLoyaltyCampaigns() | 181 | let ccmsCampaigns = swiftApi().getCCMSLoyaltyCampaigns() |
178 | let loyaltyCampaignIdExists = ccmsCampaigns.contains { $0._loyaltyCampaignId == campaigns[indexPath.row].session_uuid } | 182 | let loyaltyCampaignIdExists = ccmsCampaigns.contains { $0._loyaltyCampaignId == campaigns[indexPath.row].session_uuid } |
... | @@ -185,6 +189,10 @@ extension GiftsViewController: UITableViewDelegate, UITableViewDataSource{ | ... | @@ -185,6 +189,10 @@ extension GiftsViewController: UITableViewDelegate, UITableViewDataSource{ |
185 | vc.ccms = item | 189 | vc.ccms = item |
186 | vc.campaign = campaigns[indexPath.row] | 190 | vc.campaign = campaigns[indexPath.row] |
187 | self.navigationController?.pushViewController(vc, animated: true) | 191 | self.navigationController?.pushViewController(vc, animated: true) |
192 | + | ||
193 | + if let sessionUuid = campaigns[indexPath.row].session_uuid { | ||
194 | + getSingleCampaignAsyncRequest(sessionUuid: sessionUuid) | ||
195 | + } | ||
188 | break; | 196 | break; |
189 | } | 197 | } |
190 | } | 198 | } |
... | @@ -217,6 +225,10 @@ extension GiftsViewController: UITableViewDelegate, UITableViewDataSource{ | ... | @@ -217,6 +225,10 @@ extension GiftsViewController: UITableViewDelegate, UITableViewDataSource{ |
217 | 225 | ||
218 | self.navigationController?.pushViewController(vc, animated: true) | 226 | self.navigationController?.pushViewController(vc, animated: true) |
219 | 227 | ||
228 | + if let sessionUuid = campaigns[indexPath.row].session_uuid { | ||
229 | + getSingleCampaignAsyncRequest(sessionUuid: sessionUuid) | ||
230 | + } | ||
231 | + | ||
220 | break; | 232 | break; |
221 | } | 233 | } |
222 | } | 234 | } |
... | @@ -272,6 +284,10 @@ extension GiftsViewController: UITableViewDelegate, UITableViewDataSource{ | ... | @@ -272,6 +284,10 @@ extension GiftsViewController: UITableViewDelegate, UITableViewDataSource{ |
272 | vc.params = params | 284 | vc.params = params |
273 | self.navigationController?.pushViewController(vc, animated: true) | 285 | self.navigationController?.pushViewController(vc, animated: true) |
274 | 286 | ||
287 | + if let sessionUuid = campaigns[indexPath.row].session_uuid { | ||
288 | + getSingleCampaignAsyncRequest(sessionUuid: sessionUuid) | ||
289 | + } | ||
290 | + | ||
275 | } else { | 291 | } else { |
276 | let seasonalEvent = swiftApi.LoyaltyGiftsForYouOfferClickEvent() | 292 | let seasonalEvent = swiftApi.LoyaltyGiftsForYouOfferClickEvent() |
277 | seasonalEvent._title = campaigns[indexPath.row]._title ?? "" | 293 | seasonalEvent._title = campaigns[indexPath.row]._title ?? "" |
... | @@ -282,4 +298,17 @@ extension GiftsViewController: UITableViewDelegate, UITableViewDataSource{ | ... | @@ -282,4 +298,17 @@ extension GiftsViewController: UITableViewDelegate, UITableViewDataSource{ |
282 | } | 298 | } |
283 | } | 299 | } |
284 | 300 | ||
301 | + | ||
302 | + func getSingleCampaignAsyncRequest(sessionUuid: String) { | ||
303 | + swiftApi().getSingleCampaignAsync(sessionUuid: sessionUuid, getSingleCampaignCallback) | ||
304 | + } | ||
305 | + | ||
306 | + func getSingleCampaignCallback (_ getSingleCampaignData: swiftApi.VerifyTicketResponseModel?) -> Void { | ||
307 | + if (getSingleCampaignData != nil) { | ||
308 | + DispatchQueue.main.async { | ||
309 | + } | ||
310 | + } else { | ||
311 | + } | ||
312 | + } | ||
313 | + | ||
285 | } | 314 | } | ... | ... |
... | @@ -115,6 +115,10 @@ extension MFYViewController: UITableViewDelegate, UITableViewDataSource{ | ... | @@ -115,6 +115,10 @@ extension MFYViewController: UITableViewDelegate, UITableViewDataSource{ |
115 | vc.ccms = campaigns[indexPath.row]._ccms | 115 | vc.ccms = campaigns[indexPath.row]._ccms |
116 | self.navigationController?.pushViewController(vc, animated: true) | 116 | self.navigationController?.pushViewController(vc, animated: true) |
117 | 117 | ||
118 | + if let sessionUuid = campaigns[indexPath.row].session_uuid { | ||
119 | + getSingleCampaignAsyncRequest(sessionUuid: sessionUuid) | ||
120 | + } | ||
121 | + | ||
118 | } else if (campaigns[indexPath.row]._type != nil && campaigns[indexPath.row]._type == "telco") { | 122 | } else if (campaigns[indexPath.row]._type != nil && campaigns[indexPath.row]._type == "telco") { |
119 | let ccmsCampaigns = swiftApi().getCCMSLoyaltyCampaigns() | 123 | let ccmsCampaigns = swiftApi().getCCMSLoyaltyCampaigns() |
120 | let loyaltyCampaignIdExists = ccmsCampaigns.contains { $0._loyaltyCampaignId == campaigns[indexPath.row].session_uuid } | 124 | let loyaltyCampaignIdExists = ccmsCampaigns.contains { $0._loyaltyCampaignId == campaigns[indexPath.row].session_uuid } |
... | @@ -127,6 +131,10 @@ extension MFYViewController: UITableViewDelegate, UITableViewDataSource{ | ... | @@ -127,6 +131,10 @@ extension MFYViewController: UITableViewDelegate, UITableViewDataSource{ |
127 | vc.ccms = item | 131 | vc.ccms = item |
128 | vc.campaign = campaigns[indexPath.row] | 132 | vc.campaign = campaigns[indexPath.row] |
129 | self.navigationController?.pushViewController(vc, animated: true) | 133 | self.navigationController?.pushViewController(vc, animated: true) |
134 | + | ||
135 | + if let sessionUuid = campaigns[indexPath.row].session_uuid { | ||
136 | + getSingleCampaignAsyncRequest(sessionUuid: sessionUuid) | ||
137 | + } | ||
130 | } | 138 | } |
131 | } | 139 | } |
132 | } | 140 | } |
... | @@ -158,6 +166,10 @@ extension MFYViewController: UITableViewDelegate, UITableViewDataSource{ | ... | @@ -158,6 +166,10 @@ extension MFYViewController: UITableViewDelegate, UITableViewDataSource{ |
158 | 166 | ||
159 | self.navigationController?.pushViewController(vc, animated: true) | 167 | self.navigationController?.pushViewController(vc, animated: true) |
160 | 168 | ||
169 | + if let sessionUuid = campaigns[indexPath.row].session_uuid { | ||
170 | + getSingleCampaignAsyncRequest(sessionUuid: sessionUuid) | ||
171 | + } | ||
172 | + | ||
161 | break; | 173 | break; |
162 | } | 174 | } |
163 | } | 175 | } |
... | @@ -218,6 +230,23 @@ extension MFYViewController: UITableViewDelegate, UITableViewDataSource{ | ... | @@ -218,6 +230,23 @@ extension MFYViewController: UITableViewDelegate, UITableViewDataSource{ |
218 | vc.campaignUrl = url | 230 | vc.campaignUrl = url |
219 | vc.params = params | 231 | vc.params = params |
220 | self.navigationController?.pushViewController(vc, animated: true) | 232 | self.navigationController?.pushViewController(vc, animated: true) |
233 | + | ||
234 | + if let sessionUuid = campaigns[indexPath.row].session_uuid { | ||
235 | + getSingleCampaignAsyncRequest(sessionUuid: sessionUuid) | ||
236 | + } | ||
237 | + } | ||
238 | + } | ||
239 | + | ||
240 | + | ||
241 | + func getSingleCampaignAsyncRequest(sessionUuid: String) { | ||
242 | + swiftApi().getSingleCampaignAsync(sessionUuid: sessionUuid, getSingleCampaignCallback) | ||
243 | + } | ||
244 | + | ||
245 | + func getSingleCampaignCallback (_ getSingleCampaignData: swiftApi.VerifyTicketResponseModel?) -> Void { | ||
246 | + if (getSingleCampaignData != nil) { | ||
247 | + DispatchQueue.main.async { | ||
248 | + } | ||
249 | + } else { | ||
221 | } | 250 | } |
222 | } | 251 | } |
223 | 252 | ... | ... |
... | @@ -103,6 +103,7 @@ | ... | @@ -103,6 +103,7 @@ |
103 | - (void)didReceiveNotification:(NSDictionary *)payload; | 103 | - (void)didReceiveNotification:(NSDictionary *)payload; |
104 | - (void)sendDeviceInfoIfNecessary:(NSString *)newDeviceToken; | 104 | - (void)sendDeviceInfoIfNecessary:(NSString *)newDeviceToken; |
105 | - (void)editProfileAsync:(NSString*)firstname andLastname:(NSString*)lastname andEmail:(NSString *)email andSalutation:(NSString *)salutation andMsisdn:(NSString *)msisdn andNickname:(NSString *)nickname andGender:(NSString *)gender andBirthday:(NSString *)birthday andNameDay:(NSString *)nameday andTaxID:(NSString *)taxid andProfileMetadata:(NSDictionary *)profileMetadata optin:(NSNumber *)optin newsLetter:(NSNumber *)newsletter andSMS:(NSNumber *)sms andSegmentation:(NSNumber *)segmentation andSMSSegmentation:(NSNumber *)smsSegmentation :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure; | 105 | - (void)editProfileAsync:(NSString*)firstname andLastname:(NSString*)lastname andEmail:(NSString *)email andSalutation:(NSString *)salutation andMsisdn:(NSString *)msisdn andNickname:(NSString *)nickname andGender:(NSString *)gender andBirthday:(NSString *)birthday andNameDay:(NSString *)nameday andTaxID:(NSString *)taxid andProfileMetadata:(NSDictionary *)profileMetadata optin:(NSNumber *)optin newsLetter:(NSNumber *)newsletter andSMS:(NSNumber *)sms andSegmentation:(NSNumber *)segmentation andSMSSegmentation:(NSNumber *)smsSegmentation :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure; |
106 | +- (void)getSingleCampaignAsync:(NSString*)sessionUuid :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure; | ||
106 | 107 | ||
107 | @end | 108 | @end |
108 | #endif /* MyApi_h */ | 109 | #endif /* MyApi_h */ | ... | ... |
... | @@ -1627,4 +1627,16 @@ NSString *VERIFY_URL = @"/partners/cosmote/verify"; | ... | @@ -1627,4 +1627,16 @@ NSString *VERIFY_URL = @"/partners/cosmote/verify"; |
1627 | }]; | 1627 | }]; |
1628 | } | 1628 | } |
1629 | 1629 | ||
1630 | +- (void)getSingleCampaignAsync:(NSString*)sessionUuid :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure { | ||
1631 | + [[Warply sharedService] getSingleCampaignWithSuccessBlock:sessionUuid :^(NSDictionary *response) { | ||
1632 | + if (success) { | ||
1633 | + success(response); | ||
1634 | + } | ||
1635 | + } failureBlock:^(NSError *error) { | ||
1636 | + if (failure) { | ||
1637 | + failure(error); | ||
1638 | + } | ||
1639 | + }]; | ||
1640 | +} | ||
1641 | + | ||
1630 | @end | 1642 | @end | ... | ... |
... | @@ -402,6 +402,9 @@ WL_VERSION_INTERFACE() | ... | @@ -402,6 +402,9 @@ WL_VERSION_INTERFACE() |
402 | - (void) validateCouponWithSuccessBlock:(NSString*) coupon :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure; | 402 | - (void) validateCouponWithSuccessBlock:(NSString*) coupon :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure; |
403 | 403 | ||
404 | - (void)loginCosmoteWithSuccessBlock:(NSString*)guid andAppUuid:(NSString*)appUuid andTicket:(NSString*)ticket :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure; | 404 | - (void)loginCosmoteWithSuccessBlock:(NSString*)guid andAppUuid:(NSString*)appUuid andTicket:(NSString*)ticket :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure; |
405 | + | ||
406 | +- (void)getSingleCampaignWithSuccessBlock:(NSString *)sessionUuid :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure; | ||
407 | + | ||
405 | /*! | 408 | /*! |
406 | @abstract Get the full page add accordint to the display_type of a campaign. | 409 | @abstract Get the full page add accordint to the display_type of a campaign. |
407 | @attributeblock successBlock This block is called when getInbox is sucessful and allOffers is empty or nil and returns an array with the available WLInboxItem items. Otherwise, the allOffers array is filtered. | 410 | @attributeblock successBlock This block is called when getInbox is sucessful and allOffers is empty or nil and returns an array with the available WLInboxItem items. Otherwise, the allOffers array is filtered. | ... | ... |
This diff is collapsed. Click to expand it.
... | @@ -4921,6 +4921,10 @@ public class swiftApi { | ... | @@ -4921,6 +4921,10 @@ public class swiftApi { |
4921 | vc.campaign = campaign | 4921 | vc.campaign = campaign |
4922 | controller.navigationController?.pushViewController(vc, animated: true) | 4922 | controller.navigationController?.pushViewController(vc, animated: true) |
4923 | 4923 | ||
4924 | + if let sessionUuid = campaign.session_uuid { | ||
4925 | + getSingleCampaignAsyncRequest(sessionUuid: sessionUuid) | ||
4926 | + } | ||
4927 | + | ||
4924 | break; | 4928 | break; |
4925 | } | 4929 | } |
4926 | } | 4930 | } |
... | @@ -4933,6 +4937,22 @@ public class swiftApi { | ... | @@ -4933,6 +4937,22 @@ public class swiftApi { |
4933 | vc.campaignUrl = swiftApi().constructCampaignUrl(campaign) | 4937 | vc.campaignUrl = swiftApi().constructCampaignUrl(campaign) |
4934 | vc.params = swiftApi().constructCampaignParams(campaign) | 4938 | vc.params = swiftApi().constructCampaignParams(campaign) |
4935 | controller.navigationController?.pushViewController(vc, animated: true) | 4939 | controller.navigationController?.pushViewController(vc, animated: true) |
4940 | + | ||
4941 | + if let sessionUuid = campaign.session_uuid { | ||
4942 | + getSingleCampaignAsyncRequest(sessionUuid: sessionUuid) | ||
4943 | + } | ||
4944 | + } | ||
4945 | + | ||
4946 | + func getSingleCampaignAsyncRequest(sessionUuid: String) { | ||
4947 | + swiftApi().getSingleCampaignAsync(sessionUuid: sessionUuid, getSingleCampaignCallback) | ||
4948 | + } | ||
4949 | + | ||
4950 | + func getSingleCampaignCallback (_ getSingleCampaignData: swiftApi.VerifyTicketResponseModel?) -> Void { | ||
4951 | + if (getSingleCampaignData != nil) { | ||
4952 | + DispatchQueue.main.async { | ||
4953 | + } | ||
4954 | + } else { | ||
4955 | + } | ||
4936 | } | 4956 | } |
4937 | } | 4957 | } |
4938 | 4958 | ||
... | @@ -4962,6 +4982,10 @@ public class swiftApi { | ... | @@ -4962,6 +4982,10 @@ public class swiftApi { |
4962 | vc.campaignUrl = swiftApi().constructCcmsUrl(loyaltyCampaign, ccms) | 4982 | vc.campaignUrl = swiftApi().constructCcmsUrl(loyaltyCampaign, ccms) |
4963 | vc.params = swiftApi().constructCcmsParams(loyaltyCampaign, ccms) | 4983 | vc.params = swiftApi().constructCcmsParams(loyaltyCampaign, ccms) |
4964 | controller.navigationController?.pushViewController(vc, animated: true) | 4984 | controller.navigationController?.pushViewController(vc, animated: true) |
4985 | + | ||
4986 | + if let sessionUuid = loyaltyCampaign.session_uuid { | ||
4987 | + getSingleCampaignAsyncRequest(sessionUuid: sessionUuid) | ||
4988 | + } | ||
4965 | break; | 4989 | break; |
4966 | 4990 | ||
4967 | } else if (isTelco && (loyaltyCampaign.session_uuid == ccms._loyaltyCampaignId)) { | 4991 | } else if (isTelco && (loyaltyCampaign.session_uuid == ccms._loyaltyCampaignId)) { |
... | @@ -4971,11 +4995,27 @@ public class swiftApi { | ... | @@ -4971,11 +4995,27 @@ public class swiftApi { |
4971 | vc.ccms = ccms | 4995 | vc.ccms = ccms |
4972 | vc.campaign = loyaltyCampaign | 4996 | vc.campaign = loyaltyCampaign |
4973 | controller.navigationController?.pushViewController(vc, animated: true) | 4997 | controller.navigationController?.pushViewController(vc, animated: true) |
4998 | + | ||
4999 | + if let sessionUuid = loyaltyCampaign.session_uuid { | ||
5000 | + getSingleCampaignAsyncRequest(sessionUuid: sessionUuid) | ||
5001 | + } | ||
4974 | break; | 5002 | break; |
4975 | 5003 | ||
4976 | } | 5004 | } |
4977 | } | 5005 | } |
4978 | } | 5006 | } |
5007 | + | ||
5008 | + func getSingleCampaignAsyncRequest(sessionUuid: String) { | ||
5009 | + swiftApi().getSingleCampaignAsync(sessionUuid: sessionUuid, getSingleCampaignCallback) | ||
5010 | + } | ||
5011 | + | ||
5012 | + func getSingleCampaignCallback (_ getSingleCampaignData: swiftApi.VerifyTicketResponseModel?) -> Void { | ||
5013 | + if (getSingleCampaignData != nil) { | ||
5014 | + DispatchQueue.main.async { | ||
5015 | + } | ||
5016 | + } else { | ||
5017 | + } | ||
5018 | + } | ||
4979 | } | 5019 | } |
4980 | 5020 | ||
4981 | 5021 | ||
... | @@ -5647,4 +5687,56 @@ public class swiftApi { | ... | @@ -5647,4 +5687,56 @@ public class swiftApi { |
5647 | } | 5687 | } |
5648 | 5688 | ||
5649 | 5689 | ||
5690 | + public func getSingleCampaignAsync(sessionUuid: String, _ getSingleCampaignCallback: @escaping (_ getSingleCampaignData: VerifyTicketResponseModel?) -> Void) -> Void { | ||
5691 | + | ||
5692 | + let instanceOfMyApi = MyApi() | ||
5693 | + instanceOfMyApi.getSingleCampaignAsync(sessionUuid, getSingleCampaignAsyncCallback, failureBlock: getSingleCampaignFailureCallback) | ||
5694 | + | ||
5695 | + func getSingleCampaignAsyncCallback(_ getSingleCampaignData: [AnyHashable: Any]?) -> Void { | ||
5696 | + | ||
5697 | + swiftApi().getCampaignsAsyncNew(language: "en", filters: [String : Any](), getCampaignsCallback) | ||
5698 | + | ||
5699 | + func getCampaignsCallback (_ campaignsData: Array<swiftApi.CampaignItemModel>?) -> Void { | ||
5700 | + if (campaignsData != nil) { | ||
5701 | + DispatchQueue.main.async { | ||
5702 | + } | ||
5703 | + } else { | ||
5704 | + } | ||
5705 | + } | ||
5706 | + | ||
5707 | + if let getSingleCampaignDataDictionary = getSingleCampaignData as? [String: Any] { | ||
5708 | + | ||
5709 | + let tempResponse = VerifyTicketResponseModel(dictionary: getSingleCampaignDataDictionary) | ||
5710 | + | ||
5711 | + getSingleCampaignCallback(tempResponse); | ||
5712 | + | ||
5713 | + if (tempResponse.getStatus == 1) { | ||
5714 | + } | ||
5715 | + | ||
5716 | + } else { | ||
5717 | + getSingleCampaignCallback(nil) | ||
5718 | + } | ||
5719 | + | ||
5720 | + } | ||
5721 | + | ||
5722 | + func getSingleCampaignFailureCallback(_ error: Error?) -> Void { | ||
5723 | + | ||
5724 | + swiftApi().getCampaignsAsyncNew(language: "en", filters: [String : Any](), getCampaignsCallback) | ||
5725 | + | ||
5726 | + func getCampaignsCallback (_ campaignsData: Array<swiftApi.CampaignItemModel>?) -> Void { | ||
5727 | + if (campaignsData != nil) { | ||
5728 | + DispatchQueue.main.async { | ||
5729 | + } | ||
5730 | + } else { | ||
5731 | + } | ||
5732 | + } | ||
5733 | + | ||
5734 | + print("getSingleCampaign error: ") | ||
5735 | + print(error) | ||
5736 | + print("====================") | ||
5737 | + getSingleCampaignCallback(nil) | ||
5738 | + } | ||
5739 | + } | ||
5740 | + | ||
5741 | + | ||
5650 | } | 5742 | } | ... | ... |
-
Please register or login to post a comment