mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-20 07:53:38 +02:00
Added Ringer Mode Setting UI.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
module.exports = function DeviceSettingsCtrl($scope, $timeout) {
|
||||
$scope.wifiEnabled = true
|
||||
|
||||
var getWifiStatus = function () {
|
||||
function getWifiStatus() {
|
||||
if ($scope.control) {
|
||||
$scope.control.getWifiStatus().then(function (result) {
|
||||
$scope.$apply(function () {
|
||||
@@ -9,7 +9,6 @@ module.exports = function DeviceSettingsCtrl($scope, $timeout) {
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
getWifiStatus()
|
||||
|
||||
@@ -17,7 +16,28 @@ module.exports = function DeviceSettingsCtrl($scope, $timeout) {
|
||||
if ($scope.control) {
|
||||
$scope.control.setWifiEnabled(!$scope.wifiEnabled)
|
||||
$scope.wifiEnabled = !$scope.wifiEnabled
|
||||
$timeout(getWifiStatus, 500)
|
||||
$timeout(getWifiStatus, 300)
|
||||
$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()
|
||||
|
||||
}
|
||||
|
||||
@@ -6,5 +6,21 @@
|
||||
|
||||
button.btn.btn-sm.btn-primary-outline(ng-click='toggleWifi()',
|
||||
ng-model='wifiEnabled', btn-checkbox)
|
||||
i.fa.fa-signal(ng-show='wifiEnabled', tooltip='{{"Disable WiFi" | translate}}', tooltip-placement='bottom')
|
||||
i.fa.fa-signal(ng-hide='wifiEnabled', tooltip='{{"Enable WiFi" | translate}}', tooltip-placement='bottom')
|
||||
i.fa.fa-signal.fa-fw(ng-show='wifiEnabled', tooltip='{{"Disable WiFi" | translate}}')
|
||||
i.fa.fa-signal.fa-fw(ng-hide='wifiEnabled', tooltip='{{"Enable WiFi" | translate}}')
|
||||
|
||||
//.btn-group
|
||||
label.btn.btn-sm.btn-primary-outline(ng-model='wifiEnabled', btn-radio='false')
|
||||
span.fa-stack.fa-lgx
|
||||
i.fa.fa-signal.fa-stack-1x
|
||||
i.fa.fa-ban.fa-stack-2x
|
||||
label.btn.btn-sm.btn-primary-outline(ng-model='wifiEnabled', btn-radio='true')
|
||||
i.fa.fa-signal.fa-fw(tooltip='{{"WiFi Enabled" | translate}}')
|
||||
|
||||
.btn-group
|
||||
label.btn.btn-sm.btn-primary-outline(ng-model='ringerMode', btn-radio='"SILENT"')
|
||||
i.fa.fa-volume-off.fa-fw(tooltip='{{"Silent Mode" | translate}}')
|
||||
label.btn.btn-sm.btn-primary-outline(ng-model='ringerMode', btn-radio='"VIBRATE"')
|
||||
i.fa.fa-mobile.fa-fw(tooltip='{{"Vibrate Mode" | translate}}')
|
||||
label.btn.btn-sm.btn-primary-outline(ng-model='ringerMode', btn-radio='"NORMAL"')
|
||||
i.fa.fa-volume-up.fa-fw(tooltip='{{"Normal Mode" | translate}}')
|
||||
|
||||
Reference in New Issue
Block a user