Showing
2 changed files
with
94 additions
and
2 deletions
... | @@ -6018,7 +6018,23 @@ CGFloat DistanceBetweenTwoPoints(CGPoint point1,CGPoint point2) | ... | @@ -6018,7 +6018,23 @@ CGFloat DistanceBetweenTwoPoints(CGPoint point1,CGPoint point2) |
6018 | NSDictionary *context = [JSON valueForKey:@"context"]; | 6018 | NSDictionary *context = [JSON valueForKey:@"context"]; |
6019 | self.apiKey = [context valueForKey:@"api_key"]; | 6019 | self.apiKey = [context valueForKey:@"api_key"]; |
6020 | self.webId = [context valueForKey:@"web_id"]; | 6020 | self.webId = [context valueForKey:@"web_id"]; |
6021 | +// [WLKeychain setString:[[[UIDevice currentDevice] identifierForVendor] UUIDString] forKey:@"old_identifier_for_vendor"]; | ||
6022 | + | ||
6023 | + @try { | ||
6021 | [WLKeychain setString:[[[UIDevice currentDevice] identifierForVendor] UUIDString] forKey:@"old_identifier_for_vendor"]; | 6024 | [WLKeychain setString:[[[UIDevice currentDevice] identifierForVendor] UUIDString] forKey:@"old_identifier_for_vendor"]; |
6025 | + } | ||
6026 | + @catch (NSException *exception) { | ||
6027 | + NSLog(@"WLKeychain set old_identifier_for_vendor error: %@", exception.reason); | ||
6028 | + } | ||
6029 | + @finally { | ||
6030 | + // NSLog(@"Finally condition"); | ||
6031 | + } | ||
6032 | + | ||
6033 | + NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; | ||
6034 | + [defaults setObject:[[[UIDevice currentDevice] identifierForVendor] UUIDString] forKey:@"old_identifier_for_vendor_UD"]; | ||
6035 | + [defaults setObject:[context valueForKey:@"api_key"] forKey:@"NBAPIKeyUD"]; | ||
6036 | + [defaults setObject:[context valueForKey:@"web_id"] forKey:@"NBWebIDUD"]; | ||
6037 | + [[NSUserDefaults standardUserDefaults] synchronize]; | ||
6022 | 6038 | ||
6023 | [_pendingOperationsQueue setSuspended:![self isRegistrationValid]]; | 6039 | [_pendingOperationsQueue setSuspended:![self isRegistrationValid]]; |
6024 | if (success) { | 6040 | if (success) { |
... | @@ -6059,11 +6075,32 @@ CGFloat DistanceBetweenTwoPoints(CGPoint point1,CGPoint point2) | ... | @@ -6059,11 +6075,32 @@ CGFloat DistanceBetweenTwoPoints(CGPoint point1,CGPoint point2) |
6059 | // NSData *parameters = [NSJSONSerialization dataWithJSONObject:context options:0 error:NULL]; | 6075 | // NSData *parameters = [NSJSONSerialization dataWithJSONObject:context options:0 error:NULL]; |
6060 | 6076 | ||
6061 | NSString *old_identifier_for_vendor; | 6077 | NSString *old_identifier_for_vendor; |
6078 | + | ||
6079 | + @try { | ||
6062 | if ([WLKeychain getStringForKey:@"old_identifier_for_vendor"]) { | 6080 | if ([WLKeychain getStringForKey:@"old_identifier_for_vendor"]) { |
6063 | old_identifier_for_vendor = [WLKeychain getStringForKey:@"old_identifier_for_vendor"]; | 6081 | old_identifier_for_vendor = [WLKeychain getStringForKey:@"old_identifier_for_vendor"]; |
6064 | } else { | 6082 | } else { |
6065 | old_identifier_for_vendor = [[[UIDevice currentDevice] identifierForVendor] UUIDString]; | 6083 | old_identifier_for_vendor = [[[UIDevice currentDevice] identifierForVendor] UUIDString]; |
6066 | } | 6084 | } |
6085 | + } | ||
6086 | + @catch (NSException *exception) { | ||
6087 | + NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; | ||
6088 | + if ([defaults stringForKey:@"old_identifier_for_vendor_UD"] && ![[defaults stringForKey:@"old_identifier_for_vendor_UD"] isEqual:@""]) { | ||
6089 | + old_identifier_for_vendor = [defaults stringForKey:@"old_identifier_for_vendor_UD"]; | ||
6090 | + } else { | ||
6091 | + old_identifier_for_vendor = [[[UIDevice currentDevice] identifierForVendor] UUIDString]; | ||
6092 | + } | ||
6093 | + } | ||
6094 | + @finally { | ||
6095 | +// NSLog(@"Finally condition"); | ||
6096 | + } | ||
6097 | + | ||
6098 | +// NSString *old_identifier_for_vendor; | ||
6099 | +// if ([WLKeychain getStringForKey:@"old_identifier_for_vendor"]) { | ||
6100 | +// old_identifier_for_vendor = [WLKeychain getStringForKey:@"old_identifier_for_vendor"]; | ||
6101 | +// } else { | ||
6102 | +// old_identifier_for_vendor = [[[UIDevice currentDevice] identifierForVendor] UUIDString]; | ||
6103 | +// } | ||
6067 | 6104 | ||
6068 | // NSDictionary *parameters = @{@"advertising_identifier": [[ASIdentifierManager sharedManager].advertisingIdentifier UUIDString], | 6105 | // NSDictionary *parameters = @{@"advertising_identifier": [[ASIdentifierManager sharedManager].advertisingIdentifier UUIDString], |
6069 | // @"old_identifier_for_vendor": old_identifier_for_vendor, | 6106 | // @"old_identifier_for_vendor": old_identifier_for_vendor, |
... | @@ -6182,9 +6219,20 @@ CGFloat DistanceBetweenTwoPoints(CGPoint point1,CGPoint point2) | ... | @@ -6182,9 +6219,20 @@ CGFloat DistanceBetweenTwoPoints(CGPoint point1,CGPoint point2) |
6182 | NSDictionary *context = [JSON valueForKey:@"context"]; | 6219 | NSDictionary *context = [JSON valueForKey:@"context"]; |
6183 | self.apiKey = [context valueForKey:@"api_key"]; | 6220 | self.apiKey = [context valueForKey:@"api_key"]; |
6184 | self.webId = [context valueForKey:@"web_id"]; | 6221 | self.webId = [context valueForKey:@"web_id"]; |
6222 | +// [WLKeychain setString:[[[UIDevice currentDevice] identifierForVendor] UUIDString] forKey:@"old_identifier_for_vendor"]; | ||
6223 | + | ||
6224 | + @try { | ||
6185 | [WLKeychain setString:[[[UIDevice currentDevice] identifierForVendor] UUIDString] forKey:@"old_identifier_for_vendor"]; | 6225 | [WLKeychain setString:[[[UIDevice currentDevice] identifierForVendor] UUIDString] forKey:@"old_identifier_for_vendor"]; |
6226 | + } | ||
6227 | + @catch (NSException *exception) { | ||
6228 | + NSLog(@"WLKeychain set old_identifier_for_vendor error: %@", exception.reason); | ||
6229 | + } | ||
6230 | + @finally { | ||
6231 | + // NSLog(@"Finally condition"); | ||
6232 | + } | ||
6186 | 6233 | ||
6187 | NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; | 6234 | NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; |
6235 | + [defaults setObject:[[[UIDevice currentDevice] identifierForVendor] UUIDString] forKey:@"old_identifier_for_vendor_UD"]; | ||
6188 | [defaults setObject:[context valueForKey:@"api_key"] forKey:@"NBAPIKeyUD"]; | 6236 | [defaults setObject:[context valueForKey:@"api_key"] forKey:@"NBAPIKeyUD"]; |
6189 | [defaults setObject:[context valueForKey:@"web_id"] forKey:@"NBWebIDUD"]; | 6237 | [defaults setObject:[context valueForKey:@"web_id"] forKey:@"NBWebIDUD"]; |
6190 | [[NSUserDefaults standardUserDefaults] synchronize]; | 6238 | [[NSUserDefaults standardUserDefaults] synchronize]; |
... | @@ -6231,11 +6279,31 @@ CGFloat DistanceBetweenTwoPoints(CGPoint point1,CGPoint point2) | ... | @@ -6231,11 +6279,31 @@ CGFloat DistanceBetweenTwoPoints(CGPoint point1,CGPoint point2) |
6231 | // NSData *parameters = [NSJSONSerialization dataWithJSONObject:context options:0 error:NULL]; | 6279 | // NSData *parameters = [NSJSONSerialization dataWithJSONObject:context options:0 error:NULL]; |
6232 | 6280 | ||
6233 | NSString *old_identifier_for_vendor; | 6281 | NSString *old_identifier_for_vendor; |
6282 | + | ||
6283 | + @try { | ||
6234 | if ([WLKeychain getStringForKey:@"old_identifier_for_vendor"]) { | 6284 | if ([WLKeychain getStringForKey:@"old_identifier_for_vendor"]) { |
6235 | old_identifier_for_vendor = [WLKeychain getStringForKey:@"old_identifier_for_vendor"]; | 6285 | old_identifier_for_vendor = [WLKeychain getStringForKey:@"old_identifier_for_vendor"]; |
6236 | } else { | 6286 | } else { |
6237 | old_identifier_for_vendor = [[[UIDevice currentDevice] identifierForVendor] UUIDString]; | 6287 | old_identifier_for_vendor = [[[UIDevice currentDevice] identifierForVendor] UUIDString]; |
6238 | } | 6288 | } |
6289 | + } | ||
6290 | + @catch (NSException *exception) { | ||
6291 | + NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; | ||
6292 | + if ([defaults stringForKey:@"old_identifier_for_vendor_UD"] && ![[defaults stringForKey:@"old_identifier_for_vendor_UD"] isEqual:@""]) { | ||
6293 | + old_identifier_for_vendor = [defaults stringForKey:@"old_identifier_for_vendor_UD"]; | ||
6294 | + } else { | ||
6295 | + old_identifier_for_vendor = [[[UIDevice currentDevice] identifierForVendor] UUIDString]; | ||
6296 | + } | ||
6297 | + } | ||
6298 | + @finally { | ||
6299 | +// NSLog(@"Finally condition"); | ||
6300 | + } | ||
6301 | + | ||
6302 | +// if ([WLKeychain getStringForKey:@"old_identifier_for_vendor"]) { | ||
6303 | +// old_identifier_for_vendor = [WLKeychain getStringForKey:@"old_identifier_for_vendor"]; | ||
6304 | +// } else { | ||
6305 | +// old_identifier_for_vendor = [[[UIDevice currentDevice] identifierForVendor] UUIDString]; | ||
6306 | +// } | ||
6239 | 6307 | ||
6240 | // OLD parameters | 6308 | // OLD parameters |
6241 | // NSDictionary *parameters = @{@"advertising_identifier": [[ASIdentifierManager sharedManager].advertisingIdentifier UUIDString], | 6309 | // NSDictionary *parameters = @{@"advertising_identifier": [[ASIdentifierManager sharedManager].advertisingIdentifier UUIDString], | ... | ... |
... | @@ -93,10 +93,34 @@ static const char* jailbreak_apps[] = | ... | @@ -93,10 +93,34 @@ static const char* jailbreak_apps[] = |
93 | _deviceToken = [aDeviceToken copy]; | 93 | _deviceToken = [aDeviceToken copy]; |
94 | 94 | ||
95 | //Save new valuetodo | 95 | //Save new valuetodo |
96 | - if ((_deviceToken != (NSString *)[NSNull null]) && (_deviceToken.length > 0)) | 96 | + if ((_deviceToken != (NSString *)[NSNull null]) && (_deviceToken.length > 0)) { |
97 | +// [WLKeychain setString:_deviceToken forKey:@"NBDeviceToken"]; | ||
98 | + | ||
99 | + @try { | ||
97 | [WLKeychain setString:_deviceToken forKey:@"NBDeviceToken"]; | 100 | [WLKeychain setString:_deviceToken forKey:@"NBDeviceToken"]; |
98 | - else | 101 | + } |
102 | + @catch (NSException *exception) { | ||
103 | + NSLog(@"WLKeychain set DeviceToken error: %@", exception.reason); | ||
104 | + } | ||
105 | + @finally { | ||
106 | +// NSLog(@"Finally condition"); | ||
107 | + } | ||
108 | + NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; | ||
109 | + [defaults setObject:_deviceToken forKey:@"NBDeviceTokenUD"]; | ||
110 | + } else { | ||
111 | +// [WLKeychain deleteStringForKey:@"NBDeviceToken"]; | ||
112 | + @try { | ||
99 | [WLKeychain deleteStringForKey:@"NBDeviceToken"]; | 113 | [WLKeychain deleteStringForKey:@"NBDeviceToken"]; |
114 | + } | ||
115 | + @catch (NSException *exception) { | ||
116 | + NSLog(@"WLKeychain delete DeviceToken error: %@", exception.reason); | ||
117 | + } | ||
118 | + @finally { | ||
119 | +// NSLog(@"Finally condition"); | ||
120 | + } | ||
121 | + NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; | ||
122 | + [defaults setObject:@"" forKey:@"NBDeviceTokenUD"]; | ||
123 | + } | ||
100 | } | 124 | } |
101 | 125 | ||
102 | #pragma mark - Public Methods | 126 | #pragma mark - Public Methods | ... | ... |
-
Please register or login to post a comment