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');
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.

View File

@ -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