diff options
| author | Pliable Pixels <pliablepixels@gmail.com> | 2020-02-24 10:03:23 -0500 |
|---|---|---|
| committer | Pliable Pixels <pliablepixels@gmail.com> | 2020-02-24 10:03:23 -0500 |
| commit | 2b2a88f67c2ba94dd419025e1dd077df5e898704 (patch) | |
| tree | ad2891ea3db9c425bf4d37ace016dbcadc4bd2fd | |
| parent | 992a697072c71dc374f27add137ea73fb2444454 (diff) | |
#903 init push before sockets are set up if ES is on, other tweaks
| -rw-r--r-- | config.xml | 1 | ||||
| -rw-r--r-- | package.json | 3 | ||||
| -rw-r--r-- | www/js/EventServer.js | 27 |
3 files changed, 24 insertions, 7 deletions
@@ -179,6 +179,7 @@ <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.0.1" /> </widget> diff --git a/package.json b/package.json index 739c68dc..aa5502fd 100644 --- a/package.json +++ b/package.json @@ -61,7 +61,8 @@ }, "cordova-plugin-ionic-webview": { "ANDROID_SUPPORT_ANNOTATIONS_VERSION": "27.+" - } + }, + "cordova-plugin-media-pp-fork": {} } }, "dependencies": { 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) { |
