diff options
| author | pliablepixels <pliablepixels@gmail.com> | 2016-02-01 15:49:30 -0500 |
|---|---|---|
| committer | pliablepixels <pliablepixels@gmail.com> | 2016-02-01 15:49:30 -0500 |
| commit | 1643d47c2a4e946012455f5702b92e8402bb46a2 (patch) | |
| tree | 5d5af99bc42b9f05fe0fb4c948214d24287e5a17 /www/js | |
| parent | 6f70a38294bd6a5ca24fad669d6280b4bce7b952 (diff) | |
#135 - initial code towards allowing system sound - not working yet
Former-commit-id: 939d7ac5decaf5761b079b65bfdc9f8a5bebf164
Diffstat (limited to 'www/js')
| -rw-r--r-- | www/js/DataModel.js | 11 | ||||
| -rw-r--r-- | www/js/EventServer.js | 38 | ||||
| -rw-r--r-- | www/js/EventServerSettingsCtrl.js | 22 |
3 files changed, 50 insertions, 21 deletions
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(","); |
