updated version to 2.6.0
diff --git a/VERSION b/VERSION
index 437459c..e70b452 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.5.0
+2.6.0
diff --git a/lib/cordova-android/VERSION b/lib/cordova-android/VERSION
index f47de85..e70b452 100644
--- a/lib/cordova-android/VERSION
+++ b/lib/cordova-android/VERSION
@@ -1 +1 @@
-2.6.0rc1
+2.6.0
diff --git a/lib/cordova-android/bin/templates/cordova/appinfo.jar b/lib/cordova-android/bin/templates/cordova/appinfo.jar
index 7f8ac60..390bb6d 100644
--- a/lib/cordova-android/bin/templates/cordova/appinfo.jar
+++ b/lib/cordova-android/bin/templates/cordova/appinfo.jar
Binary files differ
diff --git a/lib/cordova-android/bin/templates/project/assets/www/index.html b/lib/cordova-android/bin/templates/project/assets/www/index.html
index 5596f62..4d39cf3 100644
--- a/lib/cordova-android/bin/templates/project/assets/www/index.html
+++ b/lib/cordova-android/bin/templates/project/assets/www/index.html
@@ -19,7 +19,7 @@
-->
<html>
<head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+ <meta charset="utf-8" />
<meta name="format-detection" content="telephone=no" />
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
<link rel="stylesheet" type="text/css" href="css/index.css" />
@@ -33,7 +33,7 @@
<p class="event received">Device is Ready</p>
</div>
</div>
- <script type="text/javascript" src="cordova-2.6.0rc1.js"></script>
+ <script type="text/javascript" src="cordova-2.6.0.js"></script>
<script type="text/javascript" src="js/index.js"></script>
<script type="text/javascript">
app.initialize();
diff --git a/lib/cordova-android/framework/assets/js/cordova.android.js b/lib/cordova-android/framework/assets/js/cordova.android.js
index a0c3278..93e85d1 100644
--- a/lib/cordova-android/framework/assets/js/cordova.android.js
+++ b/lib/cordova-android/framework/assets/js/cordova.android.js
@@ -1,8 +1,8 @@
// Platform: android
-// commit 47593b2bc1dba9bf46545b1da24577f937966e12
+// commit 125dca530923a44a8f44f68f5e1970cbdd4e7faf
-// File generated at :: Thu Mar 21 2013 10:49:00 GMT-0700 (PDT)
+// File generated at :: Mon Apr 01 2013 13:28:03 GMT-0700 (PDT)
/*
Licensed to the Apache Software Foundation (ASF) under one
@@ -6753,29 +6753,34 @@
}
// Try to XHR the cordova_plugins.json file asynchronously.
- var xhr = new context.XMLHttpRequest();
- xhr.onreadystatechange = function() {
- if (this.readyState != 4) { // not DONE
- return;
- }
+ try { // we commented we were going to try, so let us actually try and catch
+ var xhr = new context.XMLHttpRequest();
+ xhr.onreadystatechange = function() {
+ if (this.readyState != 4) { // not DONE
+ return;
+ }
- // If the response is a JSON string which composes an array, call handlePluginsObject.
- // If the request fails, or the response is not a JSON array, just call finishPluginLoading.
- if (this.status == 200) {
- var obj = JSON.parse(this.responseText);
- if (obj && obj instanceof Array && obj.length > 0) {
- handlePluginsObject(obj);
+ // If the response is a JSON string which composes an array, call handlePluginsObject.
+ // If the request fails, or the response is not a JSON array, just call finishPluginLoading.
+ if (this.status == 200) {
+ var obj = JSON.parse(this.responseText);
+ if (obj && obj instanceof Array && obj.length > 0) {
+ handlePluginsObject(obj);
+ } else {
+ finishPluginLoading();
+ }
} else {
finishPluginLoading();
}
- } else {
- finishPluginLoading();
- }
- };
- xhr.open('GET', 'cordova_plugins.json', true); // Async
- xhr.send();
+ };
+ xhr.open('GET', 'cordova_plugins.json', true); // Async
+ xhr.send();
+ }
+ catch(err) {
+ finishPluginLoading();
+ }
}(window));
-})();
\ No newline at end of file
+})();
diff --git a/lib/cordova-android/framework/assets/www/index.html b/lib/cordova-android/framework/assets/www/index.html
index 3b15a4e..1caeb8a 100644
--- a/lib/cordova-android/framework/assets/www/index.html
+++ b/lib/cordova-android/framework/assets/www/index.html
@@ -19,7 +19,7 @@
<html>
<head>
<title></title>
- <script src="cordova-2.6.0rc1.js"></script>
+ <script src="cordova-2.6.0.js"></script>
</head>
<body>
diff --git a/lib/cordova-android/framework/src/org/apache/cordova/CameraLauncher.java b/lib/cordova-android/framework/src/org/apache/cordova/CameraLauncher.java
index 9473828..22a9b94 100755
--- a/lib/cordova-android/framework/src/org/apache/cordova/CameraLauncher.java
+++ b/lib/cordova-android/framework/src/org/apache/cordova/CameraLauncher.java
@@ -312,10 +312,12 @@
// If sending filename back
else if (destType == FILE_URI || destType == NATIVE_URI) {
- if (!this.saveToPhotoAlbum) {
- uri = Uri.fromFile(new File(DirectoryManager.getTempDirectoryPath(this.cordova.getActivity()), System.currentTimeMillis() + ".jpg"));
+ if (this.saveToPhotoAlbum) {
+ Uri inputUri = getUriFromMediaStore();
+ //Just because we have a media URI doesn't mean we have a real file, we need to make it
+ uri = Uri.fromFile(new File(FileHelper.getRealPath(inputUri, this.cordova)));
} else {
- uri = getUriFromMediaStore();
+ uri = Uri.fromFile(new File(DirectoryManager.getTempDirectoryPath(this.cordova.getActivity()), System.currentTimeMillis() + ".jpg"));
}
if (uri == null) {
@@ -444,7 +446,7 @@
ExifHelper exif = new ExifHelper();
try {
if (this.encodingType == JPEG) {
- exif.createInFile(resizePath);
+ exif.createInFile(FileHelper.getRealPath(uri, this.cordova));
exif.readExifData();
rotate = exif.getOrientation();
}
@@ -458,7 +460,7 @@
// Restore exif data to file
if (this.encodingType == JPEG) {
- exif.createOutFile(FileHelper.getRealPath(uri, this.cordova));
+ exif.createOutFile(resizePath);
exif.writeExifData();
}
diff --git a/lib/cordova-android/framework/src/org/apache/cordova/Device.java b/lib/cordova-android/framework/src/org/apache/cordova/Device.java
index ad399f0..0f828a1 100644
--- a/lib/cordova-android/framework/src/org/apache/cordova/Device.java
+++ b/lib/cordova-android/framework/src/org/apache/cordova/Device.java
@@ -38,7 +38,7 @@
public class Device extends CordovaPlugin {
public static final String TAG = "Device";
- public static String cordovaVersion = "2.6.0rc1"; // Cordova version
+ public static String cordovaVersion = "2.6.0"; // Cordova version
public static String platform = "Android"; // Device OS
public static String uuid; // Device UUID
diff --git a/lib/cordova-android/framework/src/org/apache/cordova/InAppBrowser.java b/lib/cordova-android/framework/src/org/apache/cordova/InAppBrowser.java
index 48e27c6..0d5d496 100644
--- a/lib/cordova-android/framework/src/org/apache/cordova/InAppBrowser.java
+++ b/lib/cordova-android/framework/src/org/apache/cordova/InAppBrowser.java
@@ -151,6 +151,21 @@
pluginResult.setKeepCallback(false);
this.callbackContext.sendPluginResult(pluginResult);
}
+ else if (action.equals("injectScriptCode")) {
+ String source = args.getString(0);
+
+ org.json.JSONArray jsonEsc = new org.json.JSONArray();
+ jsonEsc.put(source);
+ String jsonRepr = jsonEsc.toString();
+ String jsonSourceString = jsonRepr.substring(1, jsonRepr.length()-1);
+ String scriptEnclosure = "(function(d){var c=d.createElement('script');c.type='text/javascript';c.innerText="
+ + jsonSourceString
+ + ";d.getElementsByTagName('head')[0].appendChild(c);})(document)";
+ this.inAppWebView.loadUrl("javascript:" + scriptEnclosure);
+
+ PluginResult pluginResult = new PluginResult(PluginResult.Status.OK);
+ this.callbackContext.sendPluginResult(pluginResult);
+ }
else {
status = PluginResult.Status.INVALID_ACTION;
}
@@ -445,7 +460,7 @@
//Toggle whether this is enabled or not!
Bundle appSettings = cordova.getActivity().getIntent().getExtras();
- boolean enableDatabase = appSettings.getBoolean("InAppBrowserStorageEnabled", true);
+ boolean enableDatabase = appSettings == null ? true : appSettings.getBoolean("InAppBrowserStorageEnabled", true);
if(enableDatabase)
{
String databasePath = cordova.getActivity().getApplicationContext().getDir("inAppBrowserDB", Context.MODE_PRIVATE).getPath();
diff --git a/lib/cordova-android/framework/src/org/apache/cordova/api/PluginManager.java b/lib/cordova-android/framework/src/org/apache/cordova/api/PluginManager.java
index 337ef12..774b21c 100755
--- a/lib/cordova-android/framework/src/org/apache/cordova/api/PluginManager.java
+++ b/lib/cordova-android/framework/src/org/apache/cordova/api/PluginManager.java
@@ -30,6 +30,7 @@
import android.content.Intent;
import android.content.res.XmlResourceParser;
+import android.util.Log;
import android.webkit.WebResourceResponse;
/**
@@ -213,6 +214,7 @@
public boolean exec(String service, String action, String callbackId, String rawArgs) {
CordovaPlugin plugin = this.getPlugin(service);
if (plugin == null) {
+ Log.d(TAG, "exec() call to unknown plugin: " + service);
PluginResult cr = new PluginResult(PluginResult.Status.CLASS_NOT_FOUND_EXCEPTION);
app.sendPluginResult(cr, callbackId);
return true;
diff --git a/lib/cordova-android/test/res/xml/cordova.xml b/lib/cordova-android/test/res/xml/cordova.xml
deleted file mode 100755
index 4aebda4..0000000
--- a/lib/cordova-android/test/res/xml/cordova.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- 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.
--->
-<cordova>
- <!--
- access elements control the Android whitelist.
- Domains are assumed blocked unless set otherwise
- -->
-
- <access origin="http://127.0.0.1*"/> <!-- allow local pages -->
-
- <!-- <access origin="https://example.com" /> allow any secure requests to example.com -->
- <!-- <access origin="https://example.com" subdomains="true" /> such as above, but including subdomains, such as www -->
- <!-- <access origin=".*"/> Allow all domains, suggested development use only -->
-
- <log level="DEBUG"/>
- <preference name="useBrowserHistory" value="true" />
-</cordova>
-
-
-
diff --git a/lib/cordova-android/test/res/xml/plugins.xml b/lib/cordova-android/test/res/xml/plugins.xml
deleted file mode 100644
index 17074ef..0000000
--- a/lib/cordova-android/test/res/xml/plugins.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- 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.
--->
-<plugins>
- <plugin name="App" value="org.apache.cordova.App"/>
- <plugin name="Activity" value="org.apache.cordova.test.ActivityPlugin"/>
- <plugin name="Geolocation" value="org.apache.cordova.GeoBroker"/>
- <plugin name="Device" value="org.apache.cordova.Device"/>
- <plugin name="Accelerometer" value="org.apache.cordova.AccelListener"/>
- <plugin name="Compass" value="org.apache.cordova.CompassListener"/>
- <plugin name="Media" value="org.apache.cordova.AudioHandler"/>
- <plugin name="Camera" value="org.apache.cordova.CameraLauncher"/>
- <plugin name="Contacts" value="org.apache.cordova.ContactManager"/>
- <plugin name="File" value="org.apache.cordova.FileUtils"/>
- <plugin name="NetworkStatus" value="org.apache.cordova.NetworkManager"/>
- <plugin name="Notification" value="org.apache.cordova.Notification"/>
- <plugin name="Storage" value="org.apache.cordova.Storage"/>
- <plugin name="Temperature" value="org.apache.cordova.TempListener"/>
- <plugin name="FileTransfer" value="org.apache.cordova.FileTransfer"/>
- <plugin name="Capture" value="org.apache.cordova.Capture"/>
- <plugin name="Battery" value="org.apache.cordova.BatteryListener"/>
- <plugin name="SplashScreen" value="org.apache.cordova.SplashScreen"/>
-</plugins>
diff --git a/lib/cordova-blackberry/VERSION b/lib/cordova-blackberry/VERSION
index 437459c..e70b452 100644
--- a/lib/cordova-blackberry/VERSION
+++ b/lib/cordova-blackberry/VERSION
@@ -1 +1 @@
-2.5.0
+2.6.0
diff --git a/lib/cordova-blackberry/bin/templates/project/www/VERSION b/lib/cordova-blackberry/bin/templates/project/www/VERSION
index 437459c..e70b452 100644
--- a/lib/cordova-blackberry/bin/templates/project/www/VERSION
+++ b/lib/cordova-blackberry/bin/templates/project/www/VERSION
@@ -1 +1 @@
-2.5.0
+2.6.0
diff --git a/lib/cordova-blackberry/bin/templates/project/www/index.html b/lib/cordova-blackberry/bin/templates/project/www/index.html
index 6b53abc..4d39cf3 100644
--- a/lib/cordova-blackberry/bin/templates/project/www/index.html
+++ b/lib/cordova-blackberry/bin/templates/project/www/index.html
@@ -33,7 +33,7 @@
<p class="event received">Device is Ready</p>
</div>
</div>
- <script type="text/javascript" src="cordova-2.5.0.js"></script>
+ <script type="text/javascript" src="cordova-2.6.0.js"></script>
<script type="text/javascript" src="js/index.js"></script>
<script type="text/javascript">
app.initialize();
diff --git a/lib/cordova-blackberry/framework/ext/src/org/apache/cordova/device/Device.java b/lib/cordova-blackberry/framework/ext/src/org/apache/cordova/device/Device.java
index 3bb4824..af39a49 100644
--- a/lib/cordova-blackberry/framework/ext/src/org/apache/cordova/device/Device.java
+++ b/lib/cordova-blackberry/framework/ext/src/org/apache/cordova/device/Device.java
@@ -54,7 +54,7 @@
JSONObject device = new JSONObject();
device.put( FIELD_PLATFORM, "BlackBerry");
device.put( FIELD_UUID, new Integer( DeviceInfo.getDeviceId()) );
- device.put( FIELD_CORDOVA, "2.5.0" );
+ device.put( FIELD_CORDOVA, "2.6.0" );
device.put( FIELD_MODEL, new String(DeviceInfo.getDeviceName()) );
device.put( FIELD_NAME, new String(DeviceInfo.getDeviceName()) );
device.put( FIELD_VERSION, new String(DeviceInfo.getSoftwareVersion()) );
diff --git a/lib/cordova-blackberry/framework/ext/src/org/apache/cordova/file/FileManager.java b/lib/cordova-blackberry/framework/ext/src/org/apache/cordova/file/FileManager.java
index e0c3556..55ea436 100644
--- a/lib/cordova-blackberry/framework/ext/src/org/apache/cordova/file/FileManager.java
+++ b/lib/cordova-blackberry/framework/ext/src/org/apache/cordova/file/FileManager.java
@@ -96,7 +96,6 @@
* @return A PluginResult object with a status and message.
*/
public PluginResult execute(String action, JSONArray args, String callbackId) {
-
// perform specified action
if (ACTION_READ_AS_TEXT.equals(action)) {
// get file path
@@ -547,11 +546,11 @@
protected static PluginResult resolveFileSystemURI(String uri) {
PluginResult result = null;
Entry entry = null;
-
try {
entry = getEntryFromURI(uri);
}
catch (IllegalArgumentException e) {
+ Logger.log(e.toString());
return new PluginResult(
PluginResult.Status.JSON_EXCEPTION,
ENCODING_ERR);
@@ -565,6 +564,7 @@
result = new PluginResult(PluginResult.Status.OK,
entry.toJSONObject());
}
+
return result;
}
@@ -889,6 +889,13 @@
throw new IllegalArgumentException("Invalid URI.");
}
+ //check for query string
+ int queryIndex = filePath.indexOf('?');
+ if (queryIndex > 0) {
+ path = filePath.substring(0, queryIndex); // discard the query string
+ Logger.log(FileManager.class.getName() + ": found query string when resolving URI = " + filePath.substring(queryIndex));
+ }
+
// create a file system entry
Entry entry = null;
if (path.startsWith(FileUtils.LOCAL_PROTOCOL)) {
diff --git a/lib/cordova-blackberry/javascript/cordova.blackberry.js b/lib/cordova-blackberry/javascript/cordova.blackberry.js
index fbe61f5..86b9e8b 100644
--- a/lib/cordova-blackberry/javascript/cordova.blackberry.js
+++ b/lib/cordova-blackberry/javascript/cordova.blackberry.js
@@ -1,8 +1,8 @@
// Platform: blackberry
-// commit bbf1562d4934b1331ffb263424b6ae054cedeb71
+// commit 125dca530923a44a8f44f68f5e1970cbdd4e7faf
-// File generated at :: Fri Mar 22 2013 14:49:45 GMT-0700 (PDT)
+// File generated at :: Wed Apr 03 2013 15:26:44 GMT-0700 (PDT)
/*
Licensed to the Apache Software Foundation (ASF) under one
@@ -5361,7 +5361,7 @@
model: "PlayBook",
name: "PlayBook", // deprecated: please use device.model
uuid: info.uuid,
- cordova: "2.5.0"
+ cordova: "2.6.0"
});
}),
request = new blackberry.transport.RemoteFunctionCall("org/apache/cordova/getDeviceInfo");
@@ -9290,7 +9290,7 @@
model: "Dev Alpha",
name: "Dev Alpha", // deprecated: please use device.model
uuid: blackberry.identity.uuid,
- cordova: "2.5.0"
+ cordova: "2.6.0"
});
return { "status" : cordova.callbackStatus.NO_RESULT, "message" : "Device info returned" };
@@ -10824,27 +10824,32 @@
}
// Try to XHR the cordova_plugins.json file asynchronously.
- var xhr = new context.XMLHttpRequest();
- xhr.onreadystatechange = function() {
- if (this.readyState != 4) { // not DONE
- return;
- }
+ try { // we commented we were going to try, so let us actually try and catch
+ var xhr = new context.XMLHttpRequest();
+ xhr.onreadystatechange = function() {
+ if (this.readyState != 4) { // not DONE
+ return;
+ }
- // If the response is a JSON string which composes an array, call handlePluginsObject.
- // If the request fails, or the response is not a JSON array, just call finishPluginLoading.
- if (this.status == 200) {
- var obj = JSON.parse(this.responseText);
- if (obj && obj instanceof Array && obj.length > 0) {
- handlePluginsObject(obj);
+ // If the response is a JSON string which composes an array, call handlePluginsObject.
+ // If the request fails, or the response is not a JSON array, just call finishPluginLoading.
+ if (this.status == 200) {
+ var obj = JSON.parse(this.responseText);
+ if (obj && obj instanceof Array && obj.length > 0) {
+ handlePluginsObject(obj);
+ } else {
+ finishPluginLoading();
+ }
} else {
finishPluginLoading();
}
- } else {
- finishPluginLoading();
- }
- };
- xhr.open('GET', 'cordova_plugins.json', true); // Async
- xhr.send();
+ };
+ xhr.open('GET', 'cordova_plugins.json', true); // Async
+ xhr.send();
+ }
+ catch(err) {
+ finishPluginLoading();
+ }
}(window));
diff --git a/lib/cordova-ios/CordovaLib/Classes/CDVCamera.m b/lib/cordova-ios/CordovaLib/Classes/CDVCamera.m
index ab1154e..823fde9 100644
--- a/lib/cordova-ios/CordovaLib/Classes/CDVCamera.m
+++ b/lib/cordova-ios/CordovaLib/Classes/CDVCamera.m
@@ -85,12 +85,6 @@
return;
}
- NSNumber* cameraDirection = [arguments objectAtIndex:11];
- UIImagePickerControllerCameraDevice cameraDevice = UIImagePickerControllerCameraDeviceRear; // default
- if (cameraDirection != nil) {
- cameraDevice = (UIImagePickerControllerSourceType)[cameraDirection intValue];
- }
-
bool allowEdit = [[arguments objectAtIndex:7] boolValue];
NSNumber* targetWidth = [arguments objectAtIndex:3];
NSNumber* targetHeight = [arguments objectAtIndex:4];
@@ -114,7 +108,6 @@
cameraPicker.delegate = self;
cameraPicker.sourceType = sourceType;
- cameraPicker.cameraDevice = cameraDevice;
cameraPicker.allowsEditing = allowEdit; // THIS IS ALL IT TAKES FOR CROPPING - jm
cameraPicker.callbackId = callbackId;
cameraPicker.targetSize = targetSize;
@@ -132,18 +125,22 @@
cameraPicker.returnType = ([arguments objectAtIndex:1]) ? [[arguments objectAtIndex:1] intValue] : DestinationTypeFileUri;
if (sourceType == UIImagePickerControllerSourceTypeCamera) {
- // we only allow taking pictures (no video) in this api
+ // We only allow taking pictures (no video) in this API.
cameraPicker.mediaTypes = [NSArray arrayWithObjects:(NSString*)kUTTypeImage, nil];
+
+ // We can only set the camera device if we're actually using the camera.
+ NSNumber* cameraDirection = [command argumentAtIndex:11 withDefault:[NSNumber numberWithInteger:UIImagePickerControllerCameraDeviceRear]];
+ cameraPicker.cameraDevice = (UIImagePickerControllerCameraDevice)[cameraDirection intValue];
} else if (mediaType == MediaTypeAll) {
cameraPicker.mediaTypes = [UIImagePickerController availableMediaTypesForSourceType:sourceType];
} else {
- NSArray* mediaArray = [NSArray arrayWithObjects:(NSString*)(mediaType == MediaTypeVideo ? kUTTypeMovie:kUTTypeImage), nil];
+ NSArray* mediaArray = [NSArray arrayWithObjects:(NSString*)(mediaType == MediaTypeVideo ? kUTTypeMovie : kUTTypeImage), nil];
cameraPicker.mediaTypes = mediaArray;
}
if ([self popoverSupported] && (sourceType != UIImagePickerControllerSourceTypeCamera)) {
if (cameraPicker.popoverController == nil) {
- cameraPicker.popoverController = [[NSClassFromString (@"UIPopoverController")alloc] initWithContentViewController:cameraPicker];
+ cameraPicker.popoverController = [[NSClassFromString(@"UIPopoverController")alloc] initWithContentViewController:cameraPicker];
}
NSDictionary* options = [command.arguments objectAtIndex:10 withDefault:nil];
[self displayPopover:options];
@@ -299,55 +296,17 @@
data = UIImagePNGRepresentation(scaledImage == nil ? image : scaledImage);
} else {
data = UIImageJPEGRepresentation(scaledImage == nil ? image : scaledImage, cameraPicker.quality / 100.0f);
-
- CDVJpegHeaderWriter * exifWriter = [[CDVJpegHeaderWriter alloc] init];
-
- NSString * headerstring = [exifWriter createExifAPP1: [info objectForKey:@"UIImagePickerControllerMediaMetadata"]];
- NSMutableData * exifdata = [NSMutableData dataWithCapacity: [headerstring length]/2];
- int idx;
- for (idx = 0; idx+1 < [headerstring length]; idx+=2) {
- NSRange range = NSMakeRange(idx, 2);
- NSString* hexStr = [headerstring substringWithRange:range];
- NSScanner* scanner = [NSScanner scannerWithString:hexStr];
- unsigned int intValue;
- [scanner scanHexInt:&intValue];
- [exifdata appendBytes:&intValue length:1];
- }
-
- NSMutableData * ddata = [NSMutableData dataWithCapacity: [data length]];
- NSMakeRange(0,4);
- int loc = 0;
- bool done = false;
- // read the jpeg data until we encounter the app1==0xFFE1 marker
- while (loc+1 < [data length]) {
- NSData * blag = [data subdataWithRange: NSMakeRange(loc,2)];
- if( [[blag description] isEqualToString : @"<ffe1>"]) {
- // read the APP1 block size bits
- NSString * the = [exifWriter hexStringFromData:[data subdataWithRange: NSMakeRange(loc+2,2)]];
- NSNumber * app1width = [exifWriter numericFromHexString:the];
- //consume the original app1 block
- [ddata appendData:exifdata];
- // advance our loc marker past app1
- loc += [app1width intValue] + 2;
- done = true;
- } else {
- if(!done) {
- [ddata appendData:blag];
- loc += 2;
- } else {
- break;
- }
- }
- }
- // copy the remaining data
- [ddata appendData:[data subdataWithRange: NSMakeRange(loc,[data length]-loc)]];
- data = ddata;
+
+ /* splice loc */
+ CDVJpegHeaderWriter* exifWriter = [[CDVJpegHeaderWriter alloc] init];
+ NSString* headerstring = [exifWriter createExifAPP1:[info objectForKey:@"UIImagePickerControllerMediaMetadata"]];
+ data = [exifWriter spliceExifBlockIntoJpeg:data withExifBlock:headerstring];
}
if (cameraPicker.returnType == DestinationTypeFileUri) {
// write to temp directory and return URI
// get the temp directory path
- NSString* docsPath = [NSTemporaryDirectory ()stringByStandardizingPath];
+ NSString* docsPath = [NSTemporaryDirectory()stringByStandardizingPath];
NSError* err = nil;
NSFileManager* fileMgr = [[NSFileManager alloc] init]; // recommended by apple (vs [NSFileManager defaultManager]) to be threadsafe
// generate unique file name
@@ -472,7 +431,7 @@
rotation_radians = 0.0;
break;
- case UIImageOrientationDown :
+ case UIImageOrientationDown:
rotation_radians = M_PI; // don't be scared of radians, if you're reading this, you're good at math
break;
@@ -571,7 +530,7 @@
// first parameter an image
[postBody appendData:[[NSString stringWithFormat:@"\r\n--%@\r\n", boundary] dataUsingEncoding:NSUTF8StringEncoding]];
[postBody appendData:[[NSString stringWithFormat:@"Content-Disposition: form-data; name=\"upload\"; filename=\"%@\"\r\n", filename] dataUsingEncoding:NSUTF8StringEncoding]];
- [postBody appendData:[@"Content-Type: image/png\r\n\r\n" dataUsingEncoding:NSUTF8StringEncoding]];
+ [postBody appendData:[@"Content-Type: image/png\r\n\r\n" dataUsingEncoding : NSUTF8StringEncoding]];
[postBody appendData:imageData];
// // second parameter information
diff --git a/lib/cordova-ios/CordovaLib/Classes/CDVJpegHeaderWriter.h b/lib/cordova-ios/CordovaLib/Classes/CDVJpegHeaderWriter.h
index 02fe91f..3b43ef0 100644
--- a/lib/cordova-ios/CordovaLib/Classes/CDVJpegHeaderWriter.h
+++ b/lib/cordova-ios/CordovaLib/Classes/CDVJpegHeaderWriter.h
@@ -24,6 +24,8 @@
NSDictionary * IFD0TagFormatDict;
}
+- (NSData*) spliceExifBlockIntoJpeg: (NSData*) jpegdata
+ withExifBlock: (NSString*) exifstr;
- (NSString*) createExifAPP1 : (NSDictionary*) datadict;
- (NSString*) formattedHexStringFromDecimalNumber: (NSNumber*) numb
withPlaces: (NSNumber*) width;
diff --git a/lib/cordova-ios/CordovaLib/Classes/CDVJpegHeaderWriter.m b/lib/cordova-ios/CordovaLib/Classes/CDVJpegHeaderWriter.m
index 7b59d11..90c96d2 100644
--- a/lib/cordova-ios/CordovaLib/Classes/CDVJpegHeaderWriter.m
+++ b/lib/cordova-ios/CordovaLib/Classes/CDVJpegHeaderWriter.m
@@ -45,7 +45,7 @@
TAGINF(@"011a", [NSNumber numberWithInt:EDT_URATIONAL], @1), @"XResolution",
TAGINF(@"011b", [NSNumber numberWithInt:EDT_URATIONAL], @1), @"YResolution",
// currently supplied outside of Exif data block by UIImagePickerControllerMediaMetadata, this is set manually in CDVCamera.m
- TAGINF(@"0112", [NSNumber numberWithInt:EDT_USHORT], @1), @"Orientation",
+ /* TAGINF(@"0112", [NSNumber numberWithInt:EDT_USHORT], @1), @"Orientation",
// rest of the tags are supported by exif spec, but are not specified by UIImagePickerControllerMediaMedadata
// should camera hardware supply these values in future versions, or if they can be derived, ImageHeaderWriter will include them gracefully
@@ -58,43 +58,89 @@
TAGINF(@"8298", [NSNumber numberWithInt:EDT_URATIONAL], @0), @"Copyright",
// offset to exif subifd, we determine this dynamically based on the size of the main exif IFD
- TAGINF(@"8769", [NSNumber numberWithInt:EDT_ULONG], @1), @"ExifOffset",
+ TAGINF(@"8769", [NSNumber numberWithInt:EDT_ULONG], @1), @"ExifOffset",*/
nil];
+
// supported tages for exif subIFD
SubIFDTagFormatDict = [[NSDictionary alloc] initWithObjectsAndKeys:
- // TAGINF(@"9000", [NSNumber numberWithInt:], @), @"ExifVersion",
- // TAGINF(@"9202",[NSNumber numberWithInt:EDT_URATIONAL],@1), @"ApertureValue",
- // TAGINF(@"9203",[NSNumber numberWithInt:EDT_SRATIONAL],@1), @"BrightnessValue",
+ //TAGINF(@"9000", [NSNumber numberWithInt:], @), @"ExifVersion",
+ //TAGINF(@"9202",[NSNumber numberWithInt:EDT_URATIONAL],@1), @"ApertureValue",
+ //TAGINF(@"9203",[NSNumber numberWithInt:EDT_SRATIONAL],@1), @"BrightnessValue",
TAGINF(@"a001",[NSNumber numberWithInt:EDT_USHORT],@1), @"ColorSpace",
TAGINF(@"9004",[NSNumber numberWithInt:EDT_ASCII_STRING],@20), @"DateTimeDigitized",
TAGINF(@"9003",[NSNumber numberWithInt:EDT_ASCII_STRING],@20), @"DateTimeOriginal",
TAGINF(@"a402", [NSNumber numberWithInt:EDT_USHORT], @1), @"ExposureMode",
TAGINF(@"8822", [NSNumber numberWithInt:EDT_USHORT], @1), @"ExposureProgram",
- TAGINF(@"829a", [NSNumber numberWithInt:EDT_URATIONAL], @1), @"ExposureTime",
- TAGINF(@"829d", [NSNumber numberWithInt:EDT_URATIONAL], @1), @"FNumber",
+ //TAGINF(@"829a", [NSNumber numberWithInt:EDT_URATIONAL], @1), @"ExposureTime",
+ //TAGINF(@"829d", [NSNumber numberWithInt:EDT_URATIONAL], @1), @"FNumber",
TAGINF(@"9209", [NSNumber numberWithInt:EDT_USHORT], @1), @"Flash",
// FocalLengthIn35mmFilm
TAGINF(@"a405", [NSNumber numberWithInt:EDT_USHORT], @1), @"FocalLenIn35mmFilm",
- TAGINF(@"920a", [NSNumber numberWithInt:EDT_URATIONAL], @1), @"FocalLength",
-
+ //TAGINF(@"920a", [NSNumber numberWithInt:EDT_URATIONAL], @1), @"FocalLength",
//TAGINF(@"8827", [NSNumber numberWithInt:EDT_USHORT], @2), @"ISOSpeedRatings",
-
- TAGINF(@"9207",[NSNumber numberWithInt:EDT_USHORT],@1), @"MeteringMode",
+ TAGINF(@"9207", [NSNumber numberWithInt:EDT_USHORT],@1), @"MeteringMode",
// specific to compressed data
TAGINF(@"a002", [NSNumber numberWithInt:EDT_ULONG],@1), @"PixelXDimension",
TAGINF(@"a003", [NSNumber numberWithInt:EDT_ULONG],@1), @"PixelYDimension",
// data type undefined, but this is a DSC camera, so value is always 1, treat as ushort
TAGINF(@"a301", [NSNumber numberWithInt:EDT_USHORT],@1), @"SceneType",
TAGINF(@"a217",[NSNumber numberWithInt:EDT_USHORT],@1), @"SensingMethod",
- // TAGINF(@"9201", [NSNumber numberWithInt:EDT_SRATIONAL], @1), @"ShutterSpeedValue",
+ //TAGINF(@"9201", [NSNumber numberWithInt:EDT_SRATIONAL], @1), @"ShutterSpeedValue",
// specifies location of main subject in scene (x,y,wdith,height) expressed before rotation processing
- // TAGINF(@"9214", [NSNumber numberWithInt:EDT_USHORT], @4), @"SubjectArea",
+ //TAGINF(@"9214", [NSNumber numberWithInt:EDT_USHORT], @4), @"SubjectArea",
TAGINF(@"a403", [NSNumber numberWithInt:EDT_USHORT], @1), @"WhiteBalance",
- nil];
+ nil];
return self;
}
+- (NSData*) spliceExifBlockIntoJpeg: (NSData*) jpegdata withExifBlock: (NSString*) exifstr {
+
+ CDVJpegHeaderWriter * exifWriter = [[CDVJpegHeaderWriter alloc] init];
+
+ NSMutableData * exifdata = [NSMutableData dataWithCapacity: [exifstr length]/2];
+ int idx;
+ for (idx = 0; idx+1 < [exifstr length]; idx+=2) {
+ NSRange range = NSMakeRange(idx, 2);
+ NSString* hexStr = [exifstr substringWithRange:range];
+ NSScanner* scanner = [NSScanner scannerWithString:hexStr];
+ unsigned int intValue;
+ [scanner scanHexInt:&intValue];
+ [exifdata appendBytes:&intValue length:1];
+ }
+
+ NSMutableData * ddata = [NSMutableData dataWithCapacity: [jpegdata length]];
+ NSMakeRange(0,4);
+ int loc = 0;
+ bool done = false;
+ // read the jpeg data until we encounter the app1==0xFFE1 marker
+ while (loc+1 < [jpegdata length]) {
+ NSData * blag = [jpegdata subdataWithRange: NSMakeRange(loc,2)];
+ if( [[blag description] isEqualToString : @"<ffe1>"]) {
+ // read the APP1 block size bits
+ NSString * the = [exifWriter hexStringFromData:[jpegdata subdataWithRange: NSMakeRange(loc+2,2)]];
+ NSNumber * app1width = [exifWriter numericFromHexString:the];
+ //consume the original app1 block
+ [ddata appendData:exifdata];
+ // advance our loc marker past app1
+ loc += [app1width intValue] + 2;
+ done = true;
+ } else {
+ if(!done) {
+ [ddata appendData:blag];
+ loc += 2;
+ } else {
+ break;
+ }
+ }
+ }
+ // copy the remaining data
+ [ddata appendData:[jpegdata subdataWithRange: NSMakeRange(loc,[jpegdata length]-loc)]];
+ return ddata;
+}
+
+
+
/**
* Create the Exif data block as a hex string
* jpeg uses Application Markers (APP's) as markers for application data
@@ -127,11 +173,15 @@
//data labeled as EXIF in UIImagePickerControllerMediaMetaData is part of the EXIF Sub IFD portion of APP1
subExifIFD = [self createExifIFDFromDict: [datadict objectForKey:@"{Exif}"] withFormatDict: SubIFDTagFormatDict isIFD0:NO];
-
+ /*
+ NSLog(@"SUB EXIF IFD %@ WITH SIZE: %d",exifIFD,[exifIFD length]);
+
+ NSLog(@"SUB EXIF IFD %@ WITH SIZE: %d",subExifIFD,[subExifIFD length]);
+ */
// construct the complete app1 data block
app1 = [[NSMutableString alloc] initWithFormat: @"%@%04x%@%@%@%@%@",
app1marker,
- 16+[exifIFD length]/2+[subExifIFD length]/2/*16+[exifIFD length]/2*/,
+ 16 + ([exifIFD length]/2) + ([subExifIFD length]/2) /*16+[exifIFD length]/2*/,
exifmarker,
tiffheader,
ifd0offset,
@@ -147,7 +197,7 @@
NSArray * knownkeys = [formatdict allKeys]; // only keys in knowkeys are considered for entry in this IFD
NSMutableArray * ifdblock = [[NSMutableArray alloc] initWithCapacity: [datadict count]]; // all ifd entries
NSMutableArray * ifddatablock = [[NSMutableArray alloc] initWithCapacity: [datadict count]]; // data block entries
- ifd0flag = NO; // ifd0 requires a special flag and has offset to next ifd appended to end
+ // ifd0flag = NO; // ifd0 requires a special flag and has offset to next ifd appended to end
// iterate through known provided data keys
for (int i = 0; i < [datakeys count]; i++) {
@@ -156,7 +206,7 @@
if ([knownkeys indexOfObject: key] != NSNotFound) {
// create new IFD entry
NSString * entry = [self createIFDElement: key
- withFormatDict: formatdict
+ withFormat: [formatdict objectForKey:key]
withElementData: [datadict objectForKey:key]];
// create the IFD entry's data block
NSString * data = [self createIFDElementDataWithFormat: [formatdict objectForKey:key]
@@ -202,7 +252,8 @@
// calculate IFD0 terminal offset tags, currently ExifSubIFD
int entrycount = [ifdblock count];
if (ifd0flag) {
- NSNumber * offset = [NSNumber numberWithInt:[exifstr length] / 2 + [dbstr length] / 2 ];
+ // 18 accounts for 8769's width + offset to next ifd, 8 accounts for start of header
+ NSNumber * offset = [NSNumber numberWithInt:[exifstr length] / 2 + [dbstr length] / 2 + 18+8];
[self appendExifOffsetTagTo: exifstr
withOffset : offset];
@@ -216,18 +267,18 @@
}
// Creates an exif formatted exif information file directory entry
-- (NSString*) createIFDElement: (NSString*) elementName withFormatDict : (NSDictionary*) formatdict withElementData : (NSString*) data {
- NSArray * fielddata = [formatdict objectForKey: elementName];// format data of desired field
- if (fielddata) {
+- (NSString*) createIFDElement: (NSString*) elementName withFormat: (NSArray*) formtemplate withElementData: (NSString*) data {
+ //NSArray * fielddata = [formatdict objectForKey: elementName];// format data of desired field
+ if (formtemplate) {
// format string @"%@%@%@%@", tag number, data format, components, value
- NSNumber * dataformat = [fielddata objectAtIndex:1];
- NSNumber * components = [fielddata objectAtIndex:2];
+ NSNumber * dataformat = [formtemplate objectAtIndex:1];
+ NSNumber * components = [formtemplate objectAtIndex:2];
if([components intValue] == 0) {
components = [NSNumber numberWithInt: [data length] * DataTypeToWidth[[dataformat intValue]-1]];
}
return [[NSString alloc] initWithFormat: @"%@%@%08x",
- [fielddata objectAtIndex:0], // the field code
+ [formtemplate objectAtIndex:0], // the field code
[self formatNumberWithLeadingZeroes: dataformat withPlaces: @4], // the data type code
[components intValue]]; // number of components
}
@@ -243,7 +294,7 @@
NSArray * format = TAGINF(@"8769", [NSNumber numberWithInt:EDT_ULONG], @1);
NSString * entry = [self createIFDElement: @"ExifOffset"
- withFormatDict: IFD0TagFormatDict
+ withFormat: format
withElementData: [offset stringValue]];
NSString * data = [self createIFDElementDataWithFormat: format
@@ -275,7 +326,7 @@
case EDT_USHORT:
return [[NSString alloc] initWithFormat : @"%@%@",
[self formattedHexStringFromDecimalNumber: [NSNumber numberWithInt: [data intValue]] withPlaces: @4],
- @"00000000"];
+ @"0000"];
case EDT_ULONG:
tmp = [NSNumber numberWithUnsignedLong:[data intValue]];
return [NSString stringWithFormat : @"%@",
@@ -290,7 +341,6 @@
case EDT_UNDEFINED:
break; // 8 bits
case EDT_SSHORT:
-
break;
case EDT_SLONG:
break; // 32bit signed integer (2's complement)
diff --git a/lib/cordova-ios/CordovaLib/Classes/CDVSplashScreen.m b/lib/cordova-ios/CordovaLib/Classes/CDVSplashScreen.m
index efe3eaa..45889a0 100644
--- a/lib/cordova-ios/CordovaLib/Classes/CDVSplashScreen.m
+++ b/lib/cordova-ios/CordovaLib/Classes/CDVSplashScreen.m
@@ -87,7 +87,12 @@
// Set the frame & image later.
_imageView = [[UIImageView alloc] init];
[parentView addSubview:_imageView];
- [parentView addSubview:_activityView];
+
+ id showSplashScreenSpinnerValue = [self.commandDelegate.settings objectForKey:@"ShowSplashScreenSpinner"];
+ // backwards compatibility - if key is missing, default to true
+ if ((showSplashScreenSpinnerValue == nil) || [showSplashScreenSpinnerValue boolValue]) {
+ [parentView addSubview:_activityView];
+ }
// Frame is required when launching in portrait mode.
// Bounds for landscape since it captures the rotation.
diff --git a/lib/cordova-ios/CordovaLib/VERSION b/lib/cordova-ios/CordovaLib/VERSION
index f47de85..e70b452 100644
--- a/lib/cordova-ios/CordovaLib/VERSION
+++ b/lib/cordova-ios/CordovaLib/VERSION
@@ -1 +1 @@
-2.6.0rc1
+2.6.0
diff --git a/lib/cordova-ios/CordovaLib/cordova.ios.js b/lib/cordova-ios/CordovaLib/cordova.ios.js
index 8ed1706..4df7891 100644
--- a/lib/cordova-ios/CordovaLib/cordova.ios.js
+++ b/lib/cordova-ios/CordovaLib/cordova.ios.js
@@ -1,8 +1,8 @@
// Platform: ios
-// commit 47593b2bc1dba9bf46545b1da24577f937966e12
+// commit 125dca530923a44a8f44f68f5e1970cbdd4e7faf
-// File generated at :: Thu Mar 21 2013 15:44:06 GMT-0700 (PDT)
+// File generated at :: Thu Apr 04 2013 10:21:55 GMT-0700 (PDT)
/*
Licensed to the Apache Software Foundation (ASF) under one
@@ -6400,27 +6400,32 @@
}
// Try to XHR the cordova_plugins.json file asynchronously.
- var xhr = new context.XMLHttpRequest();
- xhr.onreadystatechange = function() {
- if (this.readyState != 4) { // not DONE
- return;
- }
+ try { // we commented we were going to try, so let us actually try and catch
+ var xhr = new context.XMLHttpRequest();
+ xhr.onreadystatechange = function() {
+ if (this.readyState != 4) { // not DONE
+ return;
+ }
- // If the response is a JSON string which composes an array, call handlePluginsObject.
- // If the request fails, or the response is not a JSON array, just call finishPluginLoading.
- if (this.status == 200) {
- var obj = JSON.parse(this.responseText);
- if (obj && obj instanceof Array && obj.length > 0) {
- handlePluginsObject(obj);
+ // If the response is a JSON string which composes an array, call handlePluginsObject.
+ // If the request fails, or the response is not a JSON array, just call finishPluginLoading.
+ if (this.status == 200) {
+ var obj = JSON.parse(this.responseText);
+ if (obj && obj instanceof Array && obj.length > 0) {
+ handlePluginsObject(obj);
+ } else {
+ finishPluginLoading();
+ }
} else {
finishPluginLoading();
}
- } else {
- finishPluginLoading();
- }
- };
- xhr.open('GET', 'cordova_plugins.json', true); // Async
- xhr.send();
+ };
+ xhr.open('GET', 'cordova_plugins.json', true); // Async
+ xhr.send();
+ }
+ catch(err) {
+ finishPluginLoading();
+ }
}(window));
diff --git a/lib/cordova-ios/RELEASENOTES.md b/lib/cordova-ios/RELEASENOTES.md
index e83c647..aa501b0 100644
--- a/lib/cordova-ios/RELEASENOTES.md
+++ b/lib/cordova-ios/RELEASENOTES.md
@@ -24,6 +24,10 @@
### 2.6.0 (20130401) ###
+* [CB-2732] Only set camera device when allowed.
+* [CB-2848] ShowSplashScreenSpinner not used
+* [CB-2790] added splice function to header writer: accepts jpeg as NSData,
+* [CB-2790] removed old splice code, replaced with JpegHeaderWriter api call
* [CB-1547] Scope notifications to WebViews
* [CB-2461] Distinguish sub-frame from top-level loads in InAppBrowser.
* [CB-2523] Add setting to shrink webview when keyboard pops up
diff --git a/lib/cordova-ios/bin/README.md b/lib/cordova-ios/bin/README.md
deleted file mode 100644
index d5ffc63..0000000
--- a/lib/cordova-ios/bin/README.md
+++ /dev/null
@@ -1,29 +0,0 @@
-<!--
-#
-# 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.
-#
--->
-
-Updating the template project
------------------------------
-
-1. Generate the tagged JavaScript file from the **cordova-js** repo
-2. Delete the **cordova-X.X.X.js** file in **templates/project/www**
-3. Copy the file from (1) into **templates/project/www**
-4. Rename the file in (3) to **cordova-X.X.X.js** where X.X.X is the current Cordova version
-5. Update the **<script>** tag reference for the **templates/project/www/index.html** file to point to (4)