From 97d84d92f5534d6623596eb303a73fc243bad392 Mon Sep 17 00:00:00 2001 From: keplyx Date: Sun, 8 Mar 2020 13:57:09 +0100 Subject: [PATCH] Prevent unselecting machine reminder value --- screens/SettingsScreen.js | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/screens/SettingsScreen.js b/screens/SettingsScreen.js index 614d71a..47e36f1 100644 --- a/screens/SettingsScreen.js +++ b/screens/SettingsScreen.js @@ -45,15 +45,17 @@ export default class SettingsScreen extends React.Component { * @param value The value to store */ onProxiwashNotifPickerValueChange(value: string) { - let key = AsyncStorageManager.getInstance().preferences.proxiwashNotifications.key; - AsyncStorageManager.getInstance().savePref(key, value); - this.setState({ - proxiwashNotifPickerSelected: value - }); - let intVal = 0; - if (value !== 'never') - intVal = parseInt(value); - NotificationsManager.setMachineReminderNotificationTime(intVal); + if (value != null) { + let key = AsyncStorageManager.getInstance().preferences.proxiwashNotifications.key; + AsyncStorageManager.getInstance().savePref(key, value); + this.setState({ + proxiwashNotifPickerSelected: value + }); + let intVal = 0; + if (value !== 'never') + intVal = parseInt(value); + NotificationsManager.setMachineReminderNotificationTime(intVal); + } } /**