Compare commits

...

15 Commits

Author SHA1 Message Date
Steve Gill
a67bddbd82 Set VERSION to 4.0.2 (via coho) 2015-05-20 13:12:33 -07:00
Steve Gill
81eb8ff1f9 Update JS snapshot to version 4.0.2 (via coho) 2015-05-20 13:12:33 -07:00
Joe Bowser
8de13d9af5 Automated tools fail, and you have to remember all four places where this is set. 2015-05-20 08:54:28 -07:00
Joe Bowser
83118456cc Update the package.json 2015-05-19 10:55:29 -07:00
Joe Bowser
8eaa71d9b7 CB-9042 coho failed to update version, so here we are 2015-05-19 08:24:47 -07:00
Joe Bowser
554b599912 CB9042 - Updating Release Notes 2015-05-19 08:13:08 -07:00
Joe Bowser
82528f3973 Adding tests to confirm that preferences aren't changed by Intents 2015-05-15 14:13:41 -07:00
Joe Bowser
4ca80030ce updating existing test code 2015-05-15 14:13:41 -07:00
Joe Bowser
a102d1d23a Forgot to remove the method that copied over the intent data 2015-05-15 14:13:41 -07:00
Joe Bowser
6e495259b2 Getting around to removing this old Intent code 2015-05-15 14:13:41 -07:00
Steve Gill
6b7eaf2386 Set VERSION to 4.0.1 (via coho) 2015-05-08 15:33:04 -07:00
Steve Gill
1d7c033e52 Update JS snapshot to version 4.0.1 (via coho) 2015-05-08 15:33:03 -07:00
Andrew Grieve
f224b1f2d4 CB-8834 Don't fail to install on VERSION_DOWNGRADE 2015-04-09 11:29:18 -04:00
Andrew Grieve
4ac6916dd0 Set VERSION to 4.0.0 (via coho) 2015-04-09 11:05:47 -04:00
Andrew Grieve
a31107e389 Update JS snapshot to version 4.0.0 (via coho) 2015-04-09 11:05:47 -04:00
15 changed files with 103 additions and 130 deletions

View File

@ -20,6 +20,14 @@
--> -->
## Release Notes for Cordova (Android) ## ## Release Notes for Cordova (Android) ##
### Release 4.0.2 (May 2015) ###
* Removed Intent Functionality from Preferences - Preferences can no longer be set by intents
### Release 4.0.1 (April 2015) ###
* Bug fixed where platform failed to install on a version downgrade
### Release 4.0.0 (March 2015) ### ### Release 4.0.0 (March 2015) ###
This release adds significant functionality, and also introduces a number This release adds significant functionality, and also introduces a number

View File

@ -1 +1 @@
4.0.0-dev 4.0.2

View File

@ -98,7 +98,7 @@ module.exports.install = function(target, buildResults) {
var launchName = appinfo.getActivityName(); var launchName = appinfo.getActivityName();
console.log('Using apk: ' + apk_path); console.log('Using apk: ' + apk_path);
console.log('Installing app on device...'); console.log('Installing app on device...');
var cmd = 'adb -s ' + resolvedTarget.target + ' install -r "' + apk_path + '"'; var cmd = 'adb -s ' + resolvedTarget.target + ' install -r -d "' + apk_path + '"';
return exec(cmd, os.tmpdir()) return exec(cmd, os.tmpdir())
.then(function(output) { .then(function(output) {
if (output.match(/Failure/)) return Q.reject('ERROR: Failed to install apk to device: ' + output); if (output.match(/Failure/)) return Q.reject('ERROR: Failed to install apk to device: ' + output);

View File

@ -308,7 +308,7 @@ module.exports.install = function(target, buildResults) {
var apk_path = build.findBestApkForArchitecture(buildResults, resolvedTarget.arch); var apk_path = build.findBestApkForArchitecture(buildResults, resolvedTarget.arch);
console.log('Installing app on emulator...'); console.log('Installing app on emulator...');
console.log('Using apk: ' + apk_path); console.log('Using apk: ' + apk_path);
return exec('adb -s ' + resolvedTarget.target + ' install -r "' + apk_path + '"', os.tmpdir()) return exec('adb -s ' + resolvedTarget.target + ' install -r -d "' + apk_path + '"', os.tmpdir())
.then(function(output) { .then(function(output) {
if (output.match(/Failure/)) { if (output.match(/Failure/)) {
return Q.reject('Failed to install apk to emulator: ' + output); return Q.reject('Failed to install apk to emulator: ' + output);

View File

@ -20,6 +20,6 @@
*/ */
// Coho updates this line: // Coho updates this line:
var VERSION = "4.0.0-dev"; var VERSION = "4.0.2";
console.log(VERSION); console.log(VERSION);

View File

@ -1,5 +1,5 @@
// Platform: android // Platform: android
// fc4db9145934bd0053161cbf9ffc0caf83b770c6 // 23738581906992092a43ad2e643b1e0c43bba38a
/* /*
Licensed to the Apache Software Foundation (ASF) under one Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file or more contributor license agreements. See the NOTICE file
@ -19,7 +19,7 @@
under the License. under the License.
*/ */
;(function() { ;(function() {
var PLATFORM_VERSION_BUILD_LABEL = '4.0.0-dev'; var PLATFORM_VERSION_BUILD_LABEL = '4.0.2';
// file: src/scripts/require.js // file: src/scripts/require.js
/*jshint -W079 */ /*jshint -W079 */
@ -101,10 +101,15 @@ if (typeof module === "object" && typeof require === "function") {
// file: src/cordova.js // file: src/cordova.js
define("cordova", function(require, exports, module) { define("cordova", function(require, exports, module) {
if(window.cordova){
throw new Error("cordova already defined");
}
var channel = require('cordova/channel'); var channel = require('cordova/channel');
var platform = require('cordova/platform'); var platform = require('cordova/platform');
/** /**
* Intercept calls to addEventListener + removeEventListener and handle deviceready, * Intercept calls to addEventListener + removeEventListener and handle deviceready,
* resume, and pause events. * resume, and pause events.
@ -323,7 +328,7 @@ module.exports = cordova;
}); });
// file: src/android/android/nativeapiprovider.js // file: node_modules/cordova-android/cordova-js-src/android/nativeapiprovider.js
define("cordova/android/nativeapiprovider", function(require, exports, module) { define("cordova/android/nativeapiprovider", function(require, exports, module) {
/** /**
@ -346,7 +351,7 @@ module.exports = {
}); });
// file: src/android/android/promptbasednativeapi.js // file: node_modules/cordova-android/cordova-js-src/android/promptbasednativeapi.js
define("cordova/android/promptbasednativeapi", function(require, exports, module) { define("cordova/android/promptbasednativeapi", function(require, exports, module) {
/** /**
@ -856,7 +861,7 @@ module.exports = channel;
}); });
// file: src/android/exec.js // file: node_modules/cordova-android/cordova-js-src/exec.js
define("cordova/exec", function(require, exports, module) { define("cordova/exec", function(require, exports, module) {
/** /**
@ -1499,7 +1504,7 @@ exports.reset();
}); });
// file: src/android/platform.js // file: node_modules/cordova-android/cordova-js-src/platform.js
define("cordova/platform", function(require, exports, module) { define("cordova/platform", function(require, exports, module) {
module.exports = { module.exports = {
@ -1575,7 +1580,7 @@ function onMessageFromNative(msg) {
}); });
// file: src/android/plugin/android/app.js // file: node_modules/cordova-android/cordova-js-src/plugin/android/app.js
define("cordova/plugin/android/app", function(require, exports, module) { define("cordova/plugin/android/app", function(require, exports, module) {
var exec = require('cordova/exec'); var exec = require('cordova/exec');

View File

@ -36,8 +36,8 @@ public class Config {
public static void init(Activity action) { public static void init(Activity action) {
parser = new ConfigXmlParser(); parser = new ConfigXmlParser();
parser.parse(action); parser.parse(action);
//TODO: Add feature to bring this back. Some preferences should be overridden by intents, but not all
parser.getPreferences().setPreferencesBundle(action.getIntent().getExtras()); parser.getPreferences().setPreferencesBundle(action.getIntent().getExtras());
parser.getPreferences().copyIntoIntentExtras(action);
} }
// Intended to be used for testing only; creates an empty configuration. // Intended to be used for testing only; creates an empty configuration.

View File

@ -152,7 +152,6 @@ public class CordovaActivity extends Activity {
parser.parse(this); parser.parse(this);
preferences = parser.getPreferences(); preferences = parser.getPreferences();
preferences.setPreferencesBundle(getIntent().getExtras()); preferences.setPreferencesBundle(getIntent().getExtras());
preferences.copyIntoIntentExtras(this);
launchUrl = parser.getLaunchUrl(); launchUrl = parser.getLaunchUrl();
pluginEntries = parser.getPluginEntries(); pluginEntries = parser.getPluginEntries();
Config.parser = parser; Config.parser = parser;

View File

@ -61,13 +61,6 @@ public class CordovaPreferences {
String value = prefs.get(name); String value = prefs.get(name);
if (value != null) { if (value != null) {
return Boolean.parseBoolean(value); return Boolean.parseBoolean(value);
} else if (preferencesBundleExtras != null) {
Object bundleValue = preferencesBundleExtras.get(name);
if (bundleValue instanceof String) {
return "true".equals(bundleValue);
}
// Gives a nice warning if type is wrong.
return preferencesBundleExtras.getBoolean(name, defaultValue);
} }
return defaultValue; return defaultValue;
} }
@ -83,13 +76,6 @@ public class CordovaPreferences {
if (value != null) { if (value != null) {
// Use Integer.decode() can't handle it if the highest bit is set. // Use Integer.decode() can't handle it if the highest bit is set.
return (int)(long)Long.decode(value); return (int)(long)Long.decode(value);
} else if (preferencesBundleExtras != null) {
Object bundleValue = preferencesBundleExtras.get(name);
if (bundleValue instanceof String) {
return Integer.valueOf((String)bundleValue);
}
// Gives a nice warning if type is wrong.
return preferencesBundleExtras.getInt(name, defaultValue);
} }
return defaultValue; return defaultValue;
} }
@ -99,13 +85,6 @@ public class CordovaPreferences {
String value = prefs.get(name); String value = prefs.get(name);
if (value != null) { if (value != null) {
return Double.valueOf(value); return Double.valueOf(value);
} else if (preferencesBundleExtras != null) {
Object bundleValue = preferencesBundleExtras.get(name);
if (bundleValue instanceof String) {
return Double.valueOf((String)bundleValue);
}
// Gives a nice warning if type is wrong.
return preferencesBundleExtras.getDouble(name, defaultValue);
} }
return defaultValue; return defaultValue;
} }
@ -115,69 +94,8 @@ public class CordovaPreferences {
String value = prefs.get(name); String value = prefs.get(name);
if (value != null) { if (value != null) {
return value; return value;
} else if (preferencesBundleExtras != null && !"errorurl".equals(name)) {
Object bundleValue = preferencesBundleExtras.get(name);
if (bundleValue != null) {
return bundleValue.toString();
}
} }
return defaultValue; return defaultValue;
} }
// Plugins should not rely on values within the intent since this does not work
// for apps with multiple webviews. Instead, they should retrieve prefs from the
// Config object associated with their webview.
public void copyIntoIntentExtras(Activity action) {
for (String name : prefs.keySet()) {
String value = prefs.get(name);
if (value == null) {
continue;
}
if (name.equals("loglevel")) {
LOG.setLogLevel(value);
} else if (name.equals("splashscreen")) {
// Note: We should probably pass in the classname for the variable splash on splashscreen!
int resource = action.getResources().getIdentifier(value, "drawable", action.getClass().getPackage().getName());
if(resource == 0) {
resource = action.getResources().getIdentifier(value, "drawable", action.getPackageName());
}
action.getIntent().putExtra(name, resource);
}
else if(name.equals("backgroundcolor")) {
int asInt = (int)(long)Long.decode(value);
action.getIntent().putExtra(name, asInt);
}
else if(name.equals("loadurltimeoutvalue")) {
int asInt = Integer.decode(value);
action.getIntent().putExtra(name, asInt);
}
else if(name.equals("splashscreendelay")) {
int asInt = Integer.decode(value);
action.getIntent().putExtra(name, asInt);
}
else if(name.equals("keeprunning"))
{
boolean asBool = Boolean.parseBoolean(value);
action.getIntent().putExtra(name, asBool);
}
else if(name.equals("inappbrowserstorageenabled"))
{
boolean asBool = Boolean.parseBoolean(value);
action.getIntent().putExtra(name, asBool);
}
else if(name.equals("disallowoverscroll"))
{
boolean asBool = Boolean.parseBoolean(value);
action.getIntent().putExtra(name, asBool);
}
else
{
action.getIntent().putExtra(name, value);
}
}
// In the normal case, the intent extras are null until the first call to putExtra().
if (preferencesBundleExtras == null) {
preferencesBundleExtras = action.getIntent().getExtras();
}
}
} }

View File

@ -31,7 +31,7 @@ import android.webkit.WebChromeClient.CustomViewCallback;
* are not expected to implement it. * are not expected to implement it.
*/ */
public interface CordovaWebView { public interface CordovaWebView {
public static final String CORDOVA_VERSION = "4.0.0-dev"; public static final String CORDOVA_VERSION = "4.0.2";
void init(CordovaInterface cordova, List<PluginEntry> pluginEntries, CordovaPreferences preferences); void init(CordovaInterface cordova, List<PluginEntry> pluginEntries, CordovaPreferences preferences);

View File

@ -1,6 +1,6 @@
{ {
"name": "cordova-android", "name": "cordova-android",
"version": "4.0.0-dev", "version": "4.0.2",
"description": "cordova-android release", "description": "cordova-android release",
"main": "bin/create", "main": "bin/create",
"repository": { "repository": {

View File

@ -24,7 +24,7 @@ package org.apache.cordova.test;
public class ErrorUrlTest extends BaseCordovaIntegrationTest { public class ErrorUrlTest extends BaseCordovaIntegrationTest {
private static final String START_URL = "file:///android_asset/www/htmlnotfound/index.html"; private static final String START_URL = "file:///android_asset/www/htmlnotfound/index.html";
private static final String ERROR_URL = "file:///android_asset/www/htmlnotfound/error.html"; private static final String ERROR_URL = "file:///android_asset/www/htmlnotfound/error.html";
private static final String INVALID_URL = "file:///android_asset/www/index.html"; private static final String INVALID_URL = "file:///android_asset/www/invalid.html";
protected void setUp() throws Exception { protected void setUp() throws Exception {
super.setUp(); super.setUp();

View File

@ -31,10 +31,9 @@ public class HtmlNotFoundTest extends BaseCordovaIntegrationTest {
public void testUrl() throws Throwable public void testUrl() throws Throwable
{ {
assertEquals(START_URL, testActivity.onPageFinishedUrl.take()); assertEquals(START_URL, testActivity.onPageFinishedUrl.take());
// TODO: Should this be null? Or some other way to indicate it didn't actually load?
runTestOnUiThread(new Runnable() { runTestOnUiThread(new Runnable() {
public void run() { public void run() {
assertEquals(START_URL, testActivity.getCordovaWebView().getUrl()); assertFalse(START_URL.equals(testActivity.getCordovaWebView().getUrl()));
} }
}); });
} }

View File

@ -0,0 +1,44 @@
package org.apache.cordova.test;
/*
*
* 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 android.graphics.Color;
import org.apache.cordova.CordovaPreferences;
public class IntentPreferenceTest extends BaseCordovaIntegrationTest {
private static final String GREEN = Integer.toHexString(Color.GREEN);
private static final String START_URL = "file:///android_asset/www/index.html";
CordovaPreferences prefs;
protected void setUp() throws Exception {
super.setUp();
// INVALID_URL tests that errorUrl and url are *not* settable via the intent.
setUpWithStartUrl(START_URL, "backgroundcolor", GREEN);
prefs = cordovaWebView.getPreferences();
}
public void testUrl() throws Throwable {
assertEquals(START_URL, testActivity.onPageFinishedUrl.take());
assertFalse(prefs.getInteger("backgroundcolor", Color.BLACK) == Color.GREEN);
}
}

View File

@ -36,7 +36,7 @@ public class MainTestActivity extends BaseTestCordovaActivity {
@Override protected void loadConfig() { @Override protected void loadConfig() {
super.loadConfig(); super.loadConfig();
// Need to set this explicitly in prefs since it's not settable via bundle extras (for security reasons). // Need to set this explicitly in prefs since it's not settable via bundle extras.
String errorUrl = getIntent().getStringExtra("testErrorUrl"); String errorUrl = getIntent().getStringExtra("testErrorUrl");
if (errorUrl != null) { if (errorUrl != null) {
preferences.set("errorUrl", errorUrl); preferences.set("errorUrl", errorUrl);