summaryrefslogtreecommitdiff
path: root/www
diff options
context:
space:
mode:
authorPliable Pixels <pliablepixels@gmail.com>2020-02-24 10:03:23 -0500
committerPliable Pixels <pliablepixels@gmail.com>2020-02-24 10:03:23 -0500
commit2b2a88f67c2ba94dd419025e1dd077df5e898704 (patch)
treead2891ea3db9c425bf4d37ace016dbcadc4bd2fd /www
parent992a697072c71dc374f27add137ea73fb2444454 (diff)
#903 init push before sockets are set up if ES is on, other tweaks
Diffstat (limited to 'www')
-rw-r--r--www/js/EventServer.js27
1 files changed, 21 insertions, 6 deletions
diff --git a/www/js/EventServer.js b/www/js/EventServer.js
index ad5f673a..71718988 100644
--- a/www/js/EventServer.js
+++ b/www/js/EventServer.js
@@ -276,6 +276,13 @@ angular.module('zmApp.controllers')
function setupMobileSocket() {
+ if (!pushInited) {
+ NVR.debug ("Calling pushInit()");
+ pushInit();
+ } else {
+ NVR.debug ("pushInit() already done");
+ }
+
var loginData = NVR.getLogin();
var d = $q.defer();
@@ -300,10 +307,6 @@ angular.module('zmApp.controllers')
// console.log("Connected to WebSocket with id: " + success.webSocketId);
nativeWebSocketId = success.webSocketId;
handleOpen(success);
- if (!pushInited) {
- NVR.debug("EventSever: Initializing FCM push");
- pushInit();
- }
d.resolve(true);
return d.promise;
},
@@ -556,7 +559,7 @@ angular.module('zmApp.controllers')
// "senderID": zm.gcmSenderId,
"icon": "ic_stat_notification",
sound: "true",
- vibrate: ld.vibrateOnPush
+ vibrate: "true",
//"sound": android_media_file
}
}
@@ -565,8 +568,20 @@ angular.module('zmApp.controllers')
}
+ PushNotification.hasPermission(function (succ) {
+ NVR.debug ("Push permission returned: "+JSON.stringify(succ));
+ }, function (err) {
+ NVR.debug ("Push permission error returned: "+JSON.stringify(err));
+ });
// console.log("*********** MEDIA BLOG IS " + mediasrc);
- media = $cordovaMedia.newMedia(mediasrc);
+
+ try {
+ media = $cordovaMedia.newMedia(mediasrc);
+ }
+ catch (err) {
+ NVR.debug ("Media init error:"+JSON.stringify(err));
+ }
+
push.on('registration', function (data) {