You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by sh...@apache.org on 2012/03/23 23:26:55 UTC

ios commit: Fixed CB-49 - UUID replacement

Updated Branches:
  refs/heads/master 4f17bb46d -> e456a98ea


Fixed CB-49 - UUID replacement


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/commit/e456a98e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/tree/e456a98e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/diff/e456a98e

Branch: refs/heads/master
Commit: e456a98eaaa040025a93efb9590efe818be402ad
Parents: 4f17bb4
Author: Shazron Abdullah <sh...@apache.org>
Authored: Fri Mar 23 15:26:45 2012 -0700
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Fri Mar 23 15:26:45 2012 -0700

----------------------------------------------------------------------
 CordovaLib/Classes/CDV.h                        |    1 +
 CordovaLib/Classes/CDVViewController.m          |    3 +-
 CordovaLib/Classes/UIDevice+Extensions.h        |   33 +++++++++++++++++
 CordovaLib/Classes/UIDevice+Extensions.m        |   35 ++++++++++++++++++
 CordovaLib/CordovaLib.xcodeproj/project.pbxproj |   12 ++++++
 5 files changed, 82 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/e456a98e/CordovaLib/Classes/CDV.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDV.h b/CordovaLib/Classes/CDV.h
index b4e4ecd..b402604 100644
--- a/CordovaLib/Classes/CDV.h
+++ b/CordovaLib/Classes/CDV.h
@@ -50,6 +50,7 @@
 #import "NSData+Base64.h"
 #import "NSDictionary+Extensions.h"
 #import "NSMutableArray+QueueAdditions.h"
+#import "UIDevice+Extensions.h"
 
 #import "JSONKit.h"
 

http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/e456a98e/CordovaLib/Classes/CDVViewController.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVViewController.m b/CordovaLib/Classes/CDVViewController.m
index 633b116..f86b28e 100644
--- a/CordovaLib/Classes/CDVViewController.m
+++ b/CordovaLib/Classes/CDVViewController.m
@@ -825,9 +825,8 @@ BOOL gSplashScreenShown = NO;
     NSMutableDictionary *devProps = [NSMutableDictionary dictionaryWithCapacity:4];
     [devProps setObject:[device model] forKey:@"platform"];
     [devProps setObject:[device systemVersion] forKey:@"version"];
-    [devProps setObject:[device uniqueIdentifier] forKey:@"uuid"];
+    [devProps setObject:[device uniqueAppInstanceIdentifier] forKey:@"uuid"];
     [devProps setObject:[device name] forKey:@"name"];
-    //[devProps setObject:[[self class] cordovaVersion ] forKey:@"gap"];
     
     NSDictionary *devReturn = [NSDictionary dictionaryWithDictionary:devProps];
     return devReturn;

http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/e456a98e/CordovaLib/Classes/UIDevice+Extensions.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/UIDevice+Extensions.h b/CordovaLib/Classes/UIDevice+Extensions.h
new file mode 100644
index 0000000..5594304
--- /dev/null
+++ b/CordovaLib/Classes/UIDevice+Extensions.h
@@ -0,0 +1,33 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ 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
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ */
+
+#import <Foundation/Foundation.h>
+
+@interface UIDevice(org_apache_cordova_UIDevice_Extension)
+
+/*
+    Get the unique identifier from the app bundle's folder, which is already a GUID
+    Upgrading and/or deleting the app and re-installing will get you a new GUID, so
+    this is only unique per install per device.
+ */
+- (NSString*) uniqueAppInstanceIdentifier;
+
+@end
+
+

http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/e456a98e/CordovaLib/Classes/UIDevice+Extensions.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/UIDevice+Extensions.m b/CordovaLib/Classes/UIDevice+Extensions.m
new file mode 100644
index 0000000..140e20a
--- /dev/null
+++ b/CordovaLib/Classes/UIDevice+Extensions.m
@@ -0,0 +1,35 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ 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
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ */
+
+#import <UIKit/UIKit.h>
+#import "UIDevice+Extensions.h"
+
+@implementation UIDevice(org_apache_cordova_UIDevice_Extension)
+
+- (NSString*) uniqueAppInstanceIdentifier
+{
+    // full path to the app folder
+    NSString* bundlePath = [[[NSBundle mainBundle] bundlePath] stringByDeletingLastPathComponent];
+    
+    // return only the folder name (a GUID)
+    return [bundlePath lastPathComponent];
+}
+
+@end
+

http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/e456a98e/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
----------------------------------------------------------------------
diff --git a/CordovaLib/CordovaLib.xcodeproj/project.pbxproj b/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
index 8a3f6fd..8f1b653 100644
--- a/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
+++ b/CordovaLib/CordovaLib.xcodeproj/project.pbxproj
@@ -77,6 +77,10 @@
 		30383DE01385F65600E37E22 /* CDVConnection.m in Sources */ = {isa = PBXBuildFile; fileRef = 307A8F9D1385A2EC00E43782 /* CDVConnection.m */; };
 		30392E4E14F4FCAB00B9E0B8 /* CDVAvailability.h in Headers */ = {isa = PBXBuildFile; fileRef = 30392E4D14F4FCAB00B9E0B8 /* CDVAvailability.h */; };
 		30392E5014F502C200B9E0B8 /* CDVAvailability.h in Headers */ = {isa = PBXBuildFile; fileRef = 30392E4D14F4FCAB00B9E0B8 /* CDVAvailability.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		3062D120151D0EDB000D9128 /* UIDevice+Extensions.h in Headers */ = {isa = PBXBuildFile; fileRef = 3062D11E151D0EDB000D9128 /* UIDevice+Extensions.h */; };
+		3062D121151D0EDB000D9128 /* UIDevice+Extensions.h in Headers */ = {isa = PBXBuildFile; fileRef = 3062D11E151D0EDB000D9128 /* UIDevice+Extensions.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		3062D122151D0EDB000D9128 /* UIDevice+Extensions.m in Sources */ = {isa = PBXBuildFile; fileRef = 3062D11F151D0EDB000D9128 /* UIDevice+Extensions.m */; };
+		3062D123151D0EDB000D9128 /* UIDevice+Extensions.m in Sources */ = {isa = PBXBuildFile; fileRef = 3062D11F151D0EDB000D9128 /* UIDevice+Extensions.m */; };
 		307A8F9E1385A2EC00E43782 /* CDVConnection.h in Headers */ = {isa = PBXBuildFile; fileRef = 307A8F9C1385A2EC00E43782 /* CDVConnection.h */; };
 		307A8F9F1385A2EC00E43782 /* CDVConnection.m in Sources */ = {isa = PBXBuildFile; fileRef = 307A8F9D1385A2EC00E43782 /* CDVConnection.m */; };
 		30956FD2138F1F5600FC3563 /* CDVMotion.h in Headers */ = {isa = PBXBuildFile; fileRef = 30956FD0138F1F5600FC3563 /* CDVMotion.h */; };
@@ -189,6 +193,8 @@
 		30356212141049E1006C2D43 /* CDVWhitelistTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDVWhitelistTests.h; sourceTree = "<group>"; };
 		30356213141049E1006C2D43 /* CDVWhitelistTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDVWhitelistTests.m; sourceTree = "<group>"; };
 		30392E4D14F4FCAB00B9E0B8 /* CDVAvailability.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVAvailability.h; path = Classes/CDVAvailability.h; sourceTree = "<group>"; };
+		3062D11E151D0EDB000D9128 /* UIDevice+Extensions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "UIDevice+Extensions.h"; path = "Classes/UIDevice+Extensions.h"; sourceTree = "<group>"; };
+		3062D11F151D0EDB000D9128 /* UIDevice+Extensions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "UIDevice+Extensions.m"; path = "Classes/UIDevice+Extensions.m"; sourceTree = "<group>"; };
 		307A8F9C1385A2EC00E43782 /* CDVConnection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVConnection.h; path = Classes/CDVConnection.h; sourceTree = "<group>"; };
 		307A8F9D1385A2EC00E43782 /* CDVConnection.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CDVConnection.m; path = Classes/CDVConnection.m; sourceTree = "<group>"; };
 		30956FD0138F1F5600FC3563 /* CDVMotion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CDVMotion.h; path = Classes/CDVMotion.h; sourceTree = "<group>"; };
@@ -441,6 +447,8 @@
 		888700D910923009009987E8 /* Util */ = {
 			isa = PBXGroup;
 			children = (
+				3062D11E151D0EDB000D9128 /* UIDevice+Extensions.h */,
+				3062D11F151D0EDB000D9128 /* UIDevice+Extensions.m */,
 				8887FD281090FBE7009987E8 /* NSDictionary+Extensions.h */,
 				8887FD291090FBE7009987E8 /* NSDictionary+Extensions.m */,
 				302965BB13A94E9D007046C5 /* CDVDebug.h */,
@@ -511,6 +519,7 @@
 				30F5EBAC14CA26E700987760 /* CDVCommandDelegate.h in Headers */,
 				30392E5014F502C200B9E0B8 /* CDVAvailability.h in Headers */,
 				301F2F2B14F3C9CA003FE9FC /* CDV.h in Headers */,
+				3062D121151D0EDB000D9128 /* UIDevice+Extensions.h in Headers */,
 				3034979D1513D56A0090E688 /* CDVLocalStorage.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
@@ -551,6 +560,7 @@
 				301F2F2A14F3C9CA003FE9FC /* CDV.h in Headers */,
 				30392E4E14F4FCAB00B9E0B8 /* CDVAvailability.h in Headers */,
 				3034979C1513D56A0090E688 /* CDVLocalStorage.h in Headers */,
+				3062D120151D0EDB000D9128 /* UIDevice+Extensions.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -756,6 +766,7 @@
 				30C684971407044B004C1A8E /* CDVURLProtocol.m in Sources */,
 				30A90B9414588697006178D3 /* JSONKit.m in Sources */,
 				3034979F1513D56A0090E688 /* CDVLocalStorage.m in Sources */,
+				3062D123151D0EDB000D9128 /* UIDevice+Extensions.m in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -802,6 +813,7 @@
 				8852C43C14B65FD800F0E735 /* CDVViewController.m in Sources */,
 				8852C44114B65FD800F0E735 /* CDVCordovaView.m in Sources */,
 				3034979E1513D56A0090E688 /* CDVLocalStorage.m in Sources */,
+				3062D122151D0EDB000D9128 /* UIDevice+Extensions.m in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};