mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-06-07 19:59:14 -04:00
fix(BatteryService): Make bluetoothBattery detection actually work (#2486)
This commit is contained in:
@@ -236,19 +236,16 @@ Singleton {
|
|||||||
readonly property bool suggestPowerSaver: false
|
readonly property bool suggestPowerSaver: false
|
||||||
|
|
||||||
readonly property var bluetoothDevices: {
|
readonly property var bluetoothDevices: {
|
||||||
const btDevices = [];
|
|
||||||
const bluetoothTypes = [UPowerDeviceType.BluetoothGeneric, UPowerDeviceType.Headphones, UPowerDeviceType.Headset, UPowerDeviceType.Keyboard, UPowerDeviceType.Mouse, UPowerDeviceType.Speakers];
|
const bluetoothTypes = [UPowerDeviceType.BluetoothGeneric, UPowerDeviceType.Headphones, UPowerDeviceType.Headset, UPowerDeviceType.Keyboard, UPowerDeviceType.Mouse, UPowerDeviceType.Speakers];
|
||||||
|
|
||||||
for (var i = 0; i < UPower.devices.count; i++) {
|
const btDevices = UPower.devices.values.filter(dev => dev && dev.ready && bluetoothTypes.includes(dev.type)).map(dev => {
|
||||||
const dev = UPower.devices.get(i);
|
return {
|
||||||
if (dev && dev.ready && bluetoothTypes.includes(dev.type)) {
|
|
||||||
btDevices.push({
|
|
||||||
"name": dev.model || UPowerDeviceType.toString(dev.type),
|
"name": dev.model || UPowerDeviceType.toString(dev.type),
|
||||||
"percentage": Math.round(dev.percentage * 100),
|
"percentage": Math.round(dev.percentage * 100),
|
||||||
"type": dev.type
|
"type": dev.type
|
||||||
|
};
|
||||||
});
|
});
|
||||||
}
|
|
||||||
}
|
|
||||||
return btDevices;
|
return btDevices;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user