summaryrefslogtreecommitdiff
path: root/www/js/app.js
diff options
context:
space:
mode:
authorPliable Pixels <pliablepixels@gmail.com>2016-12-12 11:08:02 -0500
committerPliable Pixels <pliablepixels@gmail.com>2016-12-12 11:08:02 -0500
commit20bc85a94d0d3b317411bd68e038c378b2592f00 (patch)
tree0428c03c9989a9f62c078dcc790d6a8a9992292f /www/js/app.js
parent222673f7069cd90bef56e9205b9905301c1ac95b (diff)
inital code - custom url scheme for #411. zmninja:// launches the app. zmninja://<mid> takes us to live view for mid. needs more testing.
Diffstat (limited to 'www/js/app.js')
-rw-r--r--www/js/app.js37
1 files changed, 37 insertions, 0 deletions
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