Showing
2 changed files
with
234 additions
and
9 deletions
... | @@ -289,11 +289,27 @@ NSString *VERIFY_URL = @"/partners/cosmote/verify"; | ... | @@ -289,11 +289,27 @@ NSString *VERIFY_URL = @"/partners/cosmote/verify"; |
289 | 289 | ||
290 | - (NSDictionary *) provideInfoForCampaign { | 290 | - (NSDictionary *) provideInfoForCampaign { |
291 | NSMutableDictionary* info = [[NSMutableDictionary alloc] init]; | 291 | NSMutableDictionary* info = [[NSMutableDictionary alloc] init]; |
292 | - // info[@"web_id"] = [Warply sharedService].webId; | 292 | + |
293 | - info[@"web_id"] = [WLKeychain getStringForKey:@"NBWebID"]; | 293 | + @try { |
294 | info[@"app_uuid"] = [WLKeychain getStringForKey:@"NBAPPUuid"]; | 294 | info[@"app_uuid"] = [WLKeychain getStringForKey:@"NBAPPUuid"]; |
295 | - // info[@"api_key"] = self.warply.apiKey; | ||
296 | info[@"api_key"] = [WLKeychain getStringForKey:@"NBAPIKey"]; | 295 | info[@"api_key"] = [WLKeychain getStringForKey:@"NBAPIKey"]; |
296 | + info[@"web_id"] = [WLKeychain getStringForKey:@"NBWebID"]; | ||
297 | + } | ||
298 | + @catch (NSException *exception) { | ||
299 | + NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; | ||
300 | + info[@"app_uuid"] = [defaults stringForKey:@"NBAPPUuidUD"]; | ||
301 | + info[@"api_key"] = [defaults stringForKey:@"NBAPIKeyUD"]; | ||
302 | + info[@"web_id"] = [defaults stringForKey:@"NBWebIDUD"]; | ||
303 | + } | ||
304 | + @finally { | ||
305 | +// NSLog(@"Finally condition"); | ||
306 | + } | ||
307 | + | ||
308 | + // info[@"web_id"] = [Warply sharedService].webId; | ||
309 | +// info[@"web_id"] = [WLKeychain getStringForKey:@"NBWebID"]; | ||
310 | +// info[@"app_uuid"] = [WLKeychain getStringForKey:@"NBAPPUuid"]; | ||
311 | + // info[@"api_key"] = self.warply.apiKey; | ||
312 | +// info[@"api_key"] = [WLKeychain getStringForKey:@"NBAPIKey"]; | ||
297 | Warply* warplyInstance = [[Warply alloc] init]; | 313 | Warply* warplyInstance = [[Warply alloc] init]; |
298 | info[@"access_token"] = [warplyInstance getAccessToken]; | 314 | info[@"access_token"] = [warplyInstance getAccessToken]; |
299 | info[@"refresh_token"] = [warplyInstance getRefreshToken]; | 315 | info[@"refresh_token"] = [warplyInstance getRefreshToken]; | ... | ... |
... | @@ -287,10 +287,36 @@ typedef void (^FailureResponse)(NSURLSessionDataTask * _Nullable task, NSError * | ... | @@ -287,10 +287,36 @@ typedef void (^FailureResponse)(NSURLSessionDataTask * _Nullable task, NSError * |
287 | _appUUID = [anAppUUID copy]; | 287 | _appUUID = [anAppUUID copy]; |
288 | 288 | ||
289 | //Save new value | 289 | //Save new value |
290 | - if ((_appUUID != (NSString *)[NSNull null]) && (_appUUID.length > 0)) | 290 | + if ((_appUUID != (NSString *)[NSNull null]) && (_appUUID.length > 0)) { |
291 | +// [WLKeychain setString:_appUUID forKey:@"NBAPPUuid"]; | ||
292 | + | ||
293 | + @try { | ||
291 | [WLKeychain setString:_appUUID forKey:@"NBAPPUuid"]; | 294 | [WLKeychain setString:_appUUID forKey:@"NBAPPUuid"]; |
292 | - else | 295 | + } |
296 | + @catch (NSException *exception) { | ||
297 | + NSLog(@"WLKeychain set appUUID error: %@", exception.reason); | ||
298 | + } | ||
299 | + @finally { | ||
300 | +// NSLog(@"Finally condition"); | ||
301 | + } | ||
302 | + NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; | ||
303 | + [defaults setObject:_appUUID forKey:@"NBAPPUuidUD"]; | ||
304 | + } | ||
305 | + else { | ||
306 | +// [WLKeychain deleteStringForKey:@"NBAPPUuid"]; | ||
307 | + | ||
308 | + @try { | ||
293 | [WLKeychain deleteStringForKey:@"NBAPPUuid"]; | 309 | [WLKeychain deleteStringForKey:@"NBAPPUuid"]; |
310 | + } | ||
311 | + @catch (NSException *exception) { | ||
312 | + NSLog(@"WLKeychain delete appUUID error: %@", exception.reason); | ||
313 | + } | ||
314 | + @finally { | ||
315 | +// NSLog(@"Finally condition"); | ||
316 | + } | ||
317 | + NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; | ||
318 | + [defaults setObject:@"" forKey:@"NBAPPUuidUD"]; | ||
319 | + } | ||
294 | } | 320 | } |
295 | 321 | ||
296 | /////////////////////////////////////////////////////////////////////////////// | 322 | /////////////////////////////////////////////////////////////////////////////// |
... | @@ -302,10 +328,36 @@ typedef void (^FailureResponse)(NSURLSessionDataTask * _Nullable task, NSError * | ... | @@ -302,10 +328,36 @@ typedef void (^FailureResponse)(NSURLSessionDataTask * _Nullable task, NSError * |
302 | _apiKey = [anAPIKey copy]; | 328 | _apiKey = [anAPIKey copy]; |
303 | 329 | ||
304 | //Save new value | 330 | //Save new value |
305 | - if ((_apiKey != (NSString *)[NSNull null]) && (_apiKey.length > 0)) | 331 | + if ((_apiKey != (NSString *)[NSNull null]) && (_apiKey.length > 0)) { |
332 | +// [WLKeychain setString:_apiKey forKey:@"NBAPIKey"]; | ||
333 | + | ||
334 | + @try { | ||
306 | [WLKeychain setString:_apiKey forKey:@"NBAPIKey"]; | 335 | [WLKeychain setString:_apiKey forKey:@"NBAPIKey"]; |
307 | - else | 336 | + } |
337 | + @catch (NSException *exception) { | ||
338 | + NSLog(@"WLKeychain set APIKey error: %@", exception.reason); | ||
339 | + } | ||
340 | + @finally { | ||
341 | +// NSLog(@"Finally condition"); | ||
342 | + } | ||
343 | + NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; | ||
344 | + [defaults setObject:_apiKey forKey:@"NBAPIKeyUD"]; | ||
345 | + } | ||
346 | + else { | ||
347 | +// [WLKeychain deleteStringForKey:@"NBAPIKey"]; | ||
348 | + @try { | ||
308 | [WLKeychain deleteStringForKey:@"NBAPIKey"]; | 349 | [WLKeychain deleteStringForKey:@"NBAPIKey"]; |
350 | + } | ||
351 | + @catch (NSException *exception) { | ||
352 | + NSLog(@"WLKeychain delete APIKey error: %@", exception.reason); | ||
353 | + } | ||
354 | + @finally { | ||
355 | +// NSLog(@"Finally condition"); | ||
356 | + } | ||
357 | + NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; | ||
358 | + [defaults setObject:@"" forKey:@"NBAPIKeyUD"]; | ||
359 | + | ||
360 | + } | ||
309 | } | 361 | } |
310 | 362 | ||
311 | /////////////////////////////////////////////////////////////////////////////// | 363 | /////////////////////////////////////////////////////////////////////////////// |
... | @@ -317,10 +369,34 @@ typedef void (^FailureResponse)(NSURLSessionDataTask * _Nullable task, NSError * | ... | @@ -317,10 +369,34 @@ typedef void (^FailureResponse)(NSURLSessionDataTask * _Nullable task, NSError * |
317 | _webId = [aWebID copy]; | 369 | _webId = [aWebID copy]; |
318 | 370 | ||
319 | //Save new value | 371 | //Save new value |
320 | - if ((_webId != (NSString *)[NSNull null]) && (_webId.length > 0)) | 372 | + if ((_webId != (NSString *)[NSNull null]) && (_webId.length > 0)) { |
373 | +// [WLKeychain setString:_webId forKey:@"NBWebID"]; | ||
374 | + @try { | ||
321 | [WLKeychain setString:_webId forKey:@"NBWebID"]; | 375 | [WLKeychain setString:_webId forKey:@"NBWebID"]; |
322 | - else | 376 | + } |
377 | + @catch (NSException *exception) { | ||
378 | + NSLog(@"WLKeychain set WebID error: %@", exception.reason); | ||
379 | + } | ||
380 | + @finally { | ||
381 | +// NSLog(@"Finally condition"); | ||
382 | + } | ||
383 | + NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; | ||
384 | + [defaults setObject:_webId forKey:@"NBWebIDUD"]; | ||
385 | + } | ||
386 | + else { | ||
387 | +// [WLKeychain deleteStringForKey:@"NBWebID"]; | ||
388 | + @try { | ||
323 | [WLKeychain deleteStringForKey:@"NBWebID"]; | 389 | [WLKeychain deleteStringForKey:@"NBWebID"]; |
390 | + } | ||
391 | + @catch (NSException *exception) { | ||
392 | + NSLog(@"WLKeychain delete WebID error: %@", exception.reason); | ||
393 | + } | ||
394 | + @finally { | ||
395 | +// NSLog(@"Finally condition"); | ||
396 | + } | ||
397 | + NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; | ||
398 | + [defaults setObject:@"" forKey:@"NBWebIDUD"]; | ||
399 | + } | ||
324 | } | 400 | } |
325 | 401 | ||
326 | /////////////////////////////////////////////////////////////////////////////// | 402 | /////////////////////////////////////////////////////////////////////////////// |
... | @@ -820,9 +896,33 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) | ... | @@ -820,9 +896,33 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) |
820 | - (void)loginWithSuccessBlock:(NSString*)id andPassword:(NSString*)password andLoginType:(NSString*)loginType :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure | 896 | - (void)loginWithSuccessBlock:(NSString*)id andPassword:(NSString*)password andLoginType:(NSString*)loginType :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure |
821 | { | 897 | { |
822 | NSString* webId = [NSString alloc]; | 898 | NSString* webId = [NSString alloc]; |
899 | +// webId = [WLKeychain getStringForKey:@"NBWebID"]; | ||
900 | + | ||
901 | + @try { | ||
823 | webId = [WLKeychain getStringForKey:@"NBWebID"]; | 902 | webId = [WLKeychain getStringForKey:@"NBWebID"]; |
903 | + } | ||
904 | + @catch (NSException *exception) { | ||
905 | + NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; | ||
906 | + webId = [defaults stringForKey:@"NBWebIDUD"]; | ||
907 | + } | ||
908 | + @finally { | ||
909 | +// NSLog(@"Finally condition"); | ||
910 | + } | ||
911 | + | ||
824 | NSString* appUuid = [NSString alloc]; | 912 | NSString* appUuid = [NSString alloc]; |
913 | +// appUuid = [WLKeychain getStringForKey:@"NBAPPUuid"]; | ||
914 | + | ||
915 | + @try { | ||
825 | appUuid = [WLKeychain getStringForKey:@"NBAPPUuid"]; | 916 | appUuid = [WLKeychain getStringForKey:@"NBAPPUuid"]; |
917 | + } | ||
918 | + @catch (NSException *exception) { | ||
919 | + NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; | ||
920 | + appUuid = [defaults stringForKey:@"NBAPPUuidUD"]; | ||
921 | + } | ||
922 | + @finally { | ||
923 | +// NSLog(@"Finally condition"); | ||
924 | + } | ||
925 | + | ||
826 | NSDictionary *postDictionary = @{@"id": id, @"password": password, @"channel": @"mobile", @"app_uuid": appUuid }; | 926 | NSDictionary *postDictionary = @{@"id": id, @"password": password, @"channel": @"mobile", @"app_uuid": appUuid }; |
827 | NSData *jsonData = [NSJSONSerialization dataWithJSONObject:postDictionary options:0 error:NULL]; | 927 | NSData *jsonData = [NSJSONSerialization dataWithJSONObject:postDictionary options:0 error:NULL]; |
828 | [self sendContext3:jsonData successBlock:^(NSDictionary *contextResponse) { | 928 | [self sendContext3:jsonData successBlock:^(NSDictionary *contextResponse) { |
... | @@ -906,9 +1006,33 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) | ... | @@ -906,9 +1006,33 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) |
906 | - (void)registerWithSuccessBlock:(NSString*)id andPassword:(NSString*)password andName:(NSString*)name andEmail:(NSString*)email andSegmentation:(NSNumber*)segmentation andNewsletter:(NSNumber*)newsletter :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure | 1006 | - (void)registerWithSuccessBlock:(NSString*)id andPassword:(NSString*)password andName:(NSString*)name andEmail:(NSString*)email andSegmentation:(NSNumber*)segmentation andNewsletter:(NSNumber*)newsletter :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure |
907 | { | 1007 | { |
908 | NSString* webId = [NSString alloc]; | 1008 | NSString* webId = [NSString alloc]; |
1009 | +// webId = [WLKeychain getStringForKey:@"NBWebID"]; | ||
1010 | + | ||
1011 | + @try { | ||
909 | webId = [WLKeychain getStringForKey:@"NBWebID"]; | 1012 | webId = [WLKeychain getStringForKey:@"NBWebID"]; |
1013 | + } | ||
1014 | + @catch (NSException *exception) { | ||
1015 | + NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; | ||
1016 | + webId = [defaults stringForKey:@"NBWebIDUD"]; | ||
1017 | + } | ||
1018 | + @finally { | ||
1019 | +// NSLog(@"Finally condition"); | ||
1020 | + } | ||
1021 | + | ||
910 | NSString* appUuid = [NSString alloc]; | 1022 | NSString* appUuid = [NSString alloc]; |
1023 | +// appUuid = [WLKeychain getStringForKey:@"NBAPPUuid"]; | ||
1024 | + | ||
1025 | + @try { | ||
911 | appUuid = [WLKeychain getStringForKey:@"NBAPPUuid"]; | 1026 | appUuid = [WLKeychain getStringForKey:@"NBAPPUuid"]; |
1027 | + } | ||
1028 | + @catch (NSException *exception) { | ||
1029 | + NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; | ||
1030 | + appUuid = [defaults stringForKey:@"NBAPPUuidUD"]; | ||
1031 | + } | ||
1032 | + @finally { | ||
1033 | +// NSLog(@"Finally condition"); | ||
1034 | + } | ||
1035 | + | ||
912 | NSDictionary *postDictionary = @{@"id": id, @"password": password, @"name": name, @"email": email, @"channel": @"mobile", @"app_uuid": appUuid, @"web_id": webId, @"optin": @{@"segmentation": segmentation, @"newsletter": newsletter} }; | 1036 | NSDictionary *postDictionary = @{@"id": id, @"password": password, @"name": name, @"email": email, @"channel": @"mobile", @"app_uuid": appUuid, @"web_id": webId, @"optin": @{@"segmentation": segmentation, @"newsletter": newsletter} }; |
913 | NSData *jsonData = [NSJSONSerialization dataWithJSONObject:postDictionary options:0 error:NULL]; | 1037 | NSData *jsonData = [NSJSONSerialization dataWithJSONObject:postDictionary options:0 error:NULL]; |
914 | [self sendContext6:jsonData successBlock:^(NSDictionary *contextResponse) { | 1038 | [self sendContext6:jsonData successBlock:^(NSDictionary *contextResponse) { |
... | @@ -1643,7 +1767,19 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) | ... | @@ -1643,7 +1767,19 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) |
1643 | - (void)verifyTicketWithSuccessBlock:(NSString*)guid :(NSString*)ticket :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure | 1767 | - (void)verifyTicketWithSuccessBlock:(NSString*)guid :(NSString*)ticket :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure |
1644 | { | 1768 | { |
1645 | NSString* appUuid = [NSString alloc]; | 1769 | NSString* appUuid = [NSString alloc]; |
1770 | +// appUuid = [WLKeychain getStringForKey:@"NBAPPUuid"]; | ||
1771 | + | ||
1772 | + @try { | ||
1646 | appUuid = [WLKeychain getStringForKey:@"NBAPPUuid"]; | 1773 | appUuid = [WLKeychain getStringForKey:@"NBAPPUuid"]; |
1774 | + } | ||
1775 | + @catch (NSException *exception) { | ||
1776 | + NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; | ||
1777 | + appUuid = [defaults stringForKey:@"NBAPPUuidUD"]; | ||
1778 | + } | ||
1779 | + @finally { | ||
1780 | +// NSLog(@"Finally condition"); | ||
1781 | + } | ||
1782 | + | ||
1647 | NSDictionary *postDictionary = @{@"guid" : guid, @"app_uuid": appUuid, @"ticket": ticket}; | 1783 | NSDictionary *postDictionary = @{@"guid" : guid, @"app_uuid": appUuid, @"ticket": ticket}; |
1648 | NSData *jsonData = [NSJSONSerialization dataWithJSONObject:postDictionary options:0 error:NULL]; | 1784 | NSData *jsonData = [NSJSONSerialization dataWithJSONObject:postDictionary options:0 error:NULL]; |
1649 | [self sendContext10:jsonData successBlock:^(NSDictionary *contextResponse) { | 1785 | [self sendContext10:jsonData successBlock:^(NSDictionary *contextResponse) { |
... | @@ -2103,7 +2239,19 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) | ... | @@ -2103,7 +2239,19 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) |
2103 | - (void)forgotPasswordWithIdWithSuccessBlock:(NSString*)id andConfCode:(NSString*)confCode andOtpUuid:(NSString*)otpUuid :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure | 2239 | - (void)forgotPasswordWithIdWithSuccessBlock:(NSString*)id andConfCode:(NSString*)confCode andOtpUuid:(NSString*)otpUuid :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure |
2104 | { | 2240 | { |
2105 | NSString* appUuid = [NSString alloc]; | 2241 | NSString* appUuid = [NSString alloc]; |
2242 | +// appUuid = [WLKeychain getStringForKey:@"NBAPPUuid"]; | ||
2243 | + | ||
2244 | + @try { | ||
2106 | appUuid = [WLKeychain getStringForKey:@"NBAPPUuid"]; | 2245 | appUuid = [WLKeychain getStringForKey:@"NBAPPUuid"]; |
2246 | + } | ||
2247 | + @catch (NSException *exception) { | ||
2248 | + NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; | ||
2249 | + appUuid = [defaults stringForKey:@"NBAPPUuidUD"]; | ||
2250 | + } | ||
2251 | + @finally { | ||
2252 | +// NSLog(@"Finally condition"); | ||
2253 | + } | ||
2254 | + | ||
2107 | NSMutableDictionary* data = [[NSMutableDictionary alloc] init]; | 2255 | NSMutableDictionary* data = [[NSMutableDictionary alloc] init]; |
2108 | 2256 | ||
2109 | [data setValue:@"mobile" forKey:@"channel"]; | 2257 | [data setValue:@"mobile" forKey:@"channel"]; |
... | @@ -2132,7 +2280,19 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) | ... | @@ -2132,7 +2280,19 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) |
2132 | - (void)requestOtpWithMsisdnWithSuccessBlock:(NSString*)msisdn andScope:(NSString*)scope :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure | 2280 | - (void)requestOtpWithMsisdnWithSuccessBlock:(NSString*)msisdn andScope:(NSString*)scope :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure |
2133 | { | 2281 | { |
2134 | NSString* appUuid = [NSString alloc]; | 2282 | NSString* appUuid = [NSString alloc]; |
2283 | +// appUuid = [WLKeychain getStringForKey:@"NBAPPUuid"]; | ||
2284 | + | ||
2285 | + @try { | ||
2135 | appUuid = [WLKeychain getStringForKey:@"NBAPPUuid"]; | 2286 | appUuid = [WLKeychain getStringForKey:@"NBAPPUuid"]; |
2287 | + } | ||
2288 | + @catch (NSException *exception) { | ||
2289 | + NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; | ||
2290 | + appUuid = [defaults stringForKey:@"NBAPPUuidUD"]; | ||
2291 | + } | ||
2292 | + @finally { | ||
2293 | +// NSLog(@"Finally condition"); | ||
2294 | + } | ||
2295 | + | ||
2136 | NSMutableDictionary* data = [[NSMutableDictionary alloc] init]; | 2296 | NSMutableDictionary* data = [[NSMutableDictionary alloc] init]; |
2137 | 2297 | ||
2138 | [data setValue:@"mobile" forKey:@"channel"]; | 2298 | [data setValue:@"mobile" forKey:@"channel"]; |
... | @@ -2157,7 +2317,19 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) | ... | @@ -2157,7 +2317,19 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) |
2157 | - (void)resetPasswordWithPasswordWithSuccessBlock:(NSString*)password andConfCode:(NSString*)confCode andOtpUuid:(NSString*)otpUuid andConfToken:(NSString*)confToken :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure | 2317 | - (void)resetPasswordWithPasswordWithSuccessBlock:(NSString*)password andConfCode:(NSString*)confCode andOtpUuid:(NSString*)otpUuid andConfToken:(NSString*)confToken :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure |
2158 | { | 2318 | { |
2159 | NSString* appUuid = [NSString alloc]; | 2319 | NSString* appUuid = [NSString alloc]; |
2320 | +// appUuid = [WLKeychain getStringForKey:@"NBAPPUuid"]; | ||
2321 | + | ||
2322 | + @try { | ||
2160 | appUuid = [WLKeychain getStringForKey:@"NBAPPUuid"]; | 2323 | appUuid = [WLKeychain getStringForKey:@"NBAPPUuid"]; |
2324 | + } | ||
2325 | + @catch (NSException *exception) { | ||
2326 | + NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; | ||
2327 | + appUuid = [defaults stringForKey:@"NBAPPUuidUD"]; | ||
2328 | + } | ||
2329 | + @finally { | ||
2330 | +// NSLog(@"Finally condition"); | ||
2331 | + } | ||
2332 | + | ||
2161 | NSMutableDictionary* data = [[NSMutableDictionary alloc] init]; | 2333 | NSMutableDictionary* data = [[NSMutableDictionary alloc] init]; |
2162 | 2334 | ||
2163 | [data setValue:@"mobile" forKey:@"channel"]; | 2335 | [data setValue:@"mobile" forKey:@"channel"]; |
... | @@ -2190,7 +2362,19 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) | ... | @@ -2190,7 +2362,19 @@ WL_VERSION_IMPLEMENTATION(WL_VERSION) |
2190 | - (void)retrieveMultilingualMerchantsWithCategoriesWithSuccessBlock:(NSArray*)categories andDefaultShown:(NSNumber*)defaultShown andCenter:(NSNumber*)center andTags:(NSArray*)tags andUuid:(NSString*)uuid andDistance:(NSNumber*)distance parent_uuids:(NSArray*)parent_uuids :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure | 2362 | - (void)retrieveMultilingualMerchantsWithCategoriesWithSuccessBlock:(NSArray*)categories andDefaultShown:(NSNumber*)defaultShown andCenter:(NSNumber*)center andTags:(NSArray*)tags andUuid:(NSString*)uuid andDistance:(NSNumber*)distance parent_uuids:(NSArray*)parent_uuids :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure |
2191 | { | 2363 | { |
2192 | NSString* appUuid = [NSString alloc]; | 2364 | NSString* appUuid = [NSString alloc]; |
2365 | +// appUuid = [WLKeychain getStringForKey:@"NBAPPUuid"]; | ||
2366 | + | ||
2367 | + @try { | ||
2193 | appUuid = [WLKeychain getStringForKey:@"NBAPPUuid"]; | 2368 | appUuid = [WLKeychain getStringForKey:@"NBAPPUuid"]; |
2369 | + } | ||
2370 | + @catch (NSException *exception) { | ||
2371 | + NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; | ||
2372 | + appUuid = [defaults stringForKey:@"NBAPPUuidUD"]; | ||
2373 | + } | ||
2374 | + @finally { | ||
2375 | +// NSLog(@"Finally condition"); | ||
2376 | + } | ||
2377 | + | ||
2194 | NSMutableDictionary* data = [[NSMutableDictionary alloc] init]; | 2378 | NSMutableDictionary* data = [[NSMutableDictionary alloc] init]; |
2195 | 2379 | ||
2196 | [data setValue:@YES forKey:@"active"]; | 2380 | [data setValue:@YES forKey:@"active"]; |
... | @@ -5965,15 +6149,40 @@ static void distanceFunc(sqlite3_context *context, int argc, sqlite3_value **arg | ... | @@ -5965,15 +6149,40 @@ static void distanceFunc(sqlite3_context *context, int argc, sqlite3_value **arg |
5965 | if ([defaults boolForKey:@"NBAppUninstalled"] == NO) { | 6149 | if ([defaults boolForKey:@"NBAppUninstalled"] == NO) { |
5966 | [defaults setBool:YES forKey:@"NBAppUninstalled"]; | 6150 | [defaults setBool:YES forKey:@"NBAppUninstalled"]; |
5967 | [defaults synchronize]; | 6151 | [defaults synchronize]; |
6152 | + | ||
6153 | + @try { | ||
5968 | [WLKeychain deleteStringForKey:@"NBAPPUuid"]; | 6154 | [WLKeychain deleteStringForKey:@"NBAPPUuid"]; |
5969 | [WLKeychain deleteStringForKey:@"NBWebID"]; | 6155 | [WLKeychain deleteStringForKey:@"NBWebID"]; |
5970 | [WLKeychain deleteStringForKey:@"NBAPIKey"]; | 6156 | [WLKeychain deleteStringForKey:@"NBAPIKey"]; |
6157 | + } | ||
6158 | + @catch (NSException *exception) { | ||
6159 | + NSLog(@"WLKeychain delete error: %@", exception.reason); | ||
6160 | + } | ||
6161 | + @finally { | ||
6162 | + // NSLog(@"Finally condition"); | ||
6163 | + } | ||
6164 | + NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; | ||
6165 | + [defaults setObject:@"" forKey:@"NBAPPUuidUD"]; | ||
6166 | + [defaults setObject:@"" forKey:@"NBWebIDUD"]; | ||
6167 | + [defaults setObject:@"" forKey:@"NBAPIKeyUD"]; | ||
6168 | + | ||
5971 | return; | 6169 | return; |
5972 | } | 6170 | } |
5973 | 6171 | ||
6172 | + @try { | ||
5974 | self.appUUID = [WLKeychain getStringForKey:@"NBAPPUuid"]; | 6173 | self.appUUID = [WLKeychain getStringForKey:@"NBAPPUuid"]; |
5975 | self.apiKey = [WLKeychain getStringForKey:@"NBAPIKey"]; | 6174 | self.apiKey = [WLKeychain getStringForKey:@"NBAPIKey"]; |
5976 | self.webId = [WLKeychain getStringForKey:@"NBWebID"]; | 6175 | self.webId = [WLKeychain getStringForKey:@"NBWebID"]; |
6176 | + } | ||
6177 | + @catch (NSException *exception) { | ||
6178 | + NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; | ||
6179 | + self.appUUID = [defaults stringForKey:@"NBAPPUuidUD"]; | ||
6180 | + self.apiKey = [defaults stringForKey:@"NBAPIKeyUD"]; | ||
6181 | + self.webId = [defaults stringForKey:@"NBWebIDUD"]; | ||
6182 | + } | ||
6183 | + @finally { | ||
6184 | +// NSLog(@"Finally condition"); | ||
6185 | + } | ||
5977 | } | 6186 | } |
5978 | 6187 | ||
5979 | /////////////////////////////////////////////////////////////////////////////// | 6188 | /////////////////////////////////////////////////////////////////////////////// | ... | ... |
-
Please register or login to post a comment