Showing
5 changed files
with
99 additions
and
27 deletions
... | @@ -50,7 +50,8 @@ | ... | @@ -50,7 +50,8 @@ |
50 | - (NSMutableArray *)getTagsCategories; | 50 | - (NSMutableArray *)getTagsCategories; |
51 | - (NSMutableArray *)getTags; | 51 | - (NSMutableArray *)getTags; |
52 | - (NSDictionary *)login:(NSString *)id password:(NSString *)password loginType:(NSString*) loginType; | 52 | - (NSDictionary *)login:(NSString *)id password:(NSString *)password loginType:(NSString*) loginType; |
53 | -- (NSDictionary *)logout; | 53 | +// - (NSDictionary *)logout; |
54 | +- (void) logout:(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure; | ||
54 | - (NSDictionary *)register:(NSString *)id password:(NSString *)password name:(NSString*)name email:(NSString*)email segmentation:(NSNumber*)segmentation newsletter:(NSNumber*)newsletter; | 55 | - (NSDictionary *)register:(NSString *)id password:(NSString *)password name:(NSString*)name email:(NSString*)email segmentation:(NSNumber*)segmentation newsletter:(NSNumber*)newsletter; |
55 | - (NSDictionary *)registerAutoLogin:(NSString *)id password:(NSString *)password name:(NSString*)name email:(NSString*)email segmentation:(NSNumber*)segmentation newsletter:(NSNumber*)newsletter loginType:(NSString*)loginType; | 56 | - (NSDictionary *)registerAutoLogin:(NSString *)id password:(NSString *)password name:(NSString*)name email:(NSString*)email segmentation:(NSNumber*)segmentation newsletter:(NSNumber*)newsletter loginType:(NSString*)loginType; |
56 | - (NSDictionary *)refreshToken; | 57 | - (NSDictionary *)refreshToken; | ... | ... |
... | @@ -638,10 +638,23 @@ NSString *VERIFY_URL = @"/partners/cosmote/verify"; | ... | @@ -638,10 +638,23 @@ NSString *VERIFY_URL = @"/partners/cosmote/verify"; |
638 | return resp; | 638 | return resp; |
639 | } | 639 | } |
640 | 640 | ||
641 | -- (NSDictionary *)logout { | 641 | +// - (NSDictionary *)logout { |
642 | - NSDictionary *response = [NSDictionary alloc]; | 642 | +// NSDictionary *response = [NSDictionary alloc]; |
643 | - response = [[Warply sharedService] logout]; | 643 | +// response = [[Warply sharedService] logout]; |
644 | - return response; | 644 | +// return response; |
645 | +// } | ||
646 | + | ||
647 | +- (void) logout:(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure | ||
648 | +{ | ||
649 | + [[Warply sharedService] logout:^(NSDictionary *response) { | ||
650 | + if (success) { | ||
651 | + success(response); | ||
652 | + } | ||
653 | + } failureBlock:^(NSError *error) { | ||
654 | + if (failure) { | ||
655 | + failure(error); | ||
656 | + } | ||
657 | + }]; | ||
645 | } | 658 | } |
646 | 659 | ||
647 | - (NSDictionary *)register:(NSString *)id password:(NSString *)password name:(NSString*)name email:(NSString*)email segmentation:(NSNumber*)segmentation newsletter:(NSNumber*)newsletter { | 660 | - (NSDictionary *)register:(NSString *)id password:(NSString *)password name:(NSString*)name email:(NSString*)email segmentation:(NSNumber*)segmentation newsletter:(NSNumber*)newsletter { | ... | ... |
... | @@ -325,7 +325,9 @@ WL_VERSION_INTERFACE() | ... | @@ -325,7 +325,9 @@ WL_VERSION_INTERFACE() |
325 | 325 | ||
326 | - (void)loginWithSuccessBlock:(NSString*)id andPassword:(NSString*)password andLoginType:(NSString*)loginType :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure; | 326 | - (void)loginWithSuccessBlock:(NSString*)id andPassword:(NSString*)password andLoginType:(NSString*)loginType :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure; |
327 | 327 | ||
328 | -- (NSDictionary*)logout; | 328 | +// - (NSDictionary*)logout; |
329 | + | ||
330 | +- (void)logout:(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure; | ||
329 | 331 | ||
330 | - (void)webAuthorizeWithSuccessBlock:(NSDictionary*)contextResponse andId:(NSString*)id andLoginType:(NSString*)loginType :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure; | 332 | - (void)webAuthorizeWithSuccessBlock:(NSDictionary*)contextResponse andId:(NSString*)id andLoginType:(NSString*)loginType :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure; |
331 | 333 | ... | ... |
This diff is collapsed. Click to expand it.
... | @@ -7590,40 +7590,95 @@ public class swiftApi { | ... | @@ -7590,40 +7590,95 @@ public class swiftApi { |
7590 | } | 7590 | } |
7591 | 7591 | ||
7592 | 7592 | ||
7593 | - public func logout(_ logoutCallback: @escaping (_ responseData: VerifyTicketResponseModel?) -> Void) -> Void { | 7593 | + // public func logout(_ logoutCallback: @escaping (_ responseData: VerifyTicketResponseModel?) -> Void) -> Void { |
7594 | 7594 | ||
7595 | - let instanceOfMyApi = MyApi() | 7595 | + // let instanceOfMyApi = MyApi() |
7596 | - let responseData = instanceOfMyApi.logout() as [AnyHashable: Any]? | 7596 | + // let responseData = instanceOfMyApi.logout() as [AnyHashable: Any]? |
7597 | 7597 | ||
7598 | - if let responseDataDictionary = responseData as? [String: Any] { | 7598 | + // if let responseDataDictionary = responseData as? [String: Any] { |
7599 | 7599 | ||
7600 | - let tempResponse = VerifyTicketResponseModel(dictionary: responseDataDictionary) | 7600 | + // let tempResponse = VerifyTicketResponseModel(dictionary: responseDataDictionary) |
7601 | 7601 | ||
7602 | - if (tempResponse.getStatus == 1) { | 7602 | + // if (tempResponse.getStatus == 1) { |
7603 | - let dynatraceEvent = swiftApi.LoyaltySDKDynatraceEventModel() | 7603 | + // let dynatraceEvent = swiftApi.LoyaltySDKDynatraceEventModel() |
7604 | - dynatraceEvent._eventName = "custom_success_logout_loyalty" | 7604 | + // dynatraceEvent._eventName = "custom_success_logout_loyalty" |
7605 | - dynatraceEvent._parameters = nil | 7605 | + // dynatraceEvent._parameters = nil |
7606 | - SwiftEventBus.post("dynatrace", sender: dynatraceEvent) | 7606 | + // SwiftEventBus.post("dynatrace", sender: dynatraceEvent) |
7607 | 7607 | ||
7608 | - swiftApi().setUserTag("") | 7608 | + // swiftApi().setUserTag("") |
7609 | - swiftApi().setUserNonTelco(false) | 7609 | + // swiftApi().setUserNonTelco(false) |
7610 | - swiftApi().setCCMSLoyaltyCampaigns(campaigns: []) | 7610 | + // swiftApi().setCCMSLoyaltyCampaigns(campaigns: []) |
7611 | 7611 | ||
7612 | - let accessToken = instanceOfMyApi.getAccessTokenM() | 7612 | + // let accessToken = instanceOfMyApi.getAccessTokenM() |
7613 | - print("=================== TOKEN DELETED =========================") | 7613 | + // print("=================== TOKEN DELETED =========================") |
7614 | - print("Bearer: ", accessToken) | 7614 | + // print("Bearer: ", accessToken) |
7615 | - print("=================== TOKEN DELETED =========================") | 7615 | + // print("=================== TOKEN DELETED =========================") |
7616 | - } else { | 7616 | + // } else { |
7617 | + | ||
7618 | + // let dynatraceEvent = swiftApi.LoyaltySDKDynatraceEventModel() | ||
7619 | + // dynatraceEvent._eventName = "custom_error_logout_loyalty" | ||
7620 | + // dynatraceEvent._parameters = nil | ||
7621 | + // SwiftEventBus.post("dynatrace", sender: dynatraceEvent) | ||
7622 | + // } | ||
7623 | + | ||
7624 | + // logoutCallback(tempResponse); | ||
7625 | + | ||
7626 | + // } else { | ||
7627 | + // let dynatraceEvent = swiftApi.LoyaltySDKDynatraceEventModel() | ||
7628 | + // dynatraceEvent._eventName = "custom_error_logout_loyalty" | ||
7629 | + // dynatraceEvent._parameters = nil | ||
7630 | + // SwiftEventBus.post("dynatrace", sender: dynatraceEvent) | ||
7631 | + | ||
7632 | + // logoutCallback(nil) | ||
7633 | + // } | ||
7634 | + // } | ||
7617 | 7635 | ||
7636 | + public func logout(_ logoutCallback: @escaping (_ responseData: VerifyTicketResponseModel?) -> Void) -> Void { | ||
7637 | + | ||
7638 | + let instanceOfMyApi = MyApi() | ||
7639 | + instanceOfMyApi.logout(successCallback, failureBlock: failureCallback) | ||
7640 | + | ||
7641 | + func successCallback(_ responseData: [AnyHashable : Any]?) -> Void { | ||
7642 | + | ||
7643 | + if let responseDataDictionary = responseData as? [String: Any] { | ||
7644 | + | ||
7645 | + let tempResponse = VerifyTicketResponseModel(dictionary: responseDataDictionary) | ||
7646 | + | ||
7647 | + if (tempResponse.getStatus == 1) { | ||
7648 | + let dynatraceEvent = swiftApi.LoyaltySDKDynatraceEventModel() | ||
7649 | + dynatraceEvent._eventName = "custom_success_logout_loyalty" | ||
7650 | + dynatraceEvent._parameters = nil | ||
7651 | + SwiftEventBus.post("dynatrace", sender: dynatraceEvent) | ||
7652 | + | ||
7653 | + swiftApi().setUserTag("") | ||
7654 | + swiftApi().setUserNonTelco(false) | ||
7655 | + swiftApi().setCCMSLoyaltyCampaigns(campaigns: []) | ||
7656 | + | ||
7657 | + let accessToken = instanceOfMyApi.getAccessTokenM() | ||
7658 | + print("=================== TOKEN DELETED =========================") | ||
7659 | + print("Bearer: ", accessToken) | ||
7660 | + print("=================== TOKEN DELETED =========================") | ||
7661 | + } else { | ||
7662 | + | ||
7663 | + let dynatraceEvent = swiftApi.LoyaltySDKDynatraceEventModel() | ||
7664 | + dynatraceEvent._eventName = "custom_error_logout_loyalty" | ||
7665 | + dynatraceEvent._parameters = nil | ||
7666 | + SwiftEventBus.post("dynatrace", sender: dynatraceEvent) | ||
7667 | + } | ||
7668 | + | ||
7669 | + logoutCallback(tempResponse); | ||
7670 | + | ||
7671 | + } else { | ||
7618 | let dynatraceEvent = swiftApi.LoyaltySDKDynatraceEventModel() | 7672 | let dynatraceEvent = swiftApi.LoyaltySDKDynatraceEventModel() |
7619 | dynatraceEvent._eventName = "custom_error_logout_loyalty" | 7673 | dynatraceEvent._eventName = "custom_error_logout_loyalty" |
7620 | dynatraceEvent._parameters = nil | 7674 | dynatraceEvent._parameters = nil |
7621 | SwiftEventBus.post("dynatrace", sender: dynatraceEvent) | 7675 | SwiftEventBus.post("dynatrace", sender: dynatraceEvent) |
7622 | - } | ||
7623 | 7676 | ||
7624 | - logoutCallback(tempResponse); | 7677 | + logoutCallback(nil) |
7678 | + } | ||
7679 | + } | ||
7625 | 7680 | ||
7626 | - } else { | 7681 | + func failureCallback(_ error: Error?) -> Void { |
7627 | let dynatraceEvent = swiftApi.LoyaltySDKDynatraceEventModel() | 7682 | let dynatraceEvent = swiftApi.LoyaltySDKDynatraceEventModel() |
7628 | dynatraceEvent._eventName = "custom_error_logout_loyalty" | 7683 | dynatraceEvent._eventName = "custom_error_logout_loyalty" |
7629 | dynatraceEvent._parameters = nil | 7684 | dynatraceEvent._parameters = nil |
... | @@ -7631,6 +7686,7 @@ public class swiftApi { | ... | @@ -7631,6 +7686,7 @@ public class swiftApi { |
7631 | 7686 | ||
7632 | logoutCallback(nil) | 7687 | logoutCallback(nil) |
7633 | } | 7688 | } |
7689 | + | ||
7634 | } | 7690 | } |
7635 | 7691 | ||
7636 | 7692 | ... | ... |
-
Please register or login to post a comment