Shorten method names in AlarmModule

This commit is contained in:
Brandon Presley 2022-07-19 16:38:58 +12:00
parent 65f6eaff57
commit 839d872c1c
2 changed files with 4 additions and 4 deletions

View File

@ -28,7 +28,7 @@ export default function SettingsPage() {
setAlarmEnabled((await getItem('alarmEnabled')) === 'true'); setAlarmEnabled((await getItem('alarmEnabled')) === 'true');
setPredictiveSets((await getItem('predictiveSets')) === 'true'); setPredictiveSets((await getItem('predictiveSets')) === 'true');
setMaxSets((await getItem('maxSets')) || ''); setMaxSets((await getItem('maxSets')) || '');
NativeModules.AlarmModule.ignoringBatteryOptimizations(setIgnoring); NativeModules.AlarmModule.ignoringBattery(setIgnoring);
}, []); }, []);
useEffect(() => { useEffect(() => {
@ -105,7 +105,7 @@ export default function SettingsPage() {
show={showBattery} show={showBattery}
setShow={setShowBattery} setShow={setShowBattery}
onOk={() => { onOk={() => {
NativeModules.AlarmModule.openBatteryOptimizations(); NativeModules.AlarmModule.openSettings();
setShowBattery(false); setShowBattery(false);
}}> }}>
Disable battery optimizations for Massive to use rest timers. Disable battery optimizations for Massive to use rest timers.

View File

@ -32,7 +32,7 @@ class AlarmModule internal constructor(context: ReactApplicationContext?) :
@RequiresApi(Build.VERSION_CODES.M) @RequiresApi(Build.VERSION_CODES.M)
@ReactMethod @ReactMethod
fun ignoringBatteryOptimizations(callback: Callback) { fun ignoringBattery(callback: Callback) {
val packageName = reactApplicationContext.packageName val packageName = reactApplicationContext.packageName
val pm = val pm =
reactApplicationContext.getSystemService(Context.POWER_SERVICE) as PowerManager reactApplicationContext.getSystemService(Context.POWER_SERVICE) as PowerManager
@ -45,7 +45,7 @@ class AlarmModule internal constructor(context: ReactApplicationContext?) :
@RequiresApi(Build.VERSION_CODES.M) @RequiresApi(Build.VERSION_CODES.M)
@ReactMethod @ReactMethod
fun openBatteryOptimizations() { fun openSettings() {
val intent = Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS) val intent = Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS)
intent.data = Uri.parse("package:" + reactApplicationContext.packageName) intent.data = Uri.parse("package:" + reactApplicationContext.packageName)
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK