Browse Source

Updated settings default screen

Arnaud Vergnet 4 years ago
parent
commit
4c4f968e25
1 changed files with 12 additions and 21 deletions
  1. 12
    21
      src/screens/Other/SettingsScreen.js

+ 12
- 21
src/screens/Other/SettingsScreen.js View File

33
         startScreenPickerSelected: AsyncStorageManager.getInstance().preferences.defaultStartScreen.current,
33
         startScreenPickerSelected: AsyncStorageManager.getInstance().preferences.defaultStartScreen.current,
34
     };
34
     };
35
 
35
 
36
-    onProxiwashNotifPickerValueChange: Function;
37
-    onStartScreenPickerValueChange: Function;
38
-    onToggleNightMode: Function;
39
-    onToggleNightModeFollowSystem: Function;
40
-
41
     constructor() {
36
     constructor() {
42
         super();
37
         super();
43
-        this.onProxiwashNotifPickerValueChange = this.onProxiwashNotifPickerValueChange.bind(this);
44
-        this.onStartScreenPickerValueChange = this.onStartScreenPickerValueChange.bind(this);
45
-        this.onToggleNightMode = this.onToggleNightMode.bind(this);
46
-        this.onToggleNightModeFollowSystem = this.onToggleNightModeFollowSystem.bind(this);
47
     }
38
     }
48
 
39
 
49
     /**
40
     /**
51
      *
42
      *
52
      * @param value The value to store
43
      * @param value The value to store
53
      */
44
      */
54
-    onProxiwashNotifPickerValueChange(value: string) {
45
+    onProxiwashNotifPickerValueChange = (value: string) => {
55
         if (value != null) {
46
         if (value != null) {
56
             let key = AsyncStorageManager.getInstance().preferences.proxiwashNotifications.key;
47
             let key = AsyncStorageManager.getInstance().preferences.proxiwashNotifications.key;
57
             AsyncStorageManager.getInstance().savePref(key, value);
48
             AsyncStorageManager.getInstance().savePref(key, value);
63
                 intVal = parseInt(value);
54
                 intVal = parseInt(value);
64
             setMachineReminderNotificationTime(intVal);
55
             setMachineReminderNotificationTime(intVal);
65
         }
56
         }
66
-    }
57
+    };
67
 
58
 
68
     /**
59
     /**
69
      * Saves the value for the proxiwash reminder notification time
60
      * Saves the value for the proxiwash reminder notification time
70
      *
61
      *
71
      * @param value The value to store
62
      * @param value The value to store
72
      */
63
      */
73
-    onStartScreenPickerValueChange(value: string) {
64
+    onStartScreenPickerValueChange = (value: string) => {
74
         if (value != null) {
65
         if (value != null) {
75
             let key = AsyncStorageManager.getInstance().preferences.defaultStartScreen.key;
66
             let key = AsyncStorageManager.getInstance().preferences.defaultStartScreen.key;
76
             AsyncStorageManager.getInstance().savePref(key, value);
67
             AsyncStorageManager.getInstance().savePref(key, value);
78
                 startScreenPickerSelected: value
69
                 startScreenPickerSelected: value
79
             });
70
             });
80
         }
71
         }
81
-    }
72
+    };
82
 
73
 
83
     /**
74
     /**
84
      * Returns a picker allowing the user to select the proxiwash reminder notification time
75
      * Returns a picker allowing the user to select the proxiwash reminder notification time
111
                 value={this.state.startScreenPickerSelected}
102
                 value={this.state.startScreenPickerSelected}
112
                 style={{marginLeft: 'auto', marginRight: 'auto'}}
103
                 style={{marginLeft: 'auto', marginRight: 'auto'}}
113
             >
104
             >
114
-                <ToggleButton icon="shopping" value="proximo"/>
115
-                <ToggleButton icon="calendar-range" value="planning"/>
105
+                <ToggleButton icon="account-circle" value="services"/>
106
+                <ToggleButton icon="tshirt-crew" value="proxiwash"/>
116
                 <ToggleButton icon="triangle" value="home"/>
107
                 <ToggleButton icon="triangle" value="home"/>
117
-                <ToggleButton icon="washing-machine" value="proxiwash"/>
118
-                <ToggleButton icon="timetable" value="planex"/>
108
+                <ToggleButton icon="calendar-range" value="planning"/>
109
+                <ToggleButton icon="clock" value="planex"/>
119
             </ToggleButton.Row>
110
             </ToggleButton.Row>
120
         );
111
         );
121
     }
112
     }
123
     /**
114
     /**
124
      * Toggles night mode and saves it to preferences
115
      * Toggles night mode and saves it to preferences
125
      */
116
      */
126
-    onToggleNightMode() {
117
+    onToggleNightMode = () => {
127
         ThemeManager.getInstance().setNightMode(!this.state.nightMode);
118
         ThemeManager.getInstance().setNightMode(!this.state.nightMode);
128
         this.setState({nightMode: !this.state.nightMode});
119
         this.setState({nightMode: !this.state.nightMode});
129
-    }
120
+    };
130
 
121
 
131
-    onToggleNightModeFollowSystem() {
122
+    onToggleNightModeFollowSystem = () => {
132
         const value = !this.state.nightModeFollowSystem;
123
         const value = !this.state.nightModeFollowSystem;
133
         this.setState({nightModeFollowSystem: value});
124
         this.setState({nightModeFollowSystem: value});
134
         let key = AsyncStorageManager.getInstance().preferences.nightModeFollowSystem.key;
125
         let key = AsyncStorageManager.getInstance().preferences.nightModeFollowSystem.key;
138
             ThemeManager.getInstance().setNightMode(nightMode);
129
             ThemeManager.getInstance().setNightMode(nightMode);
139
             this.setState({nightMode: nightMode});
130
             this.setState({nightMode: nightMode});
140
         }
131
         }
141
-    }
132
+    };
142
 
133
 
143
     /**
134
     /**
144
      * Gets a list item using a checkbox control
135
      * Gets a list item using a checkbox control

Loading…
Cancel
Save