You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by pu...@apache.org on 2015/07/28 20:21:38 UTC

[1/7] cordova-plugin-device git commit: Changed UUID to use [UIDevice identifierForVendor]

Repository: cordova-plugin-device
Updated Branches:
  refs/heads/master 3ed9bee55 -> b90dbbaf8


Changed UUID to use [UIDevice identifierForVendor]

instead of generating a UUID, just use the unique identifierForVendor for device which is valid since iOS 6.0
Since Cordova dropped support for iOS 5, I think this is a safe change and the UUID will be persistent across installs.

Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/commit/f28cb50c
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/tree/f28cb50c
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/diff/f28cb50c

Branch: refs/heads/master
Commit: f28cb50cdc7d65a8f0c9cb74e4fdc53ac4516a37
Parents: 3ed9bee
Author: Jordan <jo...@gmail.com>
Authored: Fri Jul 17 12:33:41 2015 +1200
Committer: Jordan <jo...@gmail.com>
Committed: Fri Jul 17 12:33:41 2015 +1200

----------------------------------------------------------------------
 src/ios/CDVDevice.m | 20 ++------------------
 1 file changed, 2 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/blob/f28cb50c/src/ios/CDVDevice.m
----------------------------------------------------------------------
diff --git a/src/ios/CDVDevice.m b/src/ios/CDVDevice.m
index 5a3f470..e2ab4cf 100644
--- a/src/ios/CDVDevice.m
+++ b/src/ios/CDVDevice.m
@@ -47,24 +47,7 @@
 
 - (NSString*)uniqueAppInstanceIdentifier:(UIDevice*)device
 {
-    NSUserDefaults* userDefaults = [NSUserDefaults standardUserDefaults];
-    static NSString* UUID_KEY = @"CDVUUID";
-
-    NSString* app_uuid = [userDefaults stringForKey:UUID_KEY];
-
-    if (app_uuid == nil) {
-        CFUUIDRef uuidRef = CFUUIDCreate(kCFAllocatorDefault);
-        CFStringRef uuidString = CFUUIDCreateString(kCFAllocatorDefault, uuidRef);
-
-        app_uuid = [NSString stringWithString:(__bridge NSString*)uuidString];
-        [userDefaults setObject:app_uuid forKey:UUID_KEY];
-        [userDefaults synchronize];
-
-        CFRelease(uuidString);
-        CFRelease(uuidRef);
-    }
-
-    return app_uuid;
+    return [[device identifierForVendor] UUIDString];
 }
 
 - (void)getDeviceInfo:(CDVInvokedUrlCommand*)command
@@ -85,6 +68,7 @@
     [devProps setObject:@"iOS" forKey:@"platform"];
     [devProps setObject:[device systemVersion] forKey:@"version"];
     [devProps setObject:[self uniqueAppInstanceIdentifier:device] forKey:@"uuid"];
+    [devProps setObject:[self identifierForVendor:device] forKey:@"identifierForVendor"];
     [devProps setObject:[[self class] cordovaVersion] forKey:@"cordova"];
 
     NSDictionary* devReturn = [NSDictionary dictionaryWithDictionary:devProps];


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[2/7] cordova-plugin-device git commit: Remove line incorrectly committed

Posted by pu...@apache.org.
Remove line incorrectly committed

Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/commit/810c3c9f
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/tree/810c3c9f
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/diff/810c3c9f

Branch: refs/heads/master
Commit: 810c3c9fe06003cd916ffe5b668cd9286c506f31
Parents: f28cb50
Author: Jordan <jo...@gmail.com>
Authored: Fri Jul 17 12:34:42 2015 +1200
Committer: Jordan <jo...@gmail.com>
Committed: Fri Jul 17 12:34:42 2015 +1200

----------------------------------------------------------------------
 src/ios/CDVDevice.m | 1 -
 1 file changed, 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/blob/810c3c9f/src/ios/CDVDevice.m
----------------------------------------------------------------------
diff --git a/src/ios/CDVDevice.m b/src/ios/CDVDevice.m
index e2ab4cf..9225cbc 100644
--- a/src/ios/CDVDevice.m
+++ b/src/ios/CDVDevice.m
@@ -68,7 +68,6 @@
     [devProps setObject:@"iOS" forKey:@"platform"];
     [devProps setObject:[device systemVersion] forKey:@"version"];
     [devProps setObject:[self uniqueAppInstanceIdentifier:device] forKey:@"uuid"];
-    [devProps setObject:[self identifierForVendor:device] forKey:@"identifierForVendor"];
     [devProps setObject:[[self class] cordovaVersion] forKey:@"cordova"];
 
     NSDictionary* devReturn = [NSDictionary dictionaryWithDictionary:devProps];


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[5/7] cordova-plugin-device git commit: Check user defaults first to maintain backwards compatibility

Posted by pu...@apache.org.
Check user defaults first to maintain backwards compatibility


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/commit/1f1c0e65
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/tree/1f1c0e65
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/diff/1f1c0e65

Branch: refs/heads/master
Commit: 1f1c0e655e965f0143cca288faeb64f0a5d34f8f
Parents: 3c125c8
Author: Jordan Clist <jo...@fergusapp.com>
Authored: Sat Jul 18 20:00:30 2015 +1200
Committer: Jordan Clist <jo...@fergusapp.com>
Committed: Sat Jul 18 20:00:30 2015 +1200

----------------------------------------------------------------------
 src/ios/CDVDevice.m | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/blob/1f1c0e65/src/ios/CDVDevice.m
----------------------------------------------------------------------
diff --git a/src/ios/CDVDevice.m b/src/ios/CDVDevice.m
index 9225cbc..6b70fa5 100644
--- a/src/ios/CDVDevice.m
+++ b/src/ios/CDVDevice.m
@@ -47,7 +47,19 @@
 
 - (NSString*)uniqueAppInstanceIdentifier:(UIDevice*)device
 {
-    return [[device identifierForVendor] UUIDString];
+    NSUserDefaults* userDefaults = [NSUserDefaults standardUserDefaults];
+    static NSString* UUID_KEY = @"CDVUUID";
+    
+    // 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) {
+        app_uuid = [[device identifierForVendor] UUIDString];
+        [userDefaults setObject:app_uuid forKey:UUID_KEY];
+        [userDefaults synchronize];
+    }
+    
+    return app_uuid;
 }
 
 - (void)getDeviceInfo:(CDVInvokedUrlCommand*)command


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[3/7] cordova-plugin-device git commit: Check user defaults first to maintain backwards compatibility

Posted by pu...@apache.org.
Check user defaults first to maintain backwards compatibility

Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/commit/6416f605
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/tree/6416f605
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/diff/6416f605

Branch: refs/heads/master
Commit: 6416f60528a2ee1418c50c0791e8373bed40f39f
Parents: 810c3c9
Author: Jordan <jo...@gmail.com>
Authored: Sat Jul 18 19:55:58 2015 +1200
Committer: Jordan <jo...@gmail.com>
Committed: Sat Jul 18 19:55:58 2015 +1200

----------------------------------------------------------------------
 src/ios/CDVDevice.m | 28 ++++++++++++++++++++--------
 1 file changed, 20 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/blob/6416f605/src/ios/CDVDevice.m
----------------------------------------------------------------------
diff --git a/src/ios/CDVDevice.m b/src/ios/CDVDevice.m
index 9225cbc..ffb22e2 100644
--- a/src/ios/CDVDevice.m
+++ b/src/ios/CDVDevice.m
@@ -6,9 +6,9 @@
  to you under the Apache License, Version 2.0 (the
  "License"); you may not use this file except in compliance
  with the License.  You may obtain a copy of the License at
-
+ 
  http://www.apache.org/licenses/LICENSE-2.0
-
+ 
  Unless required by applicable law or agreed to in writing,
  software distributed under the License is distributed on an
  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -28,13 +28,13 @@
 - (NSString*)modelVersion
 {
     size_t size;
-
+    
     sysctlbyname("hw.machine", NULL, &size, NULL, 0);
     char* machine = malloc(size);
     sysctlbyname("hw.machine", machine, &size, NULL, 0);
     NSString* platform = [NSString stringWithUTF8String:machine];
     free(machine);
-
+    
     return platform;
 }
 
@@ -47,14 +47,26 @@
 
 - (NSString*)uniqueAppInstanceIdentifier:(UIDevice*)device
 {
-    return [[device identifierForVendor] UUIDString];
+    NSUserDefaults* userDefaults = [NSUserDefaults standardUserDefaults];
+    static NSString* UUID_KEY = @"CDVUUID";
+    
+    // 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) {
+        app_uuid = [[device identifierForVendor] UUIDString];
+        [userDefaults setObject:app_uuid forKey:UUID_KEY];
+        [userDefaults synchronize];
+    }
+    
+    return app_uuid;
 }
 
 - (void)getDeviceInfo:(CDVInvokedUrlCommand*)command
 {
     NSDictionary* deviceProperties = [self deviceProperties];
     CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:deviceProperties];
-
+    
     [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
 }
 
@@ -62,14 +74,14 @@
 {
     UIDevice* device = [UIDevice currentDevice];
     NSMutableDictionary* devProps = [NSMutableDictionary dictionaryWithCapacity:4];
-
+    
     [devProps setObject:@"Apple" forKey:@"manufacturer"];
     [devProps setObject:[device modelVersion] forKey:@"model"];
     [devProps setObject:@"iOS" forKey:@"platform"];
     [devProps setObject:[device systemVersion] forKey:@"version"];
     [devProps setObject:[self uniqueAppInstanceIdentifier:device] forKey:@"uuid"];
     [devProps setObject:[[self class] cordovaVersion] forKey:@"cordova"];
-
+    
     NSDictionary* devReturn = [NSDictionary dictionaryWithDictionary:devProps];
     return devReturn;
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[4/7] cordova-plugin-device git commit: Revert "Check user defaults first to maintain backwards compatibility"

Posted by pu...@apache.org.
Revert "Check user defaults first to maintain backwards compatibility"

This reverts commit 6416f60528a2ee1418c50c0791e8373bed40f39f.


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/commit/3c125c81
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/tree/3c125c81
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/diff/3c125c81

Branch: refs/heads/master
Commit: 3c125c813573be6ddfc5344b45c151a4371dc9fc
Parents: 6416f60
Author: Jordan Clist <jo...@fergusapp.com>
Authored: Sat Jul 18 19:59:33 2015 +1200
Committer: Jordan Clist <jo...@fergusapp.com>
Committed: Sat Jul 18 19:59:33 2015 +1200

----------------------------------------------------------------------
 src/ios/CDVDevice.m | 28 ++++++++--------------------
 1 file changed, 8 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/blob/3c125c81/src/ios/CDVDevice.m
----------------------------------------------------------------------
diff --git a/src/ios/CDVDevice.m b/src/ios/CDVDevice.m
index ffb22e2..9225cbc 100644
--- a/src/ios/CDVDevice.m
+++ b/src/ios/CDVDevice.m
@@ -6,9 +6,9 @@
  to you under the Apache License, Version 2.0 (the
  "License"); you may not use this file except in compliance
  with the License.  You may obtain a copy of the License at
- 
+
  http://www.apache.org/licenses/LICENSE-2.0
- 
+
  Unless required by applicable law or agreed to in writing,
  software distributed under the License is distributed on an
  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -28,13 +28,13 @@
 - (NSString*)modelVersion
 {
     size_t size;
-    
+
     sysctlbyname("hw.machine", NULL, &size, NULL, 0);
     char* machine = malloc(size);
     sysctlbyname("hw.machine", machine, &size, NULL, 0);
     NSString* platform = [NSString stringWithUTF8String:machine];
     free(machine);
-    
+
     return platform;
 }
 
@@ -47,26 +47,14 @@
 
 - (NSString*)uniqueAppInstanceIdentifier:(UIDevice*)device
 {
-    NSUserDefaults* userDefaults = [NSUserDefaults standardUserDefaults];
-    static NSString* UUID_KEY = @"CDVUUID";
-    
-    // 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) {
-        app_uuid = [[device identifierForVendor] UUIDString];
-        [userDefaults setObject:app_uuid forKey:UUID_KEY];
-        [userDefaults synchronize];
-    }
-    
-    return app_uuid;
+    return [[device identifierForVendor] UUIDString];
 }
 
 - (void)getDeviceInfo:(CDVInvokedUrlCommand*)command
 {
     NSDictionary* deviceProperties = [self deviceProperties];
     CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:deviceProperties];
-    
+
     [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
 }
 
@@ -74,14 +62,14 @@
 {
     UIDevice* device = [UIDevice currentDevice];
     NSMutableDictionary* devProps = [NSMutableDictionary dictionaryWithCapacity:4];
-    
+
     [devProps setObject:@"Apple" forKey:@"manufacturer"];
     [devProps setObject:[device modelVersion] forKey:@"model"];
     [devProps setObject:@"iOS" forKey:@"platform"];
     [devProps setObject:[device systemVersion] forKey:@"version"];
     [devProps setObject:[self uniqueAppInstanceIdentifier:device] forKey:@"uuid"];
     [devProps setObject:[[self class] cordovaVersion] forKey:@"cordova"];
-    
+
     NSDictionary* devReturn = [NSDictionary dictionaryWithDictionary:devProps];
     return devReturn;
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[7/7] cordova-plugin-device git commit: Updated documentation to mention backwards compatibility

Posted by pu...@apache.org.
Updated documentation to mention backwards compatibility

Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/commit/b90dbbaf
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/tree/b90dbbaf
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/diff/b90dbbaf

Branch: refs/heads/master
Commit: b90dbbaf8b02dc1ed8cc5c659b6f36847e1293e4
Parents: 03a4768
Author: Jordan <jo...@gmail.com>
Authored: Sat Jul 18 20:41:56 2015 +1200
Committer: Jordan <jo...@gmail.com>
Committed: Sat Jul 18 20:41:56 2015 +1200

----------------------------------------------------------------------
 README.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/blob/b90dbbaf/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index e3aa751..a981f57 100644
--- a/README.md
+++ b/README.md
@@ -170,7 +170,7 @@ The details of how a UUID is generated are determined by the device manufacturer
 
 The `uuid` on iOS uses the identifierForVendor property. It is unique to the device across the same vendor, but will be different for different vendors and will change if all apps from the vendor are deleted and then reinstalled. 
 See https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIDevice_Class/#//apple_ref/occ/instp/UIDevice/identifierForVendor
-The UUID will be the same if app is restored from a backup or iCloud as it is saved in preferences.
+The UUID will be the same if app is restored from a backup or iCloud as it is saved in preferences. Users using older versions of this plugin will still receive the same previous UUID generated by another means as it will be retrieved from preferences.
 
 ### Windows Phone 7 and 8 Quirks
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


[6/7] cordova-plugin-device git commit: Updated README to reflect new behaviour and quirks on iOS

Posted by pu...@apache.org.
Updated README to reflect new behaviour and quirks on iOS

Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/commit/03a4768d
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/tree/03a4768d
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/diff/03a4768d

Branch: refs/heads/master
Commit: 03a4768d05eb868c3d7334830fb0878d7cb2a5a7
Parents: 1f1c0e6
Author: Jordan <jo...@gmail.com>
Authored: Sat Jul 18 20:08:37 2015 +1200
Committer: Jordan <jo...@gmail.com>
Committed: Sat Jul 18 20:08:37 2015 +1200

----------------------------------------------------------------------
 README.md | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/blob/03a4768d/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index 3def8b1..e3aa751 100644
--- a/README.md
+++ b/README.md
@@ -159,9 +159,7 @@ The details of how a UUID is generated are determined by the device manufacturer
     //             This is a nine-digit unique integer (as a string, though!)
     //
     // iPhone: (Paraphrased from the UIDevice Class documentation)
-    //         Returns a string of hash values created from multiple hardware identifies.
-    //         It is guaranteed to be unique for every device and can't be tied
-    //         to the user account.
+    //         Returns the [UIDevice identifierForVendor] UUID which is unique and the same for all apps installed by the same vendor. However the UUID can be different if the user deletes all apps from the vendor and then reinstalls it. Please see https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIDevice_Class/#//apple_ref/occ/instp/UIDevice/identifierForVendor
     // Windows Phone 7 : Returns a hash of device+current user,
     // if the user is not defined, a guid is generated and will persist until the app is uninstalled
     // Tizen: returns the device IMEI (International Mobile Equipment Identity or IMEI is a number
@@ -170,11 +168,9 @@ The details of how a UUID is generated are determined by the device manufacturer
 
 ### iOS Quirk
 
-The `uuid` on iOS is not unique to a device, but varies for each
-application, for each installation.  It changes if you delete and
-re-install the app, and possibly also when you upgrade iOS, or even
-upgrade the app per version (apparent in iOS 5.1). The `uuid` is not
-a reliable value.
+The `uuid` on iOS uses the identifierForVendor property. It is unique to the device across the same vendor, but will be different for different vendors and will change if all apps from the vendor are deleted and then reinstalled. 
+See https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIDevice_Class/#//apple_ref/occ/instp/UIDevice/identifierForVendor
+The UUID will be the same if app is restored from a backup or iCloud as it is saved in preferences.
 
 ### Windows Phone 7 and 8 Quirks
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org