From d6e7d6158c6b574dd778ae0e254a18c6e98f06c3 Mon Sep 17 00:00:00 2001 From: Brandon Presley Date: Wed, 28 Dec 2022 14:56:29 +1300 Subject: [PATCH] Make sure alarms aren't on with app being optimized If battery optimizations are on for the app, alarms will have several unpredictable bugs. For example, sometimes sounds won't play, sometimes re focuisng the app won't work. --- SettingsPage.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/SettingsPage.tsx b/SettingsPage.tsx index 0f267d6..2cdbfc9 100644 --- a/SettingsPage.tsx +++ b/SettingsPage.tsx @@ -58,9 +58,12 @@ export default function SettingsPage() { setDate(settings.date) setShowDate(settings.showDate) setNoSound(settings.noSound) + if (Platform.OS !== 'android') return + NativeModules.SettingsModule.ignoringBattery((isIgnoring: boolean) => { + if (!isIgnoring && settings.alarm) setAlarm(false) + setIgnoring(isIgnoring) + }) }) - if (Platform.OS !== 'android') return - NativeModules.SettingsModule.ignoringBattery(setIgnoring) NativeModules.SettingsModule.is24().then((is24: boolean) => { console.log(`${SettingsPage.name}.focus:`, {is24}) if (is24) setFormatOptions(['P', 'P, k:m', 'ccc k:m', 'k:m'])