Skip to content

Commit

Permalink
#704 chaining fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pliablepixels committed Sep 13, 2018
1 parent 710c9a2 commit b8c72c8
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 14 deletions.
6 changes: 3 additions & 3 deletions jsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"www/**/*"
],
"exclude": [
"node_modules/",
"dist/",
"platforms/"
"node_modules",
"dist",
"platforms"
]
}
4 changes: 3 additions & 1 deletion www/js/DataModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -1707,15 +1707,17 @@ angular.module('zmApp.controllers')
// returns API version or none
//-------------------------------------------------------
getAPIversion: function () {
debug("getAPIversion called");

var d = $q.defer();
var apiurl = loginData.apiurl + '/host/getVersion.json';
debug("getAPIversion called with "+apiurl);
$http.get(apiurl)
.then(function (success) {
if (success.data.version) {
// console.log ("API VERSION RETURNED: " + JSON.stringify(success));
$rootScope.apiValid = true;
setCurrentServerVersion(success.data.version);
debug("getAPI version succeded with "+success.data.version);
d.resolve(success.data.version);
} else {
debug("Setting APIValid to false as API version was not retrieved");
Expand Down
16 changes: 12 additions & 4 deletions www/js/MenuController.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ angular.module('zmApp.controllers').controller('MenuController', ['$scope', '$io
disableBack: true
});

console.log ("+++ state go after getMonitors force");
$state.go('app.refresh', {
"view": $state.current.name
});
Expand All @@ -145,14 +146,15 @@ angular.module('zmApp.controllers').controller('MenuController', ['$scope', '$io
},
function (error) {
var refresh = NVRDataModel.getMonitors(1);

console.log ("+++ state go after API version error: "+error);
$rootScope.apiVersion = "0.0.0";
NVRDataModel.debug("Error, failed API version, setting to " + $rootScope.apiVersion);

$ionicHistory.nextViewOptions({
disableBack: true
});


$state.go('app.refresh', {
"view": $state.current.name
});
Expand All @@ -174,15 +176,20 @@ angular.module('zmApp.controllers').controller('MenuController', ['$scope', '$io
NVRDataModel.debug("refreshing API version...");
NVRDataModel.getAPIversion()
.then(function (data) {
var refresh = NVRDataModel.getMonitors(1);
$rootScope.apiVersion = data;
var refresh = NVRDataModel.getMonitors(1)
.then (function () {
$rootScope.apiVersion = data;
$ionicHistory.nextViewOptions({
disableBack: true
});

console.log ("+++ state go after 5xx");
$state.go('app.refresh', {
"view": $state.current.name
});
return;
});

},
function (error) {
var refresh = NVRDataModel.getMonitors(1);
Expand All @@ -191,6 +198,7 @@ angular.module('zmApp.controllers').controller('MenuController', ['$scope', '$io
$ionicHistory.nextViewOptions({
disableBack: true
});
console.log ("+++ state go after API version force");
$state.go('app.refresh', {
"view": $state.current.name
});
Expand Down Expand Up @@ -234,7 +242,7 @@ angular.module('zmApp.controllers').controller('MenuController', ['$scope', '$io
scope: $scope,
template: '<ion-radio-fix ng-if="item" ng-repeat="item in avs" ng-value="item" ng-model="newServer.val"> {{item}} </ion-radio-fix>',

title: $translate.instant('kSelectLanguage'),
title: $translate.instant('kSelect'),

buttons: [{
text: $translate.instant('kButtonCancel'),
Expand Down
3 changes: 3 additions & 0 deletions www/js/MontageCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -1804,6 +1804,9 @@ angular.module('zmApp.controllers')
currentStreamState = streamState.SNAPSHOT;
// NVRDataModel.regenConnKeys();
$scope.monitors = NVRDataModel.getMonitorsNow();

console.log ("MONITORS:"+JSON.stringify($scope.monitors));

$scope.MontageMonitors = angular.copy($scope.monitors);


Expand Down
19 changes: 13 additions & 6 deletions www/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -1751,15 +1751,22 @@ angular.module('zmApp', [



if ((NVRDataModel.hasLoginInfo() || toState.data.requireLogin == false) && toState.name != "app.invalidapi" && toState.name != "app.refresh") {
if ((NVRDataModel.hasLoginInfo() || toState.data.requireLogin == false) && toState.name != "app.invalidapi" ) {
//console.log("State transition is authorized");
NVRDataModel.debug ("Setting last-desktop-state to:"+JSON.stringify(toState));
localforage.setItem('last-desktop-state', {
'name': toState.name,
'params': toState.params
});

if (toState.name != "app.refresh") {

NVRDataModel.debug ("Setting last-desktop-state to:"+JSON.stringify(toState));
localforage.setItem('last-desktop-state', {
'name': toState.name,
'params': toState.params
});


}
$rootScope.dpadState = toState.name.replace("app.", "");
return;

} else {
NVRDataModel.log("In Auth State trans: Not logged in, requested to go to " + JSON.stringify(toState));
// event.preventDefault();
Expand Down

0 comments on commit b8c72c8

Please sign in to comment.