Browse Source

Updated settings default screen

Arnaud Vergnet 3 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,17 +33,8 @@ export default class SettingsScreen extends React.Component<Props, State> {
33 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 36
     constructor() {
42 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,7 +42,7 @@ export default class SettingsScreen extends React.Component<Props, State> {
51 42
      *
52 43
      * @param value The value to store
53 44
      */
54
-    onProxiwashNotifPickerValueChange(value: string) {
45
+    onProxiwashNotifPickerValueChange = (value: string) => {
55 46
         if (value != null) {
56 47
             let key = AsyncStorageManager.getInstance().preferences.proxiwashNotifications.key;
57 48
             AsyncStorageManager.getInstance().savePref(key, value);
@@ -63,14 +54,14 @@ export default class SettingsScreen extends React.Component<Props, State> {
63 54
                 intVal = parseInt(value);
64 55
             setMachineReminderNotificationTime(intVal);
65 56
         }
66
-    }
57
+    };
67 58
 
68 59
     /**
69 60
      * Saves the value for the proxiwash reminder notification time
70 61
      *
71 62
      * @param value The value to store
72 63
      */
73
-    onStartScreenPickerValueChange(value: string) {
64
+    onStartScreenPickerValueChange = (value: string) => {
74 65
         if (value != null) {
75 66
             let key = AsyncStorageManager.getInstance().preferences.defaultStartScreen.key;
76 67
             AsyncStorageManager.getInstance().savePref(key, value);
@@ -78,7 +69,7 @@ export default class SettingsScreen extends React.Component<Props, State> {
78 69
                 startScreenPickerSelected: value
79 70
             });
80 71
         }
81
-    }
72
+    };
82 73
 
83 74
     /**
84 75
      * Returns a picker allowing the user to select the proxiwash reminder notification time
@@ -111,11 +102,11 @@ export default class SettingsScreen extends React.Component<Props, State> {
111 102
                 value={this.state.startScreenPickerSelected}
112 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 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 110
             </ToggleButton.Row>
120 111
         );
121 112
     }
@@ -123,12 +114,12 @@ export default class SettingsScreen extends React.Component<Props, State> {
123 114
     /**
124 115
      * Toggles night mode and saves it to preferences
125 116
      */
126
-    onToggleNightMode() {
117
+    onToggleNightMode = () => {
127 118
         ThemeManager.getInstance().setNightMode(!this.state.nightMode);
128 119
         this.setState({nightMode: !this.state.nightMode});
129
-    }
120
+    };
130 121
 
131
-    onToggleNightModeFollowSystem() {
122
+    onToggleNightModeFollowSystem = () => {
132 123
         const value = !this.state.nightModeFollowSystem;
133 124
         this.setState({nightModeFollowSystem: value});
134 125
         let key = AsyncStorageManager.getInstance().preferences.nightModeFollowSystem.key;
@@ -138,7 +129,7 @@ export default class SettingsScreen extends React.Component<Props, State> {
138 129
             ThemeManager.getInstance().setNightMode(nightMode);
139 130
             this.setState({nightMode: nightMode});
140 131
         }
141
-    }
132
+    };
142 133
 
143 134
     /**
144 135
      * Gets a list item using a checkbox control

Loading…
Cancel
Save