Showing
3 changed files
with
32 additions
and
13 deletions
No preview for this file type
... | @@ -159,6 +159,7 @@ typedef void (^FailureResponse)(NSURLSessionDataTask * _Nullable task, NSError * | ... | @@ -159,6 +159,7 @@ typedef void (^FailureResponse)(NSURLSessionDataTask * _Nullable task, NSError * |
159 | /////////////////////////////////////////////////////////////////////////////// | 159 | /////////////////////////////////////////////////////////////////////////////// |
160 | + (void)launchWithAppUUIDWithCallback:(NSString *)appUUID launchOptions:(NSDictionary *)launchOptions customPushDelegate:(id <WLCustomPushHandler>)customPushDelegate serverBaseUrl:(NSString *)url andSuccessBlock:(void (^)(NSDictionary *))success andFailureBlock:(void (^)(NSError *error))failure | 160 | + (void)launchWithAppUUIDWithCallback:(NSString *)appUUID launchOptions:(NSDictionary *)launchOptions customPushDelegate:(id <WLCustomPushHandler>)customPushDelegate serverBaseUrl:(NSString *)url andSuccessBlock:(void (^)(NSDictionary *))success andFailureBlock:(void (^)(NSError *error))failure |
161 | { | 161 | { |
162 | + NSLog(@"=== _sharedService: %@", _sharedService ); | ||
162 | //Launch Once | 163 | //Launch Once |
163 | if (_sharedService != nil) { | 164 | if (_sharedService != nil) { |
164 | // TODO: Maybe add failure callback here? - msg: "already launched" | 165 | // TODO: Maybe add failure callback here? - msg: "already launched" |
... | @@ -1907,13 +1908,17 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) | ... | @@ -1907,13 +1908,17 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) |
1907 | WL_FMDBLogError | 1908 | WL_FMDBLogError |
1908 | 1909 | ||
1909 | [_db executeUpdate:@"INSERT INTO requestVariables (id, client_id, client_secret, access_token, refresh_token) VALUES (1, ?, ?, ?, ?)", clientId, clientSecret, accessToken, refreshToken]; | 1910 | [_db executeUpdate:@"INSERT INTO requestVariables (id, client_id, client_secret, access_token, refresh_token) VALUES (1, ?, ?, ?, ?)", clientId, clientSecret, accessToken, refreshToken]; |
1910 | - | 1911 | + |
1911 | - NSDictionary *successResponse = @{@"result": @"success", @"status":@1}; | 1912 | + NSNumber* status = [NSNumber alloc]; |
1913 | + status = [contextResponse objectForKey:@"result"]; | ||
1914 | + NSString* result = @""; | ||
1915 | + result = [status isEqual: @1] ? @"success" : @"error"; | ||
1916 | + NSDictionary *successResponse = @{@"result": result, @"status": status}; | ||
1912 | if (success) { | 1917 | if (success) { |
1913 | success(successResponse); | 1918 | success(successResponse); |
1914 | } | 1919 | } |
1915 | NSLog(@"**************** WARPLY Response *****************" ); | 1920 | NSLog(@"**************** WARPLY Response *****************" ); |
1916 | - NSLog(@"%@", successResponse ); | 1921 | + NSLog(@"%@", contextResponse ); |
1917 | } failureBlock:^(NSError *error) { | 1922 | } failureBlock:^(NSError *error) { |
1918 | if (failure) { | 1923 | if (failure) { |
1919 | failure(error); | 1924 | failure(error); |
... | @@ -1945,12 +1950,16 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) | ... | @@ -1945,12 +1950,16 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) |
1945 | 1950 | ||
1946 | [_db executeUpdate:@"INSERT INTO requestVariables (id, client_id, client_secret, access_token, refresh_token) VALUES (1, ?, ?, ?, ?)", clientId, clientSecret, accessToken, refreshToken]; | 1951 | [_db executeUpdate:@"INSERT INTO requestVariables (id, client_id, client_secret, access_token, refresh_token) VALUES (1, ?, ?, ?, ?)", clientId, clientSecret, accessToken, refreshToken]; |
1947 | 1952 | ||
1948 | - NSDictionary *successResponse = @{@"result": @"success", @"status":@1}; | 1953 | + NSNumber* status = [NSNumber alloc]; |
1954 | + status = [contextResponse objectForKey:@"result"]; | ||
1955 | + NSString* result = @""; | ||
1956 | + result = [status isEqual: @1] ? @"success" : @"error"; | ||
1957 | + NSDictionary *successResponse = @{@"result": result, @"status": status}; | ||
1949 | if (success) { | 1958 | if (success) { |
1950 | success(successResponse); | 1959 | success(successResponse); |
1951 | } | 1960 | } |
1952 | NSLog(@"**************** WARPLY Response *****************" ); | 1961 | NSLog(@"**************** WARPLY Response *****************" ); |
1953 | - NSLog(@"%@", successResponse ); | 1962 | + NSLog(@"%@", contextResponse ); |
1954 | } failureBlock:^(NSError *error) { | 1963 | } failureBlock:^(NSError *error) { |
1955 | if (failure) { | 1964 | if (failure) { |
1956 | failure(error); | 1965 | failure(error); | ... | ... |
... | @@ -2456,16 +2456,26 @@ public class swiftApi { | ... | @@ -2456,16 +2456,26 @@ public class swiftApi { |
2456 | 2456 | ||
2457 | if let verifyTicketDataDictionary = verifyTicketData as? [String: Any] { | 2457 | if let verifyTicketDataDictionary = verifyTicketData as? [String: Any] { |
2458 | 2458 | ||
2459 | - let dynatraceEvent = swiftApi.LoyaltySDKDynatraceEventModel() | ||
2460 | - dynatraceEvent._eventName = "custom_success_login_loyalty" | ||
2461 | - dynatraceEvent._parameters = nil | ||
2462 | - SwiftEventBus.post("dynatrace", sender: dynatraceEvent) | ||
2463 | - | ||
2464 | let tempResponse = VerifyTicketResponseModel(dictionary: verifyTicketDataDictionary) | 2459 | let tempResponse = VerifyTicketResponseModel(dictionary: verifyTicketDataDictionary) |
2465 | 2460 | ||
2466 | - verifyTicketCallback(tempResponse); | 2461 | + if (tempResponse.getStatus == 1) { |
2467 | - | 2462 | + let dynatraceEvent = swiftApi.LoyaltySDKDynatraceEventModel() |
2468 | - swiftApi().getProfileAsync(getProfileCallback) | 2463 | + dynatraceEvent._eventName = "custom_success_login_loyalty" |
2464 | + dynatraceEvent._parameters = nil | ||
2465 | + SwiftEventBus.post("dynatrace", sender: dynatraceEvent) | ||
2466 | + | ||
2467 | + verifyTicketCallback(tempResponse); | ||
2468 | + | ||
2469 | + swiftApi().getProfileAsync(getProfileCallback) | ||
2470 | + | ||
2471 | + } else { | ||
2472 | + let dynatraceEvent = swiftApi.LoyaltySDKDynatraceEventModel() | ||
2473 | + dynatraceEvent._eventName = "custom_error_login_loyalty" | ||
2474 | + dynatraceEvent._parameters = nil | ||
2475 | + SwiftEventBus.post("dynatrace", sender: dynatraceEvent) | ||
2476 | + | ||
2477 | + verifyTicketCallback(tempResponse); | ||
2478 | + } | ||
2469 | 2479 | ||
2470 | } else { | 2480 | } else { |
2471 | let dynatraceEvent = swiftApi.LoyaltySDKDynatraceEventModel() | 2481 | let dynatraceEvent = swiftApi.LoyaltySDKDynatraceEventModel() | ... | ... |
-
Please register or login to post a comment