summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config.xml6
-rw-r--r--package.json9
-rw-r--r--www/js/app.js37
3 files changed, 51 insertions, 1 deletions
diff --git a/config.xml b/config.xml
index a8f2ef3a..4e71f473 100644
--- a/config.xml
+++ b/config.xml
@@ -93,4 +93,10 @@
<plugin name="cordova-plugin-photo-library" spec="~1.2.0">
<variable name="PHOTO_LIBRARY_USAGE_DESCRIPTION" value="images to gallery" />
</plugin>
+ <plugin name="cordova-plugin-customurlscheme" spec="~4.2.0">
+ <variable name="URL_SCHEME" value="zmninja" />
+ <variable name="ANDROID_SCHEME" value=" " />
+ <variable name="ANDROID_HOST" value=" " />
+ <variable name="ANDROID_PATHPREFIX" value="/" />
+ </plugin>
</widget>
diff --git a/package.json b/package.json
index 7896aebc..f6f0113e 100644
--- a/package.json
+++ b/package.json
@@ -90,16 +90,23 @@
"locator": "https://github.com/pliablepixels/cordova-plugin-media",
"id": "cordova-plugin-media"
},
- "cordova-plugin-photo-library",
"cordova-plugin-add-swift-support",
"cordova-plugin-file-transfer",
{
"locator": "https://github.com/FlyingDonkeyDev/cordova-library-helper",
"id": "cordova-library-helper"
},
+ "cordova-plugin-photo-library",
{
"locator": "https://github.com/hypery2k/cordova-certificate-plugin",
"id": "cordova-plugin-certificates"
+ },
+ {
+ "id": "cordova-plugin-customurlscheme",
+ "locator": "cordova-plugin-customurlscheme",
+ "variables": {
+ "URL_SCHEME": "zmninja"
+ }
}
],
"cordovaPlatforms": [
diff --git a/www/js/app.js b/www/js/app.js
index d07d0e5d..7027ff42 100644
--- a/www/js/app.js
+++ b/www/js/app.js
@@ -1355,6 +1355,19 @@ angular.module('zmApp', [
});
+ // credit http://stackoverflow.com/a/2091331/1361529
+ function getQueryVariable(query, variable) {
+ var vars = query.split('&');
+ for (var i = 0; i < vars.length; i++) {
+ var pair = vars[i].split('=');
+ if (decodeURIComponent(pair[0]) == variable) {
+ return decodeURIComponent(pair[1]);
+ }
+ }
+ return "";
+ //console.log('Query variable %s not found', variable);
+ }
+
//---------------------------------------------------------------------
// called when device is ready
//---------------------------------------------------------------------
@@ -1368,6 +1381,27 @@ angular.module('zmApp', [
$ionicPlatform.ready(function()
{
+ // handles URL launches
+ // if you just launch zmninja:// then it will honor the settings in "tap screen" -> events or montage
+ // if you launch with zmninja://<mid> it will take you to live view for that mid
+ window.handleOpenURL = function(url) {
+ $rootScope.tappedNotification = 1;
+ $rootScope.tappedMid = 0;
+ var c= URI.parse(url);
+ //NVRDataModel.log ("***********launched with "+ JSON.stringify(c));
+ if (c.query)
+ {
+ var qm = getQueryVariable(c.query, "mid");
+ if (qm) $rootScope.tappedMid = parseInt(qm);
+ NVRDataModel.log ("external URL called with MID="+$rootScope.tappedMid);
+ //console.log (">>>>>>>>> EID="+getQueryVariable(c.query, "eid"));
+
+ }
+
+
+
+ };
+
$rootScope.textScaleFactor = 1.0;
$rootScope.db = null;
@@ -1784,6 +1818,9 @@ angular.module('zmApp', [
}
+ // URL interceptor
+
+
}); //platformReady
}) //run