diff options
| author | Pliable Pixels <pliablepixels@gmail.com> | 2020-08-28 15:22:56 -0400 |
|---|---|---|
| committer | Pliable Pixels <pliablepixels@gmail.com> | 2020-08-28 15:22:56 -0400 |
| commit | 25211b7d46c08788f390f6f220428b6f179e5ed2 (patch) | |
| tree | d3354e2f695909fff0dc6eaebece0e950b33e823 | |
| parent | 1c2ba2c9db76c4e328bd70dc7ffc195ecea7a161 (diff) | |
#962 feature complete compared to push plugin
| -rw-r--r-- | config.xml | 37 | ||||
| -rw-r--r-- | docs/guides/source.rst | 8 | ||||
| -rw-r--r-- | package.json | 40 | ||||
| -rw-r--r-- | www/js/EventCtrl.js | 22 | ||||
| -rw-r--r-- | www/js/EventServer.js | 343 | ||||
| -rw-r--r-- | www/js/NVR.js | 2 | ||||
| -rwxr-xr-x | www/js/app.js | 2 |
7 files changed, 275 insertions, 179 deletions
@@ -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.010" 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.5.000" 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 @@ -35,7 +35,7 @@ <preference name="SplashMaintainAspectRatio" value="true" /> <preference name="FadeSplashScreen" value="false" /> <preference name="BackgroundColor" value="#444444" /> - <preference name="android-targetSdkVersion" value="28" /> + <preference name="android-targetSdkVersion" value="29" /> <preference name="android-minSdkVersion" value="21" /> <preference name="SplashScreenBackgroundColor" value="#ababab" /> <feature name="StatusBar"> @@ -49,7 +49,6 @@ </feature> <preference name="CordovaWebViewEngine" value="CDVWKWebViewEngine" /> <resource-file src="www/sounds/blop.caf" target="blop.caf" /> - <resource-file src="GoogleService-Info.plist" /> <custom-config-file parent="NSAppTransportSecurity" target="*-Info.plist"> <dict> <key>NSAllowsArbitraryLoads</key> @@ -85,7 +84,7 @@ <icon height="87" src="resources/ios/icon/icon-small@3x.png" width="87" /> <splash src="resources/Default@2x~universal~anyany.png" /> <icon height="1024" src="resources/icon_for_apppublish_1024x1024_no_alpha.jpg" width="1024" /> - <splash src="resources/ios/splash/Default@2x~universal~anyany.png" /> + <splash height="2732" src="resources/ios/splash/Default@2x~universal~anyany.png" width="2732" /> <splash height="1136" src="resources/ios/splash/Default-568h@2x~iphone.png" width="640" /> <splash height="1334" src="resources/ios/splash/Default-667h.png" width="750" /> <splash height="2208" src="resources/ios/splash/Default-736h.png" width="1242" /> @@ -99,6 +98,24 @@ <splash height="960" src="resources/ios/splash/Default@2x~iphone.png" width="640" /> <splash height="480" src="resources/ios/splash/Default~iphone.png" width="320" /> <icon height="1024" src="resources/ios/icon/icon-1024.png" width="1024" /> + <icon height="20" src="resources/ios/icon/icon-20.png" width="20" /> + <icon height="40" src="resources/ios/icon/icon-20@2x.png" width="40" /> + <icon height="60" src="resources/ios/icon/icon-20@3x.png" width="60" /> + <icon height="29" src="resources/ios/icon/icon-29.png" width="29" /> + <icon height="58" src="resources/ios/icon/icon-29@2x.png" width="58" /> + <icon height="87" src="resources/ios/icon/icon-29@3x.png" width="87" /> + <icon height="48" src="resources/ios/icon/icon-24@2x.png" width="48" /> + <icon height="55" src="resources/ios/icon/icon-27.5@2x.png" width="55" /> + <icon height="88" src="resources/ios/icon/icon-44@2x.png" width="88" /> + <icon height="172" src="resources/ios/icon/icon-86@2x.png" width="172" /> + <icon height="196" src="resources/ios/icon/icon-98@2x.png" width="196" /> + <icon height="216" src="resources/ios/icon/icon-108@2x.png" width="216" /> + <splash height="2688" src="resources/ios/splash/Default-2688h~iphone.png" width="1242" /> + <splash height="1242" src="resources/ios/splash/Default-Landscape-2688h~iphone.png" width="2688" /> + <splash height="1792" src="resources/ios/splash/Default-1792h~iphone.png" width="828" /> + <splash height="828" src="resources/ios/splash/Default-Landscape-1792h~iphone.png" width="1792" /> + <splash height="2436" src="resources/ios/splash/Default-2436h.png" width="1125" /> + <splash height="1125" src="resources/ios/splash/Default-Landscape-2436h.png" width="2436" /> </platform> <platform name="android"> <preference name="MixedContentMode" value="2" /> @@ -159,15 +176,16 @@ <plugin name="cordova-custom-config" spec="5.0.2" /> <plugin name="cordova-plugin-advanced-websocket" spec="1.1.5" /> <plugin name="cordova-support-google-services" spec="1.3.2" /> - <plugin name="phonegap-plugin-push" spec="2.3.0"> - <variable name="ANDROID_SUPPORT_V13_VERSION" value="27.+" /> - <variable name="FCM_VERSION" value="17.0.+" /> - </plugin> <plugin name="cordova-plugin-x-socialsharing" spec="5.6.4"> <variable name="ANDROID_SUPPORT_V4_VERSION" value="24.1.1+" /> <variable name="PHOTO_LIBRARY_ADD_USAGE_DESCRIPTION" value="This app requires photo library access to function properly." /> <variable name="PHOTO_LIBRARY_USAGE_DESCRIPTION" value="This app requires photo library access to function properly." /> </plugin> + <plugin name="cordova-plugin-firebasex" spec="latest"> + <variable name="FIREBASE_ANALYTICS_COLLECTION_ENABLED" value="false" /> + <variable name="FIREBASE_PERFORMANCE_COLLECTION_ENABLED" value="false" /> + <variable name="FIREBASE_CRASHLYTICS_COLLECTION_ENABLED" value="false" /> + </plugin> <plugin name="cordova-plugin-ionic-keyboard" spec="2.2.0" /> <plugin name="cordova-plugin-touch-id" spec="3.4.0"> <variable name="FACEID_USAGE_DESCRIPTION" value="" /> @@ -175,7 +193,4 @@ <plugin name="cordova-plugin-android-permissions" spec="1.0.2" /> <plugin name="cordova-plugin-app-version" spec="0.1.9" /> <plugin name="cordova-plugin-whitelist" spec="^1.3.4" /> - <plugin name="cordova-plugin-advanced-http" spec="^2.5.1"> - <variable name="OKHTTP_VERSION" value="3.10.0" /> - </plugin> </widget> diff --git a/docs/guides/source.rst b/docs/guides/source.rst index cb2499d2..c1f62f1a 100644 --- a/docs/guides/source.rst +++ b/docs/guides/source.rst @@ -138,8 +138,12 @@ it support automatic building of notification extensions. So there is manual wor - Now in XCode Targets, select ``zmNinjaNotification``, and make sure you select a Team and make sure Deployment Target is 11 or above - Change Deployment target to 11 or above (same as zmNinja target) - ``cp etc/NotificationService.m platforms/ios/zmNinjaNotification/`` -- ``cd platforms/ios/`` -- ``pod install`` + +Starting 1.5.0, zmNinja uses the `cordova-plugin-firebasex <https://github.com/dpa99c/cordova-plugin-firebasex>`__ +library for push notifications. The older cordova-push-plugin is no longer supported by the author. +If you are facing compilation issues that relate to this plugin, please make sure you read it's troubleshooting section, +especially around outdated pods et. al. + You can now do `build_ios.sh`. However, after you build, you will have to go back to XCode after the build to make the following changes: diff --git a/package.json b/package.json index 0972933c..92edf08e 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "zmninjapro", "description": "Home security mobile app for ZoneMinder", - "version": "1.4.010", + "version": "1.5.000", "displayName": "zmNinja", "author": "Pliable Pixels", "license": "custom see LICENSE.md", @@ -35,10 +35,6 @@ "cordova-plugin-advanced-websocket": {}, "cordova-plugin-splashscreen": {}, "cordova-support-google-services": {}, - "phonegap-plugin-push": { - "ANDROID_SUPPORT_V13_VERSION": "27.+", - "FCM_VERSION": "17.0.+" - }, "cordova-plugin-x-socialsharing": { "ANDROID_SUPPORT_V4_VERSION": "24.1.1+", "PHOTO_LIBRARY_ADD_USAGE_DESCRIPTION": "This app requires photo library access to function properly.", @@ -50,16 +46,33 @@ }, "cordova-plugin-android-permissions": {}, "cordova-plugin-app-version": {}, - "cordova-plugin-advanced-http": { - "OKHTTP_VERSION": "3.10.0" - }, "cordova-sqlite-storage": {}, "cordova-plugin-add-swift-support": {}, "cordova-plugin-statusbar": {}, "cordova-plugin-file": {}, - "cordova-plugin-media-pp-fork": {}, "cordova-plugin-photo-library-wkwebview": { "PHOTO_LIBRARY_USAGE_DESCRIPTION": "Save alarmed images to phone " + }, + "cordova-plugin-firebasex": { + "FIREBASE_ANALYTICS_COLLECTION_ENABLED": "false", + "FIREBASE_PERFORMANCE_COLLECTION_ENABLED": "false", + "FIREBASE_CRASHLYTICS_COLLECTION_ENABLED": "false", + "ANDROID_ICON_ACCENT": "#FF00FFFF", + "ANDROID_PLAY_SERVICES_AUTH_VERSION": "18.0.0", + "ANDROID_FIREBASE_ANALYTICS_VERSION": "17.4.3", + "ANDROID_FIREBASE_MESSAGING_VERSION": "20.2.1", + "ANDROID_FIREBASE_CONFIG_VERSION": "19.1.4", + "ANDROID_FIREBASE_PERF_VERSION": "19.0.7", + "ANDROID_FIREBASE_AUTH_VERSION": "19.3.1", + "ANDROID_FIREBASE_FIRESTORE_VERSION": "21.4.3", + "ANDROID_FIREBASE_CRASHLYTICS_VERSION": "17.0.1", + "ANDROID_FIREBASE_CRASHLYTICS_NDK_VERSION": "17.0.1", + "ANDROID_GSON_VERSION": "2.8.6" + }, + "cordova-plugin-media-pp-fork": {}, + "cordova-plugin-advanced-http": {}, + "cordova-plugin-ionic-webview": { + "ANDROID_SUPPORT_ANNOTATIONS_VERSION": "27.+" } } }, @@ -71,10 +84,12 @@ "cordova-ios": "^5.1.1", "cordova-library-helper-pp-fork": "^1.0.1", "cordova-plugin-add-swift-support": "^2.0.2", - "cordova-plugin-advanced-http": "^2.5.1", + "cordova-plugin-advanced-http": "3.0.1", "cordova-plugin-advanced-websocket": "^1.1.5", "cordova-plugin-android-fingerprint-auth": "^1.5.0", "cordova-plugin-android-permissions": "^1.0.2", + "cordova-plugin-androidx": "^2.0.0", + "cordova-plugin-androidx-adapter": "^1.1.1", "cordova-plugin-app-version": "^0.1.9", "cordova-plugin-cloud-settings": "^1.0.4", "cordova-plugin-customurlscheme": "^4.4.0", @@ -85,6 +100,7 @@ "cordova-plugin-ignore-lint-translation": "0.0.1", "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", @@ -114,19 +130,19 @@ "json-file": "^0.1.0", "jsonfile": "^6.0.1", "keypress": "^0.2.1", + "latest": "^0.2.0", "menu": "^0.2.5", "minimist": "^1.2.5", "mkdirp": "^1.0.4", "node-sass": "^4.14.1", "object-is": "^1.1.2", "object-keys": "^1.1.1", - "phonegap-plugin-multidex": "^1.0.0", - "phonegap-plugin-push": "^2.3.0", "regexp.prototype.flags": "^1.3.0" }, "devDependencies": { "@ionic/v1-toolkit": "^1.0.14", "bower": "^1.8.4", + "cordova-plugin-firebasex": "^10.2.0-cli", "dotenv": "^8.2.0", "electron": "^8.3.0", "electron-builder": "^22.6.0", diff --git a/www/js/EventCtrl.js b/www/js/EventCtrl.js index 40762f6b..3027de01 100644 --- a/www/js/EventCtrl.js +++ b/www/js/EventCtrl.js @@ -2475,25 +2475,23 @@ angular.module('zmApp.controllers') $scope.popover = popover; }); + // coming to this view clears all notification badges EventServer.sendMessage('push', { type: 'badge', badge: 0, }); + // also clear bells + $rootScope.alarmCount = "0"; + $rootScope.isAlarm = !$rootScope.isAlarm; - - - //reset badge count - if (window.cordova && window.cordova.plugins.notification) { - $cordovaBadge.set(0).then(function () { - // You have permission, badge set. - }, function (err) { - NVR.debug("app does not have badge permissions. Please check your phone notification settings"); - // You do not have permission. - }); + // reset badge count + if (window.FirebasePlugin && $rootScope.platformOS == 'ios') { + NVR.debug ('Clearing app badge count'); + window.FirebasePlugin.setBadgeNumber(0); - $cordovaLocalNotification.clearAll(); } - + + }); $scope.$on('$ionicView.leave', function () { diff --git a/www/js/EventServer.js b/www/js/EventServer.js index 78e081c5..84260072 100644 --- a/www/js/EventServer.js +++ b/www/js/EventServer.js @@ -1,7 +1,7 @@ /* jshint -W041 */ /* jslint browser: true*/ -/* global cordova,StatusBar,angular,console ,PushNotification*/ +/* global cordova,StatusBar,angular,console ,PushNotification, FirebasePlugin*/ //-------------------------------------------------------------------------- // This factory interacts with the ZM Event Server @@ -410,7 +410,8 @@ angular.module('zmApp.controllers') var msg = { 'event': type, - 'data': obj + 'data': obj, + 'token': $rootScope.apnsToken }; var jmsg = JSON.stringify(msg); @@ -435,6 +436,12 @@ angular.module('zmApp.controllers') return; } + if (($rootScope.platformOS != 'desktop') && (!$rootScope.apnsToken) ) { + NVR.debug ('Mobile platform does not have a token yet, adding message to queue'); + pendingMessages.push ({type:type, obj:obj}); + return; + } + if (authState == connState.REJECT && type != 'auth') { NVR.debug ("EventSever: ERROR: ES rejected authentication, not sending message"); return; @@ -510,6 +517,7 @@ angular.module('zmApp.controllers') }*/ } + function pushInit() { NVR.log("EventSever: Setting up push registration"); @@ -522,13 +530,194 @@ angular.module('zmApp.controllers') var plat = $rootScope.platformOS; if ($rootScope.platformOS == 'desktop') { - NVR.log ('Not setting up push as this is desktop.'); + NVR.log ('push: Not setting up push as this is desktop.'); return; } + + // get permission if we need it + FirebasePlugin.hasPermission(function(hasPermission){ + if (!hasPermission) { + window.FirebasePlugin.grantPermission(function(hasPermission){ + if (hasPermission) { + NVR.debug ('push: permission granted, waiting for token'); + } else { + NVR.log('ERROR: push: Permission not granted for push'); + } + }); + } else { + NVR.debug('push: permissions are already enabled'); + } + }); + + if ($rootScope.platformOS == 'android') { + // Define custom channel - all keys are except 'id' are optional. + var channel = { + // channel ID - must be unique per app package + id: "zmninja", + // Channel description. Default: empty string + description: "zmNinja push", + // Channel name. Default: empty string + name: "zmNinja", + //The sound to play once a push comes. Default value: 'default' + //Values allowed: + //'default' - plays the default notification sound + //'ringtone' - plays the currently set ringtone + //'false' - silent; don't play any sound + //filename - the filename of the sound file located in '/res/raw' without file extension (mysound.mp3 -> mysound) + sound: "default", + + //Vibrate on new notification. Default value: true + //Possible values: + //Boolean - vibrate or not + //Array - vibration pattern - e.g. [500, 200, 500] - milliseconds vibrate, milliseconds pause, vibrate, pause, etc. + vibration: true, + // Whether to blink the LED + light: true, + //LED color in ARGB format - this example BLUE color. If set to -1, light color will be default. Default value: -1. + lightColor: parseInt("FF0000FF", 16).toString(), + //Importance - integer from 0 to 4. Default value: 4 + //0 - none - no sound, does not show in the shade + //1 - min - no sound, only shows in the shade, below the fold + //2 - low - no sound, shows in the shade, and potentially in the status bar + //3 - default - shows everywhere, makes noise, but does not visually intrude + //4 - high - shows everywhere, makes noise and peeks + importance: 4, + + //Show badge over app icon when non handled pushes are present. Default value: true + badge: true, + + //Show message on locked screen. Default value: 1 + //Possible values (default 1): + //-1 - secret - Do not reveal any part of the notification on a secure lockscreen. + //0 - private - Show the notification on all lockscreens, but conceal sensitive or private information on secure lockscreens. + //1 - public - Show the notification in its entirety on all lockscreens. + visibility: 1 + }; + + // Create the channel + FirebasePlugin.createChannel(channel, + function(){ + NVR.debug('push: Channel created: ' + channel.id); + }, + function(error){ + NVR.debug('push: Create channel error: ' + error); + }); + } + + + if ($rootScope.platformOS == 'ios') { + if (ld.isUseEventServer) { + NVR.debug ('push: ios, setting badge alarm count at start'); + window.FirebasePlugin.getBadgeNumber(function(cnt) { + if (cnt) { + NVR.debug ('push: ios, badge is:'+cnt); + $rootScope.isAlarm = 1; + $rootScope.alarmCount = cnt; + if ($rootScope.alarmCount > 99) { + $rootScope.alarmCount = '99+'; + } + } + }); + } + } // ios + // called when token is assigned + window.FirebasePlugin.onTokenRefresh( + function (token) { + NVR.debug ("push: got token:"+token); + $rootScope.apnsToken = token; + NVR.debug ('push: setting up onMessageReceived...'); + window.FirebasePlugin.onMessageReceived(function(message) { + $ionicPlatform.ready(function () { + + NVR.debug("push: EventSever: received push notification with payload:"+JSON.stringify(message)); + + if ($rootScope.platformOS == 'ios') { + NVR.debug ("push: clearing badge"); + window.FirebasePlugin.setBadgeNumber(0); + } + + var ld = NVR.getLogin(); + if (ld.isUseEventServer == false) { + NVR.debug("push: EventSever: received push notification, but event server disabled. Not acting on it"); + return; + } + NVR.debug ('push: Message type received is:'+message.messageType); + + sendMessage('push', { + type: 'badge', + badge: 0, + }); + var mid; + var eid = message.eid; + if (message.mid) { + mid = message.mid; + var mi = mid.indexOf(','); + if (mi > 0) { + mid = mid.slice(0, mi); + } + mid = parseInt(mid); + } + + + if (message.tap=='foreground') { + console.log ('push: Foreground'); + $rootScope.tappedNotification = 0; + $rootScope.tappedEid = 0; + $rootScope.tappedMid = 0; + + if (ld.soundOnPush) { + media.play({ + playAudioWhenScreenIsLocked: false + }); + } + if ($rootScope.alarmCount == "99") { + $rootScope.alarmCount = "99+"; + } + if ($rootScope.alarmCount != "99+") { + $rootScope.alarmCount = (parseInt($rootScope.alarmCount) + 1).toString(); + } + $rootScope.isAlarm = 1; + + + + } else if (message.tap == 'background') { + $rootScope.alarmCount = "0"; + $rootScope.isAlarm = 0; + $rootScope.tappedNotification = 1; + $rootScope.tappedMid = mid; + $rootScope.tappedEid = eid; + NVR.log("EventSever: Push notification: Tapped Monitor taken as:" + $rootScope.tappedMid); + + $timeout ( function () { + NVR.debug ("EventServer: broadcasting process-push"); + $rootScope.$broadcast('process-push'); + },100); + + + } else { + NVR.debug ("push: message tap not defined"); + $rootScope.tappedNotification = 0; + $rootScope.tappedEid = 0; + $rootScope.tappedMid = 0; + + } + + }); // ready + }); + }, + function (err) { + NVR.debug ('push: Error getting token:'+err); + + }); + + + + + if (plat == 'ios') { mediasrc = "sounds/blop.mp3"; - push = PushNotification.init( + /* push = PushNotification.init( { "ios": { @@ -541,13 +730,13 @@ angular.module('zmApp.controllers') } } - ); + );*/ } else { mediasrc = "/android_asset/www/sounds/blop.mp3"; var android_media_file = "blop"; - push = PushNotification.init( + /* push = PushNotification.init( { "android": { @@ -559,15 +748,15 @@ angular.module('zmApp.controllers') } } - ); + );*/ } - PushNotification.hasPermission(function (succ) { + /* 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); try { @@ -578,7 +767,7 @@ angular.module('zmApp.controllers') } - + /* push.on('registration', function (data) { pushInited = true; NVR.debug("EventSever: Push Notification registration ID received: " + JSON.stringify(data)); @@ -640,136 +829,10 @@ angular.module('zmApp.controllers') NVR.log("EventSever: Could not get monitors, can't send push reg"); }); - }); - - push.on('notification', function (data) { - - $ionicPlatform.ready(function () { - NVR.log("EventSever: notification handler device ready"); - NVR.debug("EventSever: received push notification"); - - var ld = NVR.getLogin(); - if (ld.isUseEventServer == false) { - NVR.debug("EventSever: received push notification, but event server disabled. Not acting on it"); - return; - } - - if (data && data.additionalData && data.additionalData.foreground == false) { - // This means push notification tap in background - - NVR.debug("EventSever: PUSH NOTF >>> " + JSON.stringify(data)); - - // set tappedMid to monitor - //*** PUSH DATA>>>>{"sound":"blop","message":"Alarms: Basement (2854) ","additionalData":{"mid":"2","coldstart":false,"collapse_key":"do_not_collapse","foreground":false}} - - if (data.additionalData.dismissed != undefined || data.additionalData.coldstart == true || $rootScope.platformOS == 'ios') // user tapped on notification - // in iOS case, since content-av is not there this notification won't be called unless you tap - { - NVR.debug("Notification Tapped"); - $rootScope.alarmCount = "0"; - $rootScope.isAlarm = 0; - $rootScope.tappedNotification = 1; - - var mid; - var eid; - - // we are using FCM on IOS too - /* if ($rootScope.platformOS == 'ios') { - mid = data.additionalData.gcm.notification.mid; - eid = data.additionalData.gcm.notification.eid; - - } - else {*/ - - mid = data.additionalData.mid; - eid = data.additionalData.eid; - // } - - - - // if Multiple mids, take the first one - if (mid) { - var mi = mid.indexOf(','); - if (mi > 0) { - mid = mid.slice(0, mi); - } - } - - mid = parseInt(mid); - - $rootScope.tappedMid = mid; - $rootScope.tappedEid = eid; - NVR.log("EventSever: Push notification: Tapped Monitor taken as:" + $rootScope.tappedMid); - - if ($rootScope.platformOS == 'ios') { - - NVR.debug("EventSever: iOS only: clearing background push"); - push.finish(function () { - NVR.debug("EventSever: processing of push data is finished"); - }); - } - - } else { - NVR.debug("EventSever: App started via icon, not notification tap"); - $rootScope.tappedNotification = 0; - $rootScope.tappedEid = 0; - $rootScope.tappedMid = 0; - } - // keep this emit not broadcast - // see Portal latch for reason - - //https://stackoverflow.com/a/22651128/1361529 - $timeout ( function () { - NVR.debug ("EventServer: broadcasting process-push"); - $rootScope.$broadcast('process-push'); - },100); - - - } else // app is foreground - { - - // this flag honors the HW mute button. Go figure - // http://ilee.co.uk/phonegap-plays-sound-on-mute/ - - NVR.debug("EventSever: --> *** PUSH IN FOREGROUND"); - - $rootScope.tappedNotification = 0; - $rootScope.tappedEid = 0; - $rootScope.tappedMid = 0; - - if (ld.soundOnPush) { - media.play({ - playAudioWhenScreenIsLocked: false - }); - } - - var str = data.message; - // console.log ("***STRING: " + str + " " +str.status); - var eventsToDisplay = []; - - NVR.displayBanner('alarm', [str], 0, 5000 * eventsToDisplay.length); - - $rootScope.isAlarm = 1; - - // Show upto a max of 99 when it comes to display - // so aesthetics are maintained - if ($rootScope.alarmCount == "99") { - $rootScope.alarmCount = "99+"; - } - if ($rootScope.alarmCount != "99+") { - $rootScope.alarmCount = (parseInt($rootScope.alarmCount) + 1).toString(); - } - - - - } - }); - }); - - push.on('error', function (e) { - NVR.debug("EventSever: Push error: " + JSON.stringify(e)); - // console.log("************* PUSH ERROR ******************"); - }); + }); */ + + // add push code here + } return { diff --git a/www/js/NVR.js b/www/js/NVR.js index bc33af07..f1c369c3 100644 --- a/www/js/NVR.js +++ b/www/js/NVR.js @@ -21,7 +21,7 @@ angular.module('zmApp.controllers') DO NOT TOUCH zmAppVersion It is changed by sync_version.sh */ - var zmAppVersion = "1.4.010"; + var zmAppVersion = "1.5.000"; var isBackground = false; var justResumed = false; diff --git a/www/js/app.js b/www/js/app.js index 26fef2fb..f84673a5 100755 --- a/www/js/app.js +++ b/www/js/app.js @@ -34,7 +34,7 @@ angular.module('zmApp', [ .constant('zm', { minAppVersion: '1.28.107', // if ZM is less than this, the app won't work //minAppVersion:'1.44', - minEventServerVersion: '2.4', + minEventServerVersion: '6.0', castAppId: 'BA30FB4C', alarmFlashTimer: 20000, // time to flash alarm gcmSenderId: '710936220256', |
