Skip to content

Commit

Permalink
Merge pull request #148 from Telerik-Verified-Plugins/master
Browse files Browse the repository at this point in the history
Telerik Platform LiveSync compatibility
  • Loading branch information
EddyVerbruggen committed Jan 24, 2016
2 parents dac7716 + dd6ce1e commit 274bd5d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cordova-plugin-customurlscheme",
"version": "4.1.2",
"version": "4.1.3",
"description": "Launch your app by using this URL: mycoolapp://, you can add a path and even pass params like this: mycoolerapp://somepath?foo=bar",
"cordova": {
"id": "cordova-plugin-customurlscheme",
Expand Down
4 changes: 2 additions & 2 deletions plugin.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
xmlns:android="http://schemas.android.com/apk/res/android"
id="cordova-plugin-customurlscheme"
version="4.1.2">
id="nl.x-services.plugins.launchmyapp"
version="4.1.3">

<name>Custom URL scheme</name>

Expand Down
13 changes: 10 additions & 3 deletions src/android/nl/xservices/plugins/LaunchMyApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,17 @@ public class LaunchMyApp extends CordovaPlugin {
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException {
if (ACTION_CLEARINTENT.equalsIgnoreCase(action)) {
final Intent intent = ((CordovaActivity) this.webView.getContext()).getIntent();
intent.setData(null);
// Telerik LiveSync needs the data object as well, see /pull/3 in the Telerik Verified Plugins fork
final String intentString = intent.getDataString();
if (intentString == null || !intentString.contains("platform.telerik.com")) {
intent.setData(null);
}
return true;
} else if (ACTION_CHECKINTENT.equalsIgnoreCase(action)) {
final Intent intent = ((CordovaActivity) this.webView.getContext()).getIntent();
final String intentString = intent.getDataString();
if (intentString != null && intent.getScheme() != null) {
lastIntentString = intentString;
lastIntentString = intentString;
callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, intent.getDataString()));
} else {
callbackContext.error("App was not started via the launchmyapp URL scheme. Ignoring this errorcallback is the best approach.");
Expand All @@ -54,7 +58,10 @@ public boolean execute(String action, JSONArray args, CallbackContext callbackCo
public void onNewIntent(Intent intent) {
final String intentString = intent.getDataString();
if (intentString != null && intent.getScheme() != null) {
intent.setData(null);
// Telerik LiveSync needs the data object as well, see /pull/3 in the Telerik Verified Plugins fork
if (!intentString.contains("platform.telerik.com")) {
intent.setData(null);
}
try {
StringWriter writer = new StringWriter(intentString.length() * 2);
escapeJavaStyleString(writer, intentString, true, false);
Expand Down

0 comments on commit 274bd5d

Please sign in to comment.