Manos Chorianopoulos

jwt changes logout

...@@ -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
......
...@@ -7590,10 +7590,55 @@ public class swiftApi { ...@@ -7590,10 +7590,55 @@ public class swiftApi {
7590 } 7590 }
7591 7591
7592 7592
7593 + // public func logout(_ logoutCallback: @escaping (_ responseData: VerifyTicketResponseModel?) -> Void) -> Void {
7594 +
7595 + // let instanceOfMyApi = MyApi()
7596 + // let responseData = instanceOfMyApi.logout() as [AnyHashable: Any]?
7597 +
7598 + // if let responseDataDictionary = responseData as? [String: Any] {
7599 +
7600 + // let tempResponse = VerifyTicketResponseModel(dictionary: responseDataDictionary)
7601 +
7602 + // if (tempResponse.getStatus == 1) {
7603 + // let dynatraceEvent = swiftApi.LoyaltySDKDynatraceEventModel()
7604 + // dynatraceEvent._eventName = "custom_success_logout_loyalty"
7605 + // dynatraceEvent._parameters = nil
7606 + // SwiftEventBus.post("dynatrace", sender: dynatraceEvent)
7607 +
7608 + // swiftApi().setUserTag("")
7609 + // swiftApi().setUserNonTelco(false)
7610 + // swiftApi().setCCMSLoyaltyCampaigns(campaigns: [])
7611 +
7612 + // let accessToken = instanceOfMyApi.getAccessTokenM()
7613 + // print("=================== TOKEN DELETED =========================")
7614 + // print("Bearer: ", accessToken)
7615 + // print("=================== TOKEN DELETED =========================")
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 + // }
7635 +
7593 public func logout(_ logoutCallback: @escaping (_ responseData: VerifyTicketResponseModel?) -> Void) -> Void { 7636 public func logout(_ logoutCallback: @escaping (_ responseData: VerifyTicketResponseModel?) -> Void) -> Void {
7594 7637
7595 let instanceOfMyApi = MyApi() 7638 let instanceOfMyApi = MyApi()
7596 - let responseData = instanceOfMyApi.logout() as [AnyHashable: Any]? 7639 + instanceOfMyApi.logout(successCallback, failureBlock: failureCallback)
7640 +
7641 + func successCallback(_ responseData: [AnyHashable : Any]?) -> Void {
7597 7642
7598 if let responseDataDictionary = responseData as? [String: Any] { 7643 if let responseDataDictionary = responseData as? [String: Any] {
7599 7644
...@@ -7633,6 +7678,17 @@ public class swiftApi { ...@@ -7633,6 +7678,17 @@ public class swiftApi {
7633 } 7678 }
7634 } 7679 }
7635 7680
7681 + func failureCallback(_ error: Error?) -> Void {
7682 + let dynatraceEvent = swiftApi.LoyaltySDKDynatraceEventModel()
7683 + dynatraceEvent._eventName = "custom_error_logout_loyalty"
7684 + dynatraceEvent._parameters = nil
7685 + SwiftEventBus.post("dynatrace", sender: dynatraceEvent)
7686 +
7687 + logoutCallback(nil)
7688 + }
7689 +
7690 + }
7691 +
7636 7692
7637 public func didReceiveNotification(_ payload: [String : Any]) -> Void { 7693 public func didReceiveNotification(_ payload: [String : Any]) -> Void {
7638 7694
......