From 92aafb977cf34b061c03929cadc6a9d0e44a1555 Mon Sep 17 00:00:00 2001 From: Pliable Pixels Date: Sat, 9 May 2020 17:12:51 -0400 Subject: reset packery positions when changing groups --- config.xml | 3 +++ package.json | 4 ++++ www/js/MontageCtrl.js | 26 ++++++++++++++++++-------- 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/config.xml b/config.xml index 080e6502..852f3fc2 100644 --- a/config.xml +++ b/config.xml @@ -186,6 +186,9 @@ + + + diff --git a/package.json b/package.json index 42da4ad2..04a1ba1d 100644 --- a/package.json +++ b/package.json @@ -61,6 +61,9 @@ "cordova-plugin-inappbrowser": {}, "cordova-plugin-app-version": {}, "cordova-plugin-statusbar-pp-fork": {}, + "cordova-plugin-ionic-webview": { + "ANDROID_SUPPORT_ANNOTATIONS_VERSION": "27.+" + }, "cordova-plugin-media-pp-fork": {} } }, @@ -86,6 +89,7 @@ "cordova-plugin-inappbrowser": "git+https://github.com/apache/cordova-plugin-inappbrowser.git", "cordova-plugin-insomnia": "^4.3.0", "cordova-plugin-ionic-keyboard": "2.2.0", + "cordova-plugin-ionic-webview": "git+https://github.com/pliablepixels/cordova-plugin-ionic-webview.git", "cordova-plugin-media-pp-fork": "^1.0.2-dev", "cordova-plugin-multi-window": "0.0.3", "cordova-plugin-network-information": "^2.0.2", diff --git a/www/js/MontageCtrl.js b/www/js/MontageCtrl.js index 2f449896..15be6bba 100644 --- a/www/js/MontageCtrl.js +++ b/www/js/MontageCtrl.js @@ -974,7 +974,7 @@ angular.module('zmApp.controllers') $scope.tempZMGroups.push ({ 'name': $scope.zmGroups[i], 'selection': val - }) + }); } $scope.tempZMGroups.unshift({'name':$translate.instant('kAll'), 'selection':false}); @@ -1008,7 +1008,7 @@ angular.module('zmApp.controllers') } NVR.debug ("Group(s) selected:"+JSON.stringify(ld.currentZMGroupNames)); - var are_equal = ld.currentZMGroupNames.length === old_ZMGroupNames.length && ld.currentZMGroupNames.sort().every(function(value, index) { return value === old_ZMGroupNames.sort()[index]}); + var are_equal = ld.currentZMGroupNames.length === old_ZMGroupNames.length && ld.currentZMGroupNames.sort().every(function(value, index) { return value === old_ZMGroupNames.sort()[index];}); if (!are_equal) { @@ -1021,32 +1021,40 @@ angular.module('zmApp.controllers') if (simulStreaming) currentStreamState = streamState.STOPPED; - for (var i = 0; i < $scope.MontageMonitors.length; i++) { - if ($scope.MontageMonitors[i].Monitor.listDisplay == 'show' && simulStreaming) NVR.killLiveStream($scope.MontageMonitors[i].Monitor.connKey, $scope.MontageMonitors[i].Monitor.controlURL); + for (var iz = 0; iz < $scope.MontageMonitors.length; iz++) { + if ($scope.MontageMonitors[iz].Monitor.listDisplay == 'show' && simulStreaming) NVR.killLiveStream($scope.MontageMonitors[iz].Monitor.connKey, $scope.MontageMonitors[iz].Monitor.controlURL); // if length of selected groups is 0 then show all var isShow = ln? false: true; if (ln) { - for (var k=0; k < $scope.MontageMonitors[i].Monitor.Group.length; k++) { - if (ld.currentZMGroupNames.includes($scope.MontageMonitors[i].Monitor.Group[k].name)) { + for (var k=0; k < $scope.MontageMonitors[iz].Monitor.Group.length; k++) { + if (ld.currentZMGroupNames.includes($scope.MontageMonitors[iz].Monitor.Group[k].name)) { isShow = true; break; } } } - $scope.MontageMonitors[i].Monitor.listDisplay = isShow? 'show':'noshow'; + $scope.MontageMonitors[iz].Monitor.listDisplay = isShow? 'show':'noshow'; // console.log ('----> Setting '+ $scope.MontageMonitors[i].Monitor.Name+' to '+ $scope.MontageMonitors[i].Monitor.listDisplay); } + ld.packeryPositions = undefined; + NVR.setLogin(ld) + .then (function() { + initPackery(); + }) + + +/* $timeout ( function () { beforeReorderPositions = pckry.getShiftPositions('data-item-id'); finishReorder(); },300); - +*/ } else { NVR.debug ("No action taken as selection is same as current"); } @@ -1874,6 +1882,7 @@ angular.module('zmApp.controllers') // switch to another montage profile $scope.switchMontageProfile = function () { var posArray; + var i; try { posArray = NVR.getLogin().packeryPositionsArray; @@ -1892,6 +1901,7 @@ angular.module('zmApp.controllers') $scope.listdata.push(key); } } + if ($scope.listdata.indexOf($translate.instant('kMontageDefaultProfile')) == -1) $scope.listdata.push($translate.instant('kMontageDefaultProfile')); -- cgit v1.2.3