1
0
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:
Cong Luan Tran
2026-05-26 22:22:39 +07:00
committed by GitHub
parent 97666dc73d
commit 60b64f22c6
+4 -7
View File
@@ -236,19 +236,16 @@ Singleton {
readonly property bool suggestPowerSaver: false
readonly property var bluetoothDevices: {
const btDevices = [];
const bluetoothTypes = [UPowerDeviceType.BluetoothGeneric, UPowerDeviceType.Headphones, UPowerDeviceType.Headset, UPowerDeviceType.Keyboard, UPowerDeviceType.Mouse, UPowerDeviceType.Speakers];
for (var i = 0; i < UPower.devices.count; i++) {
const dev = UPower.devices.get(i);
if (dev && dev.ready && bluetoothTypes.includes(dev.type)) {
btDevices.push({
const btDevices = UPower.devices.values.filter(dev => dev && dev.ready && bluetoothTypes.includes(dev.type)).map(dev => {
return {
"name": dev.model || UPowerDeviceType.toString(dev.type),
"percentage": Math.round(dev.percentage * 100),
"type": dev.type
};
});
}
}
return btDevices;
}