diff --git a/SettingsPage.tsx b/SettingsPage.tsx index 5efe12c..6e0a946 100644 --- a/SettingsPage.tsx +++ b/SettingsPage.tsx @@ -28,7 +28,7 @@ export default function SettingsPage() { setAlarmEnabled((await getItem('alarmEnabled')) === 'true'); setPredictiveSets((await getItem('predictiveSets')) === 'true'); setMaxSets((await getItem('maxSets')) || ''); - NativeModules.AlarmModule.ignoringBatteryOptimizations(setIgnoring); + NativeModules.AlarmModule.ignoringBattery(setIgnoring); }, []); useEffect(() => { @@ -105,7 +105,7 @@ export default function SettingsPage() { show={showBattery} setShow={setShowBattery} onOk={() => { - NativeModules.AlarmModule.openBatteryOptimizations(); + NativeModules.AlarmModule.openSettings(); setShowBattery(false); }}> Disable battery optimizations for Massive to use rest timers. diff --git a/android/app/src/main/java/com/massive/AlarmModule.kt b/android/app/src/main/java/com/massive/AlarmModule.kt index 43280ae..75127e6 100644 --- a/android/app/src/main/java/com/massive/AlarmModule.kt +++ b/android/app/src/main/java/com/massive/AlarmModule.kt @@ -32,7 +32,7 @@ class AlarmModule internal constructor(context: ReactApplicationContext?) : @RequiresApi(Build.VERSION_CODES.M) @ReactMethod - fun ignoringBatteryOptimizations(callback: Callback) { + fun ignoringBattery(callback: Callback) { val packageName = reactApplicationContext.packageName val pm = reactApplicationContext.getSystemService(Context.POWER_SERVICE) as PowerManager @@ -45,7 +45,7 @@ class AlarmModule internal constructor(context: ReactApplicationContext?) : @RequiresApi(Build.VERSION_CODES.M) @ReactMethod - fun openBatteryOptimizations() { + fun openSettings() { val intent = Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS) intent.data = Uri.parse("package:" + reactApplicationContext.packageName) intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK