diff options
Diffstat (limited to 'www')
| -rw-r--r-- | www/external/GCMIntentService.java | 5 | ||||
| -rw-r--r-- | www/js/DataModel.js | 11 | ||||
| -rw-r--r-- | www/js/EventServer.js | 38 | ||||
| -rw-r--r-- | www/js/EventServerSettingsCtrl.js | 22 | ||||
| -rw-r--r-- | www/templates/eventserversettings.html | 8 |
5 files changed, 58 insertions, 26 deletions
diff --git a/www/external/GCMIntentService.java b/www/external/GCMIntentService.java index 67230c22..9ffe5836 100644 --- a/www/external/GCMIntentService.java +++ b/www/external/GCMIntentService.java @@ -188,7 +188,8 @@ public class GCMIntentService extends GCMBaseIntentService implements PushConsta * Notification Sound */ if (soundOption) { - // setNotificationSound(context, extras, mBuilder); + /* PP Enable Sound option */ + setNotificationSound(context, extras, mBuilder); } /* @@ -224,7 +225,7 @@ public class GCMIntentService extends GCMBaseIntentService implements PushConsta Notification notification = mBuilder.build(); //notification.sound = Uri.parse("android.resource://" + context.getPackageName() + "/"+ R.raw.blop); //PP http://stackoverflow.com/questions/15449945/notification-sound-from-uri-parse-does-not-work - notification.sound = Uri.parse(ContentResolver.SCHEME_ANDROID_RESOURCE + "://" + getPackageName() + "/raw/blop"); + //notification.sound = Uri.parse(ContentResolver.SCHEME_ANDROID_RESOURCE + "://" + getPackageName() + "/raw/blop"); //notification.defaults |= Notification.DEFAULT_VIBRATE; mNotificationManager.notify((String) appName, notId, notification); } diff --git a/www/js/DataModel.js b/www/js/DataModel.js index 28228e1c..ac1e472c 100644 --- a/www/js/DataModel.js +++ b/www/js/DataModel.js @@ -64,7 +64,8 @@ angular.module('zmApp.controllers') 'useNphZms':true, 'packMontage':true, 'exitOnSleep':false, - 'forceNetworkStop':false + 'forceNetworkStop':false, + 'defaultPushSound': false, }; @@ -252,6 +253,14 @@ angular.module('zmApp.controllers') + if (typeof loginData.defaultPushSound == 'undefined') + { + zmDebug ("defaultPushSound does not exist. Setting to false"); + loginData.defaultPushSound = false; + } + + + if (typeof loginData.exitOnSleep == 'undefined') { zmDebug ("exitOnSleep does not exist. Setting to false"); diff --git a/www/js/EventServer.js b/www/js/EventServer.js index 352ff327..1e847508 100644 --- a/www/js/EventServer.js +++ b/www/js/EventServer.js @@ -379,16 +379,40 @@ angular.module('zmApp.controllers') } else { mediasrc = "/android_asset/www/sounds/blop.mp3"; - push = PushNotification.init( + var android_media_file = "blop"; + var ld = ZMDataModel.getLogin(); + + + if (!ld.defaultPushSound) + { + ZMDataModel.zmLog ("Using blop push sound"); + push = PushNotification.init( - { - "android": { - "senderID": zm.gcmSenderId, - "icon": "ic_stat_notification" + { + "android": { + "senderID": zm.gcmSenderId, + "icon": "ic_stat_notification", + //"sound": android_media_file + } } - } - ); + ); + } + else + { + ZMDataModel.zmLog ("Using default push sound"); + push = PushNotification.init( + + { + "android": { + "senderID": zm.gcmSenderId, + "icon": "ic_stat_notification", + "sound": android_media_file + } + } + + ); + } } diff --git a/www/js/EventServerSettingsCtrl.js b/www/js/EventServerSettingsCtrl.js index 69326a23..20ec191f 100644 --- a/www/js/EventServerSettingsCtrl.js +++ b/www/js/EventServerSettingsCtrl.js @@ -1,4 +1,4 @@ -/* jshint -W041 */ + /* jshint -W041 */ /* jslint browser: true*/ /* global cordova,StatusBar,angular,console */ @@ -149,8 +149,8 @@ angular.module('zmApp.controllers').controller('zmApp.EventServerSettingsCtrl', $scope.loginData.eventServerMonitors = monstring; $scope.loginData.eventServerInterval = intervalstring; - $scope.loginData.isUseEventServer = ($scope.check.isUseEventServer) ? "1" : "0"; - $scope.loginData.disablePush = ($scope.check.disablePush) ? "1" : "0"; + // $scope.loginData.isUseEventServer = ($scope.check.isUseEventServer) ? "1" : "0"; + // $scope.loginData.disablePush = ($scope.check.disablePush) ? "1" : "0"; @@ -161,10 +161,10 @@ angular.module('zmApp.controllers').controller('zmApp.EventServerSettingsCtrl', var pushstate = "enabled"; - if ($scope.loginData.disablePush == "1" || $scope.loginData.isUseEventServer=="0") + if ($scope.loginData.disablePush == true || $scope.loginData.isUseEventServer==false) pushstate = "disabled"; - if ($scope.loginData.isUseEventServer=="1") { + if ($scope.loginData.isUseEventServer==true) { EventServer.init() .then(function (data) { console.log("Sending control filter"); @@ -194,6 +194,9 @@ angular.module('zmApp.controllers').controller('zmApp.EventServerSettingsCtrl', }); + // Give the above some time to transmit + $timeout (function() { + ZMDataModel.setLogin($scope.loginData);},3000); } else { @@ -224,7 +227,7 @@ angular.module('zmApp.controllers').controller('zmApp.EventServerSettingsCtrl', } //---------------------------------------------------------------- - // returns domain name in string - + // returns domain name in string - // http://stackoverflow.com/questions/8498592/extract-root-domain-name-from-string //---------------------------------------------------------------- function extractDomain(url) { @@ -296,14 +299,7 @@ angular.module('zmApp.controllers').controller('zmApp.EventServerSettingsCtrl', } - $scope.check = { - isUseEventServer: "", - disablePush:false, - }; - $scope.check.isUseEventServer = ($scope.loginData.isUseEventServer == '1') ? true : false; - $scope.check.disablePush = ($scope.loginData.disablePush == '1') ? true : false; - var res = $scope.loginData.eventServerMonitors.split(","); var minterval = $scope.loginData.eventServerInterval.split(","); diff --git a/www/templates/eventserversettings.html b/www/templates/eventserversettings.html index e56529a3..e680b0a4 100644 --- a/www/templates/eventserversettings.html +++ b/www/templates/eventserversettings.html @@ -15,20 +15,22 @@ <div class="list list-inset"> Please make sure your ZM settings are configured and saved before you configure the event server </div> - <ion-checkbox ng-model="check.isUseEventServer">use event server</ion-checkbox> + <ion-checkbox ng-model="loginData.isUseEventServer" ng-checked="{{loginData.isUseEventServer}}">use event server</ion-checkbox> <ion-item ng-href="" ng-click="selectScreen()"> on tap, navigate to: {{defScreen}} </ion-item> - <label class="item item-input item-floating-label" ng-if="check.isUseEventServer"> + <label class="item item-input item-floating-label" ng-if="loginData.isUseEventServer"> <span class="input-label">Event Server</span> <input autocapitalize="none" autocomplete="off" autocorrect="off" type="text" placeholder="Event notification url" ng-model="loginData.eventServer"> </label> - <ion-toggle ng-if="check.isUseEventServer" ng-model="check.disablePush" toggle-class="toggle-calm" class="item-text-wrap">only use websockets<br/><p>disables APNS/GCM</p></ion-toggle> + <ion-toggle ng-if="loginData.isUseEventServer" ng-model="loginData.disablePush" ng-checked="{{loginData.disablePush}}" toggle-class="toggle-calm" class="item-text-wrap">only use websockets<br/><p>disables APNS/GCM</p></ion-toggle> + + <ion-toggle ng-model="loginData.defaultPushSound" toggle-class="toggle-calm" class="item-text-wrap" ng-checked="{{loginData.defaultPushSound}}">use system sound<p>please save and restart app</p></ion-toggle> <ion-list> <div ng-repeat="monitor in monitors"> |
