Skip to content

Commit

Permalink
Merge pull request #2 from CAUCA-9-1-1/SMOB-858-lapplication-ne-gnre-…
Browse files Browse the repository at this point in the history
…pas-de-not

Smob 858 lapplication ne gnre pas de not
  • Loading branch information
philipperobertgh authored Mar 31, 2022
2 parents 2fd823b + 8c82cdb commit bd14150
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions src/ios/PushPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -637,8 +637,27 @@ -(NSString *)getApiUrl

-(NSString *)getDeviceId
{
NSString* uniqueIdentifier = [[[UIDevice currentDevice] identifierForVendor] UUIDString];
return uniqueIdentifier;
NSUserDefaults* userDefaults = [NSUserDefaults standardUserDefaults];
static NSString* UUID_KEY = @"CDVUUID";
UIDevice* device = [UIDevice currentDevice];

// Check user defaults first to maintain backwards compaitibility with previous versions
// which didn't user identifierForVendor
NSString* app_uuid = [userDefaults stringForKey:UUID_KEY];
if (app_uuid == nil) {
if ([device respondsToSelector:@selector(identifierForVendor)]) {
app_uuid = [[device identifierForVendor] UUIDString];
} else {
CFUUIDRef uuid = CFUUIDCreate(NULL);
app_uuid = (__bridge_transfer NSString *)CFUUIDCreateString(NULL, uuid);
CFRelease(uuid);
}

[userDefaults setObject:app_uuid forKey:UUID_KEY];
[userDefaults synchronize];
}

return app_uuid;
}

-(void) postAcknowledge:(NSString *)apiUrl :(NSDictionary *)acknowledgeData;
Expand Down

0 comments on commit bd14150

Please sign in to comment.