summaryrefslogtreecommitdiff
path: root/www/js
diff options
context:
space:
mode:
Diffstat (limited to 'www/js')
-rw-r--r--www/js/DataModel.js11
-rw-r--r--www/js/EventServer.js38
-rw-r--r--www/js/EventServerSettingsCtrl.js22
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(",");