Refactor querying the battery percentage into a regular sysprop

This commit is contained in:
Henrik Rydgård committed 2025-02-11 10:31:18 -06:00
1 parent 57a91e1f74
commit ee772bb1e2
8 files changed
+33 -48

No files matched your search

+7
View File
@@ -316,6 +316,8 @@ std::vector<std::string> System_GetPropertyStringVec(SystemProperty prop) {
}
}
int Apple_GetCurrentBatteryCapacity();
int64_t System_GetPropertyInt(SystemProperty prop) {
switch (prop) {
case SYSPROP_AUDIO_SAMPLE_RATE:
@@ -324,6 +326,8 @@ int64_t System_GetPropertyInt(SystemProperty prop) {
return DEVICE_TYPE_MOBILE;
case SYSPROP_SYSTEMVERSION:
return g_iosVersionMajor;
case SYSPROP_BATTERY_PERCENTAGE:
return Apple_GetCurrentBatteryCapacity();
default:
return -1;
}
@@ -381,6 +385,9 @@ bool System_GetPropertyBool(SystemProperty prop) {
case SYSPROP_SUPPORTS_HTTPS:
return true;
#endif
case SYSPROP_CAN_READ_BATTERY_PERCENTAGE:
return true;
default:
return false;
}