summaryrefslogtreecommitdiff
path: root/www/js/LoginCtrl.js
diff options
context:
space:
mode:
authorPliable Pixels <pliablepixels@gmail.com>2018-10-08 12:14:32 -0400
committerPliable Pixels <pliablepixels@gmail.com>2018-10-08 12:14:32 -0400
commitbace2be553e3175ba7a47024c8352e43d285b620 (patch)
tree8cae03c058a6500ab225f65e5a2842e4db7bde07 /www/js/LoginCtrl.js
parent881a3b160a1320f2318712c1063e40775236099f (diff)
log cleanup, wait for eventserver init before sending messages
Diffstat (limited to 'www/js/LoginCtrl.js')
-rw-r--r--www/js/LoginCtrl.js43
1 files changed, 25 insertions, 18 deletions
diff --git a/www/js/LoginCtrl.js b/www/js/LoginCtrl.js
index fc63ff06..d2dfe899 100644
--- a/www/js/LoginCtrl.js
+++ b/www/js/LoginCtrl.js
@@ -583,23 +583,23 @@ angular.module('zmApp.controllers').controller('zmApp.LoginCtrl', ['$scope', '$r
if ($rootScope.platformOS != 'desktop') {
if ($scope.loginData.isUseBasicAuth) {
- debug ("Cordova HTTP: configuring basic auth");
+ NVRDataModel.debug ("Cordova HTTP: configuring basic auth");
cordova.plugin.http.useBasicAuth($scope.loginData.basicAuthUser, $scope.loginData.basicAuthPassword);
}
if (!$scope.loginData.enableStrictSSL) {
//alert("Enabling insecure SSL");
- log(">>>> Disabling strict SSL checking (turn off in Dev Options if you can't connect)");
+ NVRDataModel.log(">>>> Disabling strict SSL checking (turn off in Dev Options if you can't connect)");
cordova.plugin.http.setSSLCertMode('nocheck', function() {
- debug('--> SSL is permissive, will allow any certs. Use at your own risk.');
+ NVRDataModel.debug('--> SSL is permissive, will allow any certs. Use at your own risk.');
}, function() {
console.log('-->Error setting SSL permissive');
});
} else {
- log(">>>> Enabling strict SSL checking (turn off in Dev Options if you can't connect)");
+ NVRDataModel.log(">>>> Enabling strict SSL checking (turn off in Dev Options if you can't connect)");
}
@@ -649,21 +649,28 @@ angular.module('zmApp.controllers').controller('zmApp.LoginCtrl', ['$scope', '$r
oldName = $scope.loginData.serverName;
if ($scope.loginData.isUseEventServer) {
- EventServer.init();
- if ($rootScope.apnsToken && $scope.loginData.disablePush != true) {
- NVRDataModel.log("Making sure we get push notifications");
- EventServer.sendMessage('push', {
- type: 'token',
- platform: $rootScope.platformOS,
- token: $rootScope.apnsToken,
- state: "enabled"
- }, 1);
- }
- EventServer.sendMessage("control", {
- type: 'filter',
- monlist: $scope.loginData.eventServerMonitors,
- intlist: $scope.loginData.eventServerInterval
+ EventServer.init()
+ .then (function (succ) {
+ if ($rootScope.apnsToken && $scope.loginData.disablePush != true) {
+ NVRDataModel.log("Making sure we get push notifications");
+ EventServer.sendMessage('push', {
+ type: 'token',
+ platform: $rootScope.platformOS,
+ token: $rootScope.apnsToken,
+ state: "enabled"
+ }, 1);
+ }
+ EventServer.sendMessage("control", {
+ type: 'filter',
+ monlist: $scope.loginData.eventServerMonitors,
+ intlist: $scope.loginData.eventServerInterval,
+ token: $rootScope.apnsToken
+ });
+ },
+ function (err) {
+ NVRDataModel.log ("Event server init failed");
});
+
}