summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPliable Pixels <pliablepixels@gmail.com>2017-12-15 14:22:57 -0500
committerPliable Pixels <pliablepixels@gmail.com>2017-12-15 14:22:57 -0500
commitf4c6ca2e3d1bc5f986d4a6907d06d3ea20e8c701 (patch)
treebe3b51d8090a37c2a973de6d8176b6cae261e805
parent778d33929e90b9c454e3ee76e561bb40be66378c (diff)
#467 - initial support to launch external URLs to view specific event (and fixes for monitor)
-rw-r--r--www/js/EventCtrl.js34
-rw-r--r--www/js/PortalLoginCtrl.js47
-rwxr-xr-xwww/js/app.js10
3 files changed, 82 insertions, 9 deletions
diff --git a/www/js/EventCtrl.js b/www/js/EventCtrl.js
index e12d2f32..26d47d33 100644
--- a/www/js/EventCtrl.js
+++ b/www/js/EventCtrl.js
@@ -121,10 +121,34 @@ angular.module('zmApp.controllers')
getInitialEvents();
setupWatchers();
footerExpand();
+ // now do event playback if asked
+
+ if (parseInt($rootScope.tappedEid) > 0) {
+ NVRDataModel.debug (" Trying ot live play " + $rootScope.tappedEid);
+ playSpecificEvent($rootScope.tappedEid);
+
+ }
+
},100);
});
+
+ function playSpecificEvent (eid) {
+ NVRDataModel.log ("Stuffing EID to play back "+ eid);
+ $rootScope.tappedEid = 0;
+ var event = {
+ Event: {
+ Id:eid
+ }
+
+ };
+ $scope.event = event;
+ $scope.currentEvent = event;
+ openModal(event);
+
+ }
+
$scope.$on('$ionicView.beforeEnter', function()
{
@@ -140,6 +164,8 @@ angular.module('zmApp.controllers')
NVRDataModel.log("EventCtrl called with: EID=" + $scope.id + " playEvent = " + $scope.showEvent);
+
+
// This is the only view that hardcodes row size due to
// collection repeat, so lets re-get the text size if it has changed
// note that there may be a delay as its a callback - so might involve
@@ -2778,6 +2804,11 @@ angular.module('zmApp.controllers')
$scope.openModal = function(event)
{
+ openModal(event);
+
+ };
+
+ function openModal (event) {
NVRDataModel.debug("unbinding eventCtrl watchers as modal has its own");
ionRangeWatcher();
mycarouselWatcher();
@@ -2812,8 +2843,7 @@ angular.module('zmApp.controllers')
var ld = NVRDataModel.getLogin();
});
-
- };
+ }
//--------------------------------------------------------
//We need to destroy because we are instantiating
diff --git a/www/js/PortalLoginCtrl.js b/www/js/PortalLoginCtrl.js
index a71aa83e..4500ff9e 100644
--- a/www/js/PortalLoginCtrl.js
+++ b/www/js/PortalLoginCtrl.js
@@ -269,10 +269,51 @@ angular.module('zmApp.controllers').controller('zmApp.PortalLoginCtrl', ['$ionic
function evaluateTappedNotification()
{
- if ($rootScope.tappedNotification)
+ var ld = NVRDataModel.getLogin();
+
+
+ if ($rootScope.tappedNotification == 2) { // url launch
+ NVRDataModel.debug("Came via app url launch with mid="+$rootScope.tappedMid);
+ NVRDataModel.debug("Came via app url launch with eid="+$rootScope.tappedEid);
+ $rootScope.tappedNotification = 0;
+ $ionicHistory.nextViewOptions(
+ {
+ disableBack: true
+ });
+
+ if (parseInt($rootScope.tappedMid) > 0)
+ {
+ NVRDataModel.debug("Going to live view ");
+ $state.go("app.monitors",
+ {},
+ {
+ reload: true
+ });
+ return;
+
+ }
+
+ else if (parseInt($rootScope.tappedEid) > 0) {
+ NVRDataModel.debug("Going to events with EID=" + $rootScope.tappedEid);
+ $state.go("app.events",
+ {
+ //"id": $rootScope.tappedEid,
+ "id": 0,
+ "playEvent": true
+ },
+ {
+ reload: true
+ });
+ return;
+ }
+ // go with monitor first, then event - just because I feel like ;)
+
+
+ }
+ else if ($rootScope.tappedNotification == 1) // push
{
- var ld = NVRDataModel.getLogin();
+
NVRDataModel.log("Came via push tap. onTapScreen=" + ld.onTapScreen);
//console.log ("***** NOTIFICATION TAPPED ");
$rootScope.tappedNotification = 0;
@@ -389,7 +430,7 @@ angular.module('zmApp.controllers').controller('zmApp.PortalLoginCtrl', ['$ionic
NVRDataModel.getKeyConfigParams(1);
NVRDataModel.getTimeZone();
EventServer.refresh();
- if ($rootScope.tappedNotification != 1)
+ if ($rootScope.tappedNotification == 0)
{
console.log ("NOTIFICATION TAPPED INSIDE CHECK IS "+$rootScope.tappedNotification);
var statetoGo = $rootScope.lastState ? $rootScope.lastState : 'app.montage';
diff --git a/www/js/app.js b/www/js/app.js
index 892fc3d3..018d020a 100755
--- a/www/js/app.js
+++ b/www/js/app.js
@@ -1244,6 +1244,7 @@ angular.module('zmApp', [
$rootScope.apnsToken = '';
$rootScope.tappedNotification = 0;
$rootScope.tappedMid = 0;
+ $rootScope.tappedEid = 0;
//var eventsToDisplay=[];
$rootScope.alarmCount = "0";
@@ -1462,17 +1463,18 @@ angular.module('zmApp', [
// 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.tappedNotification = 2; // 1 is push
$rootScope.tappedMid = 0;
var c = URI.parse(url);
//NVRDataModel.log ("***********launched with "+ JSON.stringify(c));
if (c.query) {
var qm = getQueryVariable(c.query, "mid");
+ var qe = getQueryVariable(c.query, "eid");
+ if (qe) $rootScope.tappedEid = parseInt(qe);
if (qm) $rootScope.tappedMid = parseInt(qm);
- NVRDataModel.log("external URL called with MID=" + $rootScope.tappedMid);
+ NVRDataModel.log("external URL called with MID=" + $rootScope.tappedMid + " and/or EID="+$rootScope.tappedEid);
//console.log (">>>>>>>>> EID="+getQueryVariable(c.query, "eid"));
}