Skip to content

Commit

Permalink
#939 Groups support in montage screen view new API
Browse files Browse the repository at this point in the history
  • Loading branch information
pliablepixels committed May 6, 2020
1 parent 55ad0d8 commit e07e975
Show file tree
Hide file tree
Showing 6 changed files with 234 additions and 21 deletions.
5 changes: 1 addition & 4 deletions config.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<widget android-packageName="com.pliablepixels.zmninja_pro" id="com.pliablepixels.zmninja_pro" ios-CFBundleIdentifier="com.pliablepixels.zmninja-pro" version="1.4.005" xmlns="http://www.w3.org/ns/widgets" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<widget android-packageName="com.pliablepixels.zmninja_pro" id="com.pliablepixels.zmninja_pro" ios-CFBundleIdentifier="com.pliablepixels.zmninja-pro" version="1.4.006" xmlns="http://www.w3.org/ns/widgets" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>zmNinja</name>
<description>
High performance ZoneMinder client
Expand Down Expand Up @@ -186,9 +186,6 @@
<plugin name="cordova-plugin-app-version" spec="0.1.9" />
<plugin name="cordova-plugin-inappbrowser" spec="https://github.com/apache/cordova-plugin-inappbrowser.git" />
<plugin name="cordova-plugin-statusbar" spec="~2.4.4-dev" />
<plugin name="cordova-plugin-ionic-webview" spec="https://github.com/pliablepixels/cordova-plugin-ionic-webview.git">
<variable name="ANDROID_SUPPORT_ANNOTATIONS_VERSION" value="27.+" />
</plugin>
<plugin name="cordova-plugin-media-pp-fork" spec="^1.0.2-dev" />
<engine name="android" spec="8.0.0" />
<engine name="ios" spec="5.1.1" />
Expand Down
6 changes: 1 addition & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "zmninjapro",
"description": "Home security mobile app for ZoneMinder",
"version": "1.4.005",
"version": "1.4.006",
"displayName": "zmNinja",
"author": "Pliable Pixels",
"license": "custom see LICENSE.md",
Expand Down Expand Up @@ -61,9 +61,6 @@
"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": {}
}
},
Expand All @@ -89,7 +86,6 @@
"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",
Expand Down
93 changes: 92 additions & 1 deletion www/js/MontageCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ angular.module('zmApp.controllers')
NVR.debug ("error parsing profile");
}

NVR.log("found a packery layout");
// NVR.log("found a packery layout:"+positionsStr);

layouttype = false;
}
Expand Down Expand Up @@ -800,6 +800,10 @@ angular.module('zmApp.controllers')
$scope.saveReorder = function () {
NVR.debug("Saving monitor hide/unhide");

$scope.currentZMGroupName='';
var ld = NVR.getLogin();
ld.currentZMGroupName = '';
NVR.setLogin(ld);
$scope.modal.remove();
$scope.MontageMonitors = $scope.copyMontage;
// call finish reorder after modal is gone
Expand Down Expand Up @@ -958,6 +962,89 @@ angular.module('zmApp.controllers')

}

};

$scope.selectZMGroup = function() {

$scope.newGroup = {
val: ""
};




$scope.tempZMGroups = angular.copy($scope.zmGroups);
$scope.tempZMGroups.push($translate.instant('kNone'));

$rootScope.zmPopup = $ionicPopup.show({
scope: $scope,
template: '<ion-radio-fix ng-if="item" ng-repeat="item in tempZMGroups" ng-value="item" ng-model="newGroup.val" > {{item}} </ion-radio-fix>',

title: $translate.instant('kSelect'),
subTitle: $translate.instant('kActive') + ': '+ NVR.getLogin().currentZMGroupName,

buttons: [{
text: $translate.instant('kButtonCancel'),
onTap: function (e) {

}

},
{
text: $translate.instant('kButtonOk'),
onTap: function (e) {
NVR.log("Group selected:" + $scope.newGroup.val);
var ld = NVR.getLogin();
if ($scope.newGroup.val == $translate.instant('kNone')) $scope.newGroup.val='';

if ($scope.newGroup.val != ld.currentZMGroupName) {

ld.currentZMGroupName = $scope.newGroup.val;
NVR.setLogin(ld);
$scope.currentZMGroupName = ld.currentZMGroupName;

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);

console.log ('Working on '+$scope.MontageMonitors[i].Monitor.Name+" with ZMG "+ld.currentZMGroupName );
var isInGroup = !ld.currentZMGroupName ? true: false;
if (ld.currentZMGroupName) {
for (var k=0; k < $scope.MontageMonitors[i].Monitor.Group.length; k++) {
if ($scope.MontageMonitors[i].Monitor.Group[k].name==ld.currentZMGroupName) {
isInGroup = true;
break;

}
}
}

$scope.MontageMonitors[i].Monitor.listDisplay = isInGroup? 'show':'noshow';
// console.log ('----> Setting '+ $scope.MontageMonitors[i].Monitor.Name+' to '+ $scope.MontageMonitors[i].Monitor.listDisplay);


}

$timeout ( function () {
beforeReorderPositions = pckry.getShiftPositions('data-item-id');
finishReorder();
$timeout(function () {
pckry.layout();
},600);
},300);

} else {
NVR.debug ("No action taken as selection is same as current");
}

}
}
]
});



};

$scope.selectUnselectAllToggleReorder = function () {
Expand Down Expand Up @@ -2242,6 +2329,10 @@ angular.module('zmApp.controllers')


$scope.eventModalOpen = false;

$scope.zmGroups = NVR.listOfZMGroups();
$scope.currentZMGroupName = NVR.getLogin().currentZMGroupName;

$scope.$on ( "process-push", function () {
NVR.debug (">> MontageCtrl: push handler");
var s = NVR.evaluateTappedNotification();
Expand Down
Loading

0 comments on commit e07e975

Please sign in to comment.