forked from Blendman974/faceclaw
iOS porting: Battery indicators, app icon, add the rest of the apps
This commit is contained in:
1 parent
00a5e38f75
commit
e5ba7abc18
31 files changed
+501
-65
No files matched your search
@@ -8,6 +8,15 @@ export type PhoneBatteryState = {
|
||||
};
|
||||
|
||||
export function readPhoneBatteryState(): PhoneBatteryState {
|
||||
if (global.isIOS) {
|
||||
const device = UIDevice.currentDevice
|
||||
const level = device.batteryLevel
|
||||
const state = device.batteryState
|
||||
return {
|
||||
battery: level >= 0 ? Math.round(level * 100) : null,
|
||||
charging: state === UIDeviceBatteryState.Unknown ? null : state === UIDeviceBatteryState.Charging || state === UIDeviceBatteryState.Full,
|
||||
}
|
||||
}
|
||||
if (!global.isAndroid) {
|
||||
return { battery: null, charging: null };
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user