Files
stf-DeviceFarmer/res/app/control-panes/automation/device-settings/device-settings-controller.js
Gunther Brunner b8b293d18a Update bower dependencies.
Update to latest bootstrap-ui 1.0.3.
Change Wifi settings button and behaviour of several tooltips accordingly.
Remove collapse elements since the animation breaks.
2016-01-14 20:48:38 +09:00

42 lines
946 B
JavaScript

module.exports = function DeviceSettingsCtrl($scope, $timeout) {
$scope.wifiEnabled = true
function getWifiStatus() {
if ($scope.control) {
$scope.control.getWifiStatus().then(function (result) {
$scope.$apply(function () {
$scope.wifiEnabled = (result.lastData === 'wifi_enabled')
})
})
}
}
getWifiStatus()
$scope.toggleWifi = function (enable) {
if ($scope.control) {
$scope.control.setWifiEnabled(enable)
$timeout(getWifiStatus, 2500)
}
}
$scope.$watch('ringerMode', function (newValue, oldValue) {
if (oldValue) {
if ($scope.control) {
$scope.control.setRingerMode(newValue)
}
}
})
function getRingerMode() {
if ($scope.control) {
$scope.control.getRingerMode().then(function (result) {
$scope.$apply(function () {
$scope.ringerMode = result.body
})
})
}
}
getRingerMode()
}