mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-20 23:56:20 +08:00
Working. Pushing the callback server change again.
This commit is contained in:
parent
e77f9bb8fc
commit
b99e9abb5f
@ -199,7 +199,7 @@ public class CordovaChromeClient extends WebChromeClient {
|
||||
|
||||
// Polling for JavaScript messages
|
||||
else if (reqOk && defaultValue != null && defaultValue.equals("gap_poll:")) {
|
||||
String r = ctx.callbackServer.getJavascript();
|
||||
String r = appView.callbackServer.getJavascript();
|
||||
result.confirm(r);
|
||||
}
|
||||
|
||||
@ -207,16 +207,16 @@ public class CordovaChromeClient extends WebChromeClient {
|
||||
else if (reqOk && defaultValue != null && defaultValue.equals("gap_callbackServer:")) {
|
||||
String r = "";
|
||||
if (message.equals("usePolling")) {
|
||||
r = ""+ ctx.callbackServer.usePolling();
|
||||
r = ""+ appView.callbackServer.usePolling();
|
||||
}
|
||||
else if (message.equals("restartServer")) {
|
||||
ctx.callbackServer.restartServer();
|
||||
appView.callbackServer.restartServer();
|
||||
}
|
||||
else if (message.equals("getPort")) {
|
||||
r = Integer.toString(ctx.callbackServer.getPort());
|
||||
r = Integer.toString(appView.callbackServer.getPort());
|
||||
}
|
||||
else if (message.equals("getToken")) {
|
||||
r = ctx.callbackServer.getToken();
|
||||
r = appView.callbackServer.getToken();
|
||||
}
|
||||
result.confirm(r);
|
||||
}
|
||||
|
@ -30,6 +30,8 @@ public class CordovaWebView extends WebView {
|
||||
private ArrayList<Pattern> whiteList = new ArrayList<Pattern>();
|
||||
private HashMap<String, Boolean> whiteListCache = new HashMap<String,Boolean>();
|
||||
protected PluginManager pluginManager;
|
||||
public CallbackServer callbackServer;
|
||||
|
||||
|
||||
/** Actvities and other important classes **/
|
||||
private Context mCtx;
|
||||
|
@ -253,8 +253,8 @@ public class CordovaWebViewClient extends WebViewClient {
|
||||
|
||||
// Shutdown if blank loaded
|
||||
if (url.equals("about:blank")) {
|
||||
if (this.ctx.callbackServer != null) {
|
||||
this.ctx.callbackServer.destroy();
|
||||
if (appView.callbackServer != null) {
|
||||
appView.callbackServer.destroy();
|
||||
}
|
||||
this.ctx.endActivity();
|
||||
}
|
||||
|
@ -155,7 +155,6 @@ public class DroidGap extends Activity implements CordovaInterface {
|
||||
|
||||
protected LinearLayout root;
|
||||
public boolean bound = false;
|
||||
public CallbackServer callbackServer;
|
||||
protected boolean cancelLoadUrl = false;
|
||||
protected ProgressDialog spinnerDialog = null;
|
||||
|
||||
@ -379,12 +378,12 @@ public class DroidGap extends Activity implements CordovaInterface {
|
||||
me.appView.clearHistory();
|
||||
|
||||
// Create callback server and plugin manager
|
||||
if (me.callbackServer == null) {
|
||||
me.callbackServer = new CallbackServer();
|
||||
me.callbackServer.init(url);
|
||||
if (appView.callbackServer == null) {
|
||||
appView.callbackServer = new CallbackServer();
|
||||
appView.callbackServer.init(url);
|
||||
}
|
||||
else {
|
||||
me.callbackServer.reinit(url);
|
||||
appView.callbackServer.reinit(url);
|
||||
}
|
||||
appView.pluginManager.init();
|
||||
|
||||
@ -832,8 +831,8 @@ public class DroidGap extends Activity implements CordovaInterface {
|
||||
*/
|
||||
public void sendJavascript(String statement) {
|
||||
//We need to check for the null case on the Kindle Fire beacuse it changes the width and height on load
|
||||
if(this.callbackServer != null)
|
||||
this.callbackServer.sendJavascript(statement);
|
||||
if(this.appView.callbackServer != null)
|
||||
appView.callbackServer.sendJavascript(statement);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user