You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by bo...@apache.org on 2013/06/12 18:18:35 UTC
[1/3] android commit: Re-adding the Plugin.java shim for now. This
will remain a 2.x-only feature
Updated Branches:
refs/heads/2.8.x b2b1ae2b3 -> d8c755b95
Updated Tags: refs/tags/2.8.1 [created] d8c755b95
Re-adding the Plugin.java shim for now. This will remain a 2.x-only feature
Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/bc04ce4c
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/bc04ce4c
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/bc04ce4c
Branch: refs/heads/2.8.x
Commit: bc04ce4ce3396f9bc6d285469e70212b28971fb0
Parents: b2b1ae2
Author: Joe Bowser <bo...@apache.org>
Authored: Tue Jun 11 10:38:42 2013 -0700
Committer: Joe Bowser <bo...@apache.org>
Committed: Tue Jun 11 11:16:32 2013 -0700
----------------------------------------------------------------------
.../src/org/apache/cordova/api/Plugin.java | 177 +++++++++++++++++++
1 file changed, 177 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/bc04ce4c/framework/src/org/apache/cordova/api/Plugin.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/api/Plugin.java b/framework/src/org/apache/cordova/api/Plugin.java
new file mode 100755
index 0000000..72171f2
--- /dev/null
+++ b/framework/src/org/apache/cordova/api/Plugin.java
@@ -0,0 +1,177 @@
+/*
+ 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.
+*/
+package org.apache.cordova.api;
+
+import org.apache.cordova.CordovaWebView;
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+/**
+ * Legacy Plugin class. This acts as a shim to support the old execute() signature.
+ * New plugins should extend CordovaPlugin directly.
+ */
+@Deprecated
+public abstract class Plugin extends CordovaPlugin {
+ public LegacyContext ctx; // LegacyContext object
+
+ public abstract PluginResult execute(String action, JSONArray args, String callbackId);
+
+ public boolean isSynch(String action) {
+ return false;
+ }
+
+ @Override
+ public void initialize(CordovaInterface cordova, CordovaWebView webView) {
+ super.initialize(cordova, webView);
+ this.setContext(cordova);
+ this.setView(webView);
+ }
+
+ /**
+ * Sets the context of the Plugin. This can then be used to do things like
+ * get file paths associated with the Activity.
+ *
+ * @param ctx The context of the main Activity.
+ */
+ public void setContext(CordovaInterface ctx) {
+ this.cordova = ctx;
+ this.ctx = new LegacyContext(cordova);
+ }
+
+ /**
+ * Sets the main View of the application, this is the WebView within which
+ * a Cordova app runs.
+ *
+ * @param webView The Cordova WebView
+ */
+ public void setView(CordovaWebView webView) {
+ this.webView = webView;
+ }
+
+ @Override
+ public boolean execute(final String action, final JSONArray args, final CallbackContext callbackContext) throws JSONException {
+ final String callbackId = callbackContext.getCallbackId();
+ boolean runAsync = !isSynch(action);
+ if (runAsync) {
+ // Run this on a different thread so that this one can return back to JS
+ cordova.getThreadPool().execute(new Runnable() {
+ public void run() {
+ PluginResult cr;
+ try {
+ cr = execute(action, args, callbackId);
+ } catch (Throwable e) {
+ cr = new PluginResult(PluginResult.Status.ERROR, e.getMessage());
+ }
+ sendPluginResult(cr, callbackId);
+ }
+ });
+ } else {
+ PluginResult cr = execute(action, args, callbackId);
+
+ // Interpret a null response as NO_RESULT, which *does* clear the callbacks on the JS side.
+ if (cr == null) {
+ cr = new PluginResult(PluginResult.Status.NO_RESULT);
+ }
+
+ callbackContext.sendPluginResult(cr);
+ }
+ return true;
+ }
+
+ /**
+ * Send generic JavaScript statement back to JavaScript.
+ * sendPluginResult() should be used instead where possible.
+ */
+ public void sendJavascript(String statement) {
+ this.webView.sendJavascript(statement);
+ }
+
+ /**
+ * Send generic JavaScript statement back to JavaScript.
+ */
+ public void sendPluginResult(PluginResult pluginResult, String callbackId) {
+ this.webView.sendPluginResult(pluginResult, callbackId);
+ }
+
+ /**
+ * Call the JavaScript success callback for this plugin.
+ *
+ * This can be used if the execute code for the plugin is asynchronous meaning
+ * that execute should return null and the callback from the async operation can
+ * call success(...) or error(...)
+ *
+ * @param pluginResult The result to return.
+ * @param callbackId The callback id used when calling back into JavaScript.
+ */
+ public void success(PluginResult pluginResult, String callbackId) {
+ this.webView.sendPluginResult(pluginResult, callbackId);
+ }
+
+ /**
+ * Helper for success callbacks that just returns the Status.OK by default
+ *
+ * @param message The message to add to the success result.
+ * @param callbackId The callback id used when calling back into JavaScript.
+ */
+ public void success(JSONObject message, String callbackId) {
+ this.webView.sendPluginResult(new PluginResult(PluginResult.Status.OK, message), callbackId);
+ }
+
+ /**
+ * Helper for success callbacks that just returns the Status.OK by default
+ *
+ * @param message The message to add to the success result.
+ * @param callbackId The callback id used when calling back into JavaScript.
+ */
+ public void success(String message, String callbackId) {
+ this.webView.sendPluginResult(new PluginResult(PluginResult.Status.OK, message), callbackId);
+ }
+
+ /**
+ * Call the JavaScript error callback for this plugin.
+ *
+ * @param pluginResult The result to return.
+ * @param callbackId The callback id used when calling back into JavaScript.
+ */
+ public void error(PluginResult pluginResult, String callbackId) {
+ this.webView.sendPluginResult(pluginResult, callbackId);
+ }
+
+ /**
+ * Helper for error callbacks that just returns the Status.ERROR by default
+ *
+ * @param message The message to add to the error result.
+ * @param callbackId The callback id used when calling back into JavaScript.
+ */
+ public void error(JSONObject message, String callbackId) {
+ this.webView.sendPluginResult(new PluginResult(PluginResult.Status.ERROR, message), callbackId);
+ }
+
+ /**
+ * Helper for error callbacks that just returns the Status.ERROR by default
+ *
+ * @param message The message to add to the error result.
+ * @param callbackId The callback id used when calling back into JavaScript.
+ */
+ public void error(String message, String callbackId) {
+ this.webView.sendPluginResult(new PluginResult(PluginResult.Status.ERROR, message), callbackId);
+ }
+
+}
[2/3] android commit: Forgot to update this so that it doesn't
destroy someone's project, FAIL
Posted by bo...@apache.org.
Forgot to update this so that it doesn't destroy someone's project, FAIL
Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/187c6a6b
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/187c6a6b
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/187c6a6b
Branch: refs/heads/2.8.x
Commit: 187c6a6bd19e9da357362c183894c6f8fba78c70
Parents: bc04ce4
Author: Joe Bowser <bo...@apache.org>
Authored: Tue Jun 4 14:28:16 2013 -0700
Committer: Joe Bowser <bo...@apache.org>
Committed: Tue Jun 11 11:19:08 2013 -0700
----------------------------------------------------------------------
bin/update | 2 --
1 file changed, 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/187c6a6b/bin/update
----------------------------------------------------------------------
diff --git a/bin/update b/bin/update
index 9a968b1..20440d4 100755
--- a/bin/update
+++ b/bin/update
@@ -64,8 +64,6 @@ function createAppInfoJar {
function on_error {
echo "An unexpected error occurred: $previous_command exited with $?"
- echo "Deleting project..."
- [ -d "$PROJECT_PATH" ] && rm -rf "$PROJECT_PATH"
exit 1
}
[3/3] android commit: Updating for 2.8.1
Posted by bo...@apache.org.
Updating for 2.8.1
Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/d8c755b9
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/d8c755b9
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/d8c755b9
Branch: refs/heads/2.8.x
Commit: d8c755b95a85de95c51768a271aa2747bb5467b9
Parents: 187c6a6
Author: Joe Bowser <bo...@apache.org>
Authored: Tue Jun 11 11:26:13 2013 -0700
Committer: Joe Bowser <bo...@apache.org>
Committed: Tue Jun 11 11:26:13 2013 -0700
----------------------------------------------------------------------
VERSION | 2 +-
framework/src/org/apache/cordova/Device.java | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/d8c755b9/VERSION
----------------------------------------------------------------------
diff --git a/VERSION b/VERSION
index 834f262..dbe5900 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.8.0
+2.8.1
http://git-wip-us.apache.org/repos/asf/cordova-android/blob/d8c755b9/framework/src/org/apache/cordova/Device.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/Device.java b/framework/src/org/apache/cordova/Device.java
index ff7d118..1ed1854 100644
--- a/framework/src/org/apache/cordova/Device.java
+++ b/framework/src/org/apache/cordova/Device.java
@@ -38,7 +38,7 @@ import android.telephony.TelephonyManager;
public class Device extends CordovaPlugin {
public static final String TAG = "Device";
- public static String cordovaVersion = "2.8.0rc1"; // Cordova version
+ public static String cordovaVersion = "2.8.1"; // Cordova version
public static String platform = "Android"; // Device OS
public static String uuid; // Device UUID