|
|
@ -1485,45 +1485,65 @@ angular.module('myApp.controllers', []) |
|
|
|
}); |
|
|
|
}); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
AppConfigManager.get('notify_nodesktop', 'notify_nosound', 'send_ctrlenter').then(function (settings) { |
|
|
|
AppConfigManager.get('notify_nodesktop', 'notify_nosound', 'send_ctrlenter', 'notify_volume').then(function (settings) { |
|
|
|
$scope.notify.desktop = !settings[0]; |
|
|
|
$scope.notify.desktop = !settings[0]; |
|
|
|
$scope.notify.sound = !settings[1]; |
|
|
|
|
|
|
|
$scope.send.enter = settings[2] ? '' : '1'; |
|
|
|
$scope.send.enter = settings[2] ? '' : '1'; |
|
|
|
|
|
|
|
|
|
|
|
$scope.$watch('notify.sound', function(newValue, oldValue) { |
|
|
|
if (settings[1]) { |
|
|
|
if (newValue === oldValue) { |
|
|
|
$scope.notify.volume = 0; |
|
|
|
return false; |
|
|
|
} else { |
|
|
|
|
|
|
|
$scope.notify.volume = settings[3] > 0 && Math.ceil(settings[3] * 10) || 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$scope.notify.volumeOf4 = function () { |
|
|
|
|
|
|
|
return 1 + Math.ceil(($scope.notify.volume - 1) / 3.3); |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$scope.toggleSound = function () { |
|
|
|
|
|
|
|
if ($scope.notify.volume) { |
|
|
|
|
|
|
|
$scope.notify.volume = 0; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
$scope.notify.volume = 5; |
|
|
|
} |
|
|
|
} |
|
|
|
if (newValue) { |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var testSoundPromise; |
|
|
|
|
|
|
|
$scope.$watch('notify.volume', function (newValue, oldValue) { |
|
|
|
|
|
|
|
if (newValue !== oldValue) { |
|
|
|
|
|
|
|
var storeVolume = newValue / 10; |
|
|
|
|
|
|
|
AppConfigManager.set({notify_volume: storeVolume}); |
|
|
|
AppConfigManager.remove('notify_nosound'); |
|
|
|
AppConfigManager.remove('notify_nosound'); |
|
|
|
} else { |
|
|
|
|
|
|
|
AppConfigManager.set({notify_nosound: true}); |
|
|
|
|
|
|
|
NotificationsManager.clear(); |
|
|
|
NotificationsManager.clear(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (testSoundPromise) { |
|
|
|
|
|
|
|
$timeout.cancel(testSoundPromise); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
testSoundPromise = $timeout(function () { |
|
|
|
|
|
|
|
NotificationsManager.testSound(storeVolume); |
|
|
|
|
|
|
|
}, 500); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
$scope.$watch('notify.desktop', function(newValue, oldValue) { |
|
|
|
$scope.toggleDesktop = function () { |
|
|
|
if (newValue === oldValue) { |
|
|
|
$scope.notify.desktop = !$scope.notify.desktop; |
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
if ($scope.notify.desktop) { |
|
|
|
if (newValue) { |
|
|
|
|
|
|
|
AppConfigManager.remove('notify_nodesktop'); |
|
|
|
AppConfigManager.remove('notify_nodesktop'); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
AppConfigManager.set({notify_nodesktop: true}); |
|
|
|
AppConfigManager.set({notify_nodesktop: true}); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$scope.$watch('send.enter', function(newValue, oldValue) { |
|
|
|
$scope.toggleCtrlEnter = function (newValue) { |
|
|
|
if (newValue === oldValue) { |
|
|
|
$scope.send.enter = newValue; |
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
if ($scope.send.enter) { |
|
|
|
if (newValue) { |
|
|
|
|
|
|
|
AppConfigManager.remove('send_ctrlenter'); |
|
|
|
AppConfigManager.remove('send_ctrlenter'); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
AppConfigManager.set({send_ctrlenter: true}); |
|
|
|
AppConfigManager.set({send_ctrlenter: true}); |
|
|
|
} |
|
|
|
} |
|
|
|
$rootScope.$broadcast('settings_changed'); |
|
|
|
$rootScope.$broadcast('settings_changed'); |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|