Compare commits
No commits in common. "6254ce18140fafe7bad5a7f6b89972a62c6982dc" and "7dd91574a57e1a386f32d0e2f28c54ede5f8ec2c" have entirely different histories.
6254ce1814
...
7dd91574a5
21 changed files with 267 additions and 259 deletions
18
App.js
18
App.js
|
|
@ -56,6 +56,7 @@ export default class App extends React.Component<Props, State> {
|
||||||
createDrawerNavigator: () => React.Node;
|
createDrawerNavigator: () => React.Node;
|
||||||
|
|
||||||
urlHandler: URLHandler;
|
urlHandler: URLHandler;
|
||||||
|
storageManager: AsyncStorageManager;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
|
|
@ -63,6 +64,7 @@ export default class App extends React.Component<Props, State> {
|
||||||
this.navigatorRef = React.createRef();
|
this.navigatorRef = React.createRef();
|
||||||
this.defaultHomeRoute = null;
|
this.defaultHomeRoute = null;
|
||||||
this.defaultHomeData = {};
|
this.defaultHomeData = {};
|
||||||
|
this.storageManager = AsyncStorageManager.getInstance();
|
||||||
this.urlHandler = new URLHandler(this.onInitialURLParsed, this.onDetectURL);
|
this.urlHandler = new URLHandler(this.onInitialURLParsed, this.onDetectURL);
|
||||||
this.urlHandler.listen();
|
this.urlHandler.listen();
|
||||||
setSafeBounceHeight(Platform.OS === 'ios' ? 100 : 20);
|
setSafeBounceHeight(Platform.OS === 'ios' ? 100 : 20);
|
||||||
|
|
@ -131,9 +133,9 @@ export default class App extends React.Component<Props, State> {
|
||||||
showUpdate: false,
|
showUpdate: false,
|
||||||
showAprilFools: false,
|
showAprilFools: false,
|
||||||
});
|
});
|
||||||
AsyncStorageManager.set(AsyncStorageManager.PREFERENCES.showIntro.key, false);
|
this.storageManager.savePref(this.storageManager.preferences.showIntro.key, '0');
|
||||||
AsyncStorageManager.set(AsyncStorageManager.PREFERENCES.updateNumber.key, Update.number);
|
this.storageManager.savePref(this.storageManager.preferences.updateNumber.key, Update.number.toString());
|
||||||
AsyncStorageManager.set(AsyncStorageManager.PREFERENCES.showAprilFoolsStart.key, false);
|
this.storageManager.savePref(this.storageManager.preferences.showAprilFoolsStart.key, '0');
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -142,7 +144,7 @@ export default class App extends React.Component<Props, State> {
|
||||||
* @returns {Promise<void>}
|
* @returns {Promise<void>}
|
||||||
*/
|
*/
|
||||||
loadAssetsAsync = async () => {
|
loadAssetsAsync = async () => {
|
||||||
await AsyncStorageManager.getInstance().loadPreferences();
|
await this.storageManager.loadPreferences();
|
||||||
try {
|
try {
|
||||||
await ConnectionManager.getInstance().recoverLogin();
|
await ConnectionManager.getInstance().recoverLogin();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
@ -167,11 +169,9 @@ export default class App extends React.Component<Props, State> {
|
||||||
this.setState({
|
this.setState({
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
currentTheme: ThemeManager.getCurrentTheme(),
|
currentTheme: ThemeManager.getCurrentTheme(),
|
||||||
showIntro: AsyncStorageManager.getBool(AsyncStorageManager.PREFERENCES.showIntro.key),
|
showIntro: this.storageManager.preferences.showIntro.current === '1',
|
||||||
showUpdate: AsyncStorageManager.getNumber(AsyncStorageManager.PREFERENCES.updateNumber.key)
|
showUpdate: this.storageManager.preferences.updateNumber.current !== Update.number.toString(),
|
||||||
!== Update.number,
|
showAprilFools: AprilFoolsManager.getInstance().isAprilFoolsEnabled() && this.storageManager.preferences.showAprilFoolsStart.current === '1',
|
||||||
showAprilFools: AprilFoolsManager.getInstance().isAprilFoolsEnabled()
|
|
||||||
&& AsyncStorageManager.getBool(AsyncStorageManager.PREFERENCES.showAprilFoolsStart.key),
|
|
||||||
});
|
});
|
||||||
SplashScreen.hide();
|
SplashScreen.hide();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -377,7 +377,6 @@
|
||||||
"pause": "Game Paused",
|
"pause": "Game Paused",
|
||||||
"pauseMessage": "The game is paused",
|
"pauseMessage": "The game is paused",
|
||||||
"resume": "Resume",
|
"resume": "Resume",
|
||||||
"gameOver": "Game Over",
|
|
||||||
"restart": {
|
"restart": {
|
||||||
"text": "Restart",
|
"text": "Restart",
|
||||||
"confirm": "Are you sure you want to restart?",
|
"confirm": "Are you sure you want to restart?",
|
||||||
|
|
@ -385,6 +384,13 @@
|
||||||
"confirmYes": "Yes",
|
"confirmYes": "Yes",
|
||||||
"confirmNo": "No"
|
"confirmNo": "No"
|
||||||
},
|
},
|
||||||
|
"gameOver": {
|
||||||
|
"text": "Game Over",
|
||||||
|
"score": "Score: ",
|
||||||
|
"level": "Level: ",
|
||||||
|
"time": "Time: ",
|
||||||
|
"exit": "leave Game"
|
||||||
|
},
|
||||||
"mascotDialog": {
|
"mascotDialog": {
|
||||||
"title": "Play !",
|
"title": "Play !",
|
||||||
"message": "Play.",
|
"message": "Play.",
|
||||||
|
|
|
||||||
|
|
@ -376,7 +376,6 @@
|
||||||
"pause": "Pause",
|
"pause": "Pause",
|
||||||
"pauseMessage": "T'as fait pause, t'es nul",
|
"pauseMessage": "T'as fait pause, t'es nul",
|
||||||
"resume": "Continuer",
|
"resume": "Continuer",
|
||||||
"gameOver": "Game Over",
|
|
||||||
"restart": {
|
"restart": {
|
||||||
"text": "Redémarrer",
|
"text": "Redémarrer",
|
||||||
"confirm": "T'es sûr de vouloir redémarrer ?",
|
"confirm": "T'es sûr de vouloir redémarrer ?",
|
||||||
|
|
@ -384,10 +383,17 @@
|
||||||
"confirmYes": "Oui",
|
"confirmYes": "Oui",
|
||||||
"confirmNo": "Oula non"
|
"confirmNo": "Oula non"
|
||||||
},
|
},
|
||||||
|
"gameOver": {
|
||||||
|
"text": "Game Over",
|
||||||
|
"score": "Score: ",
|
||||||
|
"level": "Niveau: ",
|
||||||
|
"time": "Temps: ",
|
||||||
|
"exit": "Quitter"
|
||||||
|
},
|
||||||
"mascotDialog": {
|
"mascotDialog": {
|
||||||
"title": "Un secret !",
|
"title": "Jeu !",
|
||||||
"message": "Tu as découvert le jeu secret, bravo !\nSi jamais tu as du temps à perdre, ce jeu est là pour toi.",
|
"message": "Jouer.",
|
||||||
"button": "Youpi."
|
"button": "Oui !"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"debug": {
|
"debug": {
|
||||||
|
|
|
||||||
|
|
@ -13,109 +13,6 @@ export default class AsyncStorageManager {
|
||||||
|
|
||||||
static instance: AsyncStorageManager | null = null;
|
static instance: AsyncStorageManager | null = null;
|
||||||
|
|
||||||
static PREFERENCES = {
|
|
||||||
debugUnlocked: {
|
|
||||||
key: 'debugUnlocked',
|
|
||||||
default: '0',
|
|
||||||
},
|
|
||||||
showIntro: {
|
|
||||||
key: 'showIntro',
|
|
||||||
default: '1',
|
|
||||||
},
|
|
||||||
updateNumber: {
|
|
||||||
key: 'updateNumber',
|
|
||||||
default: '0',
|
|
||||||
},
|
|
||||||
proxiwashNotifications: {
|
|
||||||
key: 'proxiwashNotifications',
|
|
||||||
default: '5',
|
|
||||||
},
|
|
||||||
nightModeFollowSystem: {
|
|
||||||
key: 'nightModeFollowSystem',
|
|
||||||
default: '1',
|
|
||||||
},
|
|
||||||
nightMode: {
|
|
||||||
key: 'nightMode',
|
|
||||||
default: '1',
|
|
||||||
},
|
|
||||||
defaultStartScreen: {
|
|
||||||
key: 'defaultStartScreen',
|
|
||||||
default: 'home',
|
|
||||||
},
|
|
||||||
servicesShowBanner: {
|
|
||||||
key: 'servicesShowBanner',
|
|
||||||
default: '1',
|
|
||||||
},
|
|
||||||
proxiwashShowBanner: {
|
|
||||||
key: 'proxiwashShowBanner',
|
|
||||||
default: '1',
|
|
||||||
},
|
|
||||||
homeShowBanner: {
|
|
||||||
key: 'homeShowBanner',
|
|
||||||
default: '1',
|
|
||||||
},
|
|
||||||
eventsShowBanner: {
|
|
||||||
key: 'eventsShowBanner',
|
|
||||||
default: '1',
|
|
||||||
},
|
|
||||||
planexShowBanner: {
|
|
||||||
key: 'planexShowBanner',
|
|
||||||
default: '1',
|
|
||||||
},
|
|
||||||
loginShowBanner: {
|
|
||||||
key: 'loginShowBanner',
|
|
||||||
default: '1',
|
|
||||||
},
|
|
||||||
voteShowBanner: {
|
|
||||||
key: 'voteShowBanner',
|
|
||||||
default: '1',
|
|
||||||
},
|
|
||||||
equipmentShowBanner: {
|
|
||||||
key: 'equipmentShowBanner',
|
|
||||||
default: '1',
|
|
||||||
},
|
|
||||||
gameStartShowBanner: {
|
|
||||||
key: 'gameStartShowBanner',
|
|
||||||
default: '1',
|
|
||||||
},
|
|
||||||
proxiwashWatchedMachines: {
|
|
||||||
key: 'proxiwashWatchedMachines',
|
|
||||||
default: '[]',
|
|
||||||
},
|
|
||||||
showAprilFoolsStart: {
|
|
||||||
key: 'showAprilFoolsStart',
|
|
||||||
default: '1',
|
|
||||||
},
|
|
||||||
planexCurrentGroup: {
|
|
||||||
key: 'planexCurrentGroup',
|
|
||||||
default: '',
|
|
||||||
},
|
|
||||||
planexFavoriteGroups: {
|
|
||||||
key: 'planexFavoriteGroups',
|
|
||||||
default: '[]',
|
|
||||||
},
|
|
||||||
dashboardItems: {
|
|
||||||
key: 'dashboardItems',
|
|
||||||
default: JSON.stringify([
|
|
||||||
SERVICES_KEY.EMAIL,
|
|
||||||
SERVICES_KEY.WASHERS,
|
|
||||||
SERVICES_KEY.PROXIMO,
|
|
||||||
SERVICES_KEY.TUTOR_INSA,
|
|
||||||
SERVICES_KEY.RU,
|
|
||||||
]),
|
|
||||||
},
|
|
||||||
gameScores: {
|
|
||||||
key: 'gameScores',
|
|
||||||
default: '[]',
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
#currentPreferences: {[key: string]: string};
|
|
||||||
|
|
||||||
constructor() {
|
|
||||||
this.#currentPreferences = {};
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get this class instance or create one if none is found
|
* Get this class instance or create one if none is found
|
||||||
* @returns {AsyncStorageManager}
|
* @returns {AsyncStorageManager}
|
||||||
|
|
@ -126,6 +23,126 @@ export default class AsyncStorageManager {
|
||||||
AsyncStorageManager.instance;
|
AsyncStorageManager.instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Object storing preferences keys, default and current values for use in the app
|
||||||
|
preferences = {
|
||||||
|
debugUnlocked: {
|
||||||
|
key: 'debugUnlocked',
|
||||||
|
default: '0',
|
||||||
|
current: '',
|
||||||
|
},
|
||||||
|
showIntro: {
|
||||||
|
key: 'showIntro',
|
||||||
|
default: '1',
|
||||||
|
current: '',
|
||||||
|
},
|
||||||
|
updateNumber: {
|
||||||
|
key: 'updateNumber',
|
||||||
|
default: '0',
|
||||||
|
current: '',
|
||||||
|
},
|
||||||
|
proxiwashNotifications: {
|
||||||
|
key: 'proxiwashNotifications',
|
||||||
|
default: '5',
|
||||||
|
current: '',
|
||||||
|
},
|
||||||
|
nightModeFollowSystem: {
|
||||||
|
key: 'nightModeFollowSystem',
|
||||||
|
default: '1',
|
||||||
|
current: '',
|
||||||
|
},
|
||||||
|
nightMode: {
|
||||||
|
key: 'nightMode',
|
||||||
|
default: '1',
|
||||||
|
current: '',
|
||||||
|
},
|
||||||
|
defaultStartScreen: {
|
||||||
|
key: 'defaultStartScreen',
|
||||||
|
default: 'home',
|
||||||
|
current: '',
|
||||||
|
},
|
||||||
|
servicesShowBanner: {
|
||||||
|
key: 'servicesShowBanner',
|
||||||
|
default: '1',
|
||||||
|
current: '',
|
||||||
|
},
|
||||||
|
proxiwashShowBanner: {
|
||||||
|
key: 'proxiwashShowBanner',
|
||||||
|
default: '1',
|
||||||
|
current: '',
|
||||||
|
},
|
||||||
|
homeShowBanner: {
|
||||||
|
key: 'homeShowBanner',
|
||||||
|
default: '1',
|
||||||
|
current: '',
|
||||||
|
},
|
||||||
|
eventsShowBanner: {
|
||||||
|
key: 'eventsShowBanner',
|
||||||
|
default: '1',
|
||||||
|
current: '',
|
||||||
|
},
|
||||||
|
planexShowBanner: {
|
||||||
|
key: 'planexShowBanner',
|
||||||
|
default: '1',
|
||||||
|
current: '',
|
||||||
|
},
|
||||||
|
loginShowBanner: {
|
||||||
|
key: 'loginShowBanner',
|
||||||
|
default: '1',
|
||||||
|
current: '',
|
||||||
|
},
|
||||||
|
voteShowBanner: {
|
||||||
|
key: 'voteShowBanner',
|
||||||
|
default: '1',
|
||||||
|
current: '',
|
||||||
|
},
|
||||||
|
equipmentShowBanner: {
|
||||||
|
key: 'equipmentShowBanner',
|
||||||
|
default: '1',
|
||||||
|
current: '',
|
||||||
|
},
|
||||||
|
gameStartShowBanner: {
|
||||||
|
key: 'gameStartShowBanner',
|
||||||
|
default: '1',
|
||||||
|
current: '',
|
||||||
|
},
|
||||||
|
proxiwashWatchedMachines: {
|
||||||
|
key: 'proxiwashWatchedMachines',
|
||||||
|
default: '[]',
|
||||||
|
current: '',
|
||||||
|
},
|
||||||
|
showAprilFoolsStart: {
|
||||||
|
key: 'showAprilFoolsStart',
|
||||||
|
default: '1',
|
||||||
|
current: '',
|
||||||
|
},
|
||||||
|
planexCurrentGroup: {
|
||||||
|
key: 'planexCurrentGroup',
|
||||||
|
default: '',
|
||||||
|
current: '',
|
||||||
|
},
|
||||||
|
planexFavoriteGroups: {
|
||||||
|
key: 'planexFavoriteGroups',
|
||||||
|
default: '[]',
|
||||||
|
current: '',
|
||||||
|
},
|
||||||
|
dashboardItems: {
|
||||||
|
key: 'dashboardItems',
|
||||||
|
default: JSON.stringify([
|
||||||
|
SERVICES_KEY.EMAIL,
|
||||||
|
SERVICES_KEY.WASHERS,
|
||||||
|
SERVICES_KEY.PROXIMO,
|
||||||
|
SERVICES_KEY.TUTOR_INSA,
|
||||||
|
SERVICES_KEY.RU,
|
||||||
|
]),
|
||||||
|
current: '',
|
||||||
|
},
|
||||||
|
gameScores: {
|
||||||
|
key: 'gameScores',
|
||||||
|
default: '[]',
|
||||||
|
current: '',
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set preferences object current values from AsyncStorage.
|
* Set preferences object current values from AsyncStorage.
|
||||||
* This function should be called at the app's start.
|
* This function should be called at the app's start.
|
||||||
|
|
@ -135,8 +152,9 @@ export default class AsyncStorageManager {
|
||||||
async loadPreferences() {
|
async loadPreferences() {
|
||||||
let prefKeys = [];
|
let prefKeys = [];
|
||||||
// Get all available keys
|
// Get all available keys
|
||||||
for (let key in AsyncStorageManager.PREFERENCES) {
|
for (let [key, value] of Object.entries(this.preferences)) {
|
||||||
prefKeys.push(key);
|
//$FlowFixMe
|
||||||
|
prefKeys.push(value.key);
|
||||||
}
|
}
|
||||||
// Get corresponding values
|
// Get corresponding values
|
||||||
let resultArray: Array<Array<string>> = await AsyncStorage.multiGet(prefKeys);
|
let resultArray: Array<Array<string>> = await AsyncStorage.multiGet(prefKeys);
|
||||||
|
|
@ -145,92 +163,21 @@ export default class AsyncStorageManager {
|
||||||
let key: string = resultArray[i][0];
|
let key: string = resultArray[i][0];
|
||||||
let val: string | null = resultArray[i][1];
|
let val: string | null = resultArray[i][1];
|
||||||
if (val === null)
|
if (val === null)
|
||||||
val = AsyncStorageManager.PREFERENCES[key].default;
|
val = this.preferences[key].default;
|
||||||
this.#currentPreferences[key] = val;
|
this.preferences[key].current = val;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Saves the value associated to the given key to preferences.
|
* Save the value associated to the given key to preferences.
|
||||||
* This updates the preferences object and saves it to AsyncStorage.
|
* This updates the preferences object and saves it to AsyncStorage.
|
||||||
*
|
*
|
||||||
* @param key
|
* @param key
|
||||||
* @param value
|
* @param val
|
||||||
*/
|
*/
|
||||||
setPreference(key: string, value: any) {
|
savePref(key: string, val: string) {
|
||||||
if (AsyncStorageManager.PREFERENCES[key] != null) {
|
this.preferences[key].current = val;
|
||||||
let convertedValue = "";
|
AsyncStorage.setItem(key, val);
|
||||||
if (typeof value === "string")
|
|
||||||
convertedValue = value;
|
|
||||||
else if (typeof value === "boolean" || typeof value === "number")
|
|
||||||
convertedValue = value.toString();
|
|
||||||
else
|
|
||||||
convertedValue = JSON.stringify(value);
|
|
||||||
this.#currentPreferences[key] = convertedValue;
|
|
||||||
AsyncStorage.setItem(key, convertedValue);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the value at the given key.
|
|
||||||
* If the key is not available, returns null
|
|
||||||
*
|
|
||||||
* @param key
|
|
||||||
* @returns {string|null}
|
|
||||||
*/
|
|
||||||
getPreference(key: string) {
|
|
||||||
return this.#currentPreferences[key];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* aves the value associated to the given key to preferences.
|
|
||||||
*
|
|
||||||
* @param key
|
|
||||||
* @param value
|
|
||||||
*/
|
|
||||||
static set(key: string, value: any) {
|
|
||||||
AsyncStorageManager.getInstance().setPreference(key, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the string value of the given preference
|
|
||||||
*
|
|
||||||
* @param key
|
|
||||||
* @returns {boolean}
|
|
||||||
*/
|
|
||||||
static getString(key: string) {
|
|
||||||
return AsyncStorageManager.getInstance().getPreference(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the boolean value of the given preference
|
|
||||||
*
|
|
||||||
* @param key
|
|
||||||
* @returns {boolean}
|
|
||||||
*/
|
|
||||||
static getBool(key: string) {
|
|
||||||
const value = AsyncStorageManager.getString(key);
|
|
||||||
return value === "1" || value === "true";
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the number value of the given preference
|
|
||||||
*
|
|
||||||
* @param key
|
|
||||||
* @returns {boolean}
|
|
||||||
*/
|
|
||||||
static getNumber(key: string) {
|
|
||||||
return parseFloat(AsyncStorageManager.getString(key));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the object value of the given preference
|
|
||||||
*
|
|
||||||
* @param key
|
|
||||||
* @returns {boolean}
|
|
||||||
*/
|
|
||||||
static getObject(key: string) {
|
|
||||||
return JSON.parse(AsyncStorageManager.getString(key));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,8 +14,7 @@ export default class DashboardManager extends ServicesManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
getCurrentDashboard(): Array<ServiceItem> {
|
getCurrentDashboard(): Array<ServiceItem> {
|
||||||
const dashboardIdList = AsyncStorageManager
|
const dashboardIdList = JSON.parse(AsyncStorageManager.getInstance().preferences.dashboardItems.current);
|
||||||
.getObject(AsyncStorageManager.PREFERENCES.dashboardItems.key);
|
|
||||||
const allDatasets = [
|
const allDatasets = [
|
||||||
...this.amicaleDataset,
|
...this.amicaleDataset,
|
||||||
...this.studentsDataset,
|
...this.studentsDataset,
|
||||||
|
|
|
||||||
|
|
@ -228,11 +228,10 @@ export default class ThemeManager {
|
||||||
* @returns {boolean} Night mode state
|
* @returns {boolean} Night mode state
|
||||||
*/
|
*/
|
||||||
static getNightMode(): boolean {
|
static getNightMode(): boolean {
|
||||||
return (AsyncStorageManager.getBool(AsyncStorageManager.PREFERENCES.nightMode.key) &&
|
return (AsyncStorageManager.getInstance().preferences.nightMode.current === '1' &&
|
||||||
(!AsyncStorageManager.getBool(AsyncStorageManager.PREFERENCES.nightModeFollowSystem.key)
|
(AsyncStorageManager.getInstance().preferences.nightModeFollowSystem.current !== '1' ||
|
||||||
|| colorScheme === 'no-preference')) ||
|
colorScheme === 'no-preference')) ||
|
||||||
(AsyncStorageManager.getBool(AsyncStorageManager.PREFERENCES.nightModeFollowSystem.key)
|
(AsyncStorageManager.getInstance().preferences.nightModeFollowSystem.current === '1' && colorScheme === 'dark');
|
||||||
&& colorScheme === 'dark');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -274,7 +273,8 @@ export default class ThemeManager {
|
||||||
* @param isNightMode True to enable night mode, false to disable
|
* @param isNightMode True to enable night mode, false to disable
|
||||||
*/
|
*/
|
||||||
setNightMode(isNightMode: boolean) {
|
setNightMode(isNightMode: boolean) {
|
||||||
AsyncStorageManager.set(AsyncStorageManager.PREFERENCES.nightMode.key, isNightMode);
|
let nightModeKey = AsyncStorageManager.getInstance().preferences.nightMode.key;
|
||||||
|
AsyncStorageManager.getInstance().savePref(nightModeKey, isNightMode ? '1' : '0');
|
||||||
if (this.updateThemeCallback != null)
|
if (this.updateThemeCallback != null)
|
||||||
this.updateThemeCallback();
|
this.updateThemeCallback();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -202,7 +202,7 @@ export default class TabNavigator extends React.Component<Props> {
|
||||||
if (props.defaultHomeRoute != null)
|
if (props.defaultHomeRoute != null)
|
||||||
this.defaultRoute = 'home';
|
this.defaultRoute = 'home';
|
||||||
else
|
else
|
||||||
this.defaultRoute = AsyncStorageManager.getString(AsyncStorageManager.PREFERENCES.defaultStartScreen.key).toLowerCase();
|
this.defaultRoute = AsyncStorageManager.getInstance().preferences.defaultStartScreen.current.toLowerCase();
|
||||||
this.createHomeStackComponent = () => HomeStackComponent(props.defaultHomeRoute, props.defaultHomeData);
|
this.createHomeStackComponent = () => HomeStackComponent(props.defaultHomeRoute, props.defaultHomeData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -43,11 +43,10 @@ class DebugScreen extends React.Component<Props, State> {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.modalInputValue = "";
|
this.modalInputValue = "";
|
||||||
|
let copy = {...AsyncStorageManager.getInstance().preferences};
|
||||||
let currentPreferences : Array<PreferenceItem> = [];
|
let currentPreferences : Array<PreferenceItem> = [];
|
||||||
Object.values(AsyncStorageManager.PREFERENCES).map((object: any) => {
|
Object.values(copy).map((object: any) => {
|
||||||
let newObject: PreferenceItem = {...object};
|
currentPreferences.push(object);
|
||||||
newObject.current = AsyncStorageManager.getString(newObject.key);
|
|
||||||
currentPreferences.push(newObject);
|
|
||||||
});
|
});
|
||||||
this.state = {
|
this.state = {
|
||||||
modalCurrentDisplayItem: {},
|
modalCurrentDisplayItem: {},
|
||||||
|
|
@ -140,7 +139,7 @@ class DebugScreen extends React.Component<Props, State> {
|
||||||
currentPreferences[this.findIndexOfKey(key)].current = value;
|
currentPreferences[this.findIndexOfKey(key)].current = value;
|
||||||
return {currentPreferences};
|
return {currentPreferences};
|
||||||
});
|
});
|
||||||
AsyncStorageManager.set(key, value);
|
AsyncStorageManager.getInstance().savePref(key, value);
|
||||||
this.modalRef.close();
|
this.modalRef.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ const LIST_ITEM_HEIGHT = 64;
|
||||||
class EquipmentListScreen extends React.Component<Props, State> {
|
class EquipmentListScreen extends React.Component<Props, State> {
|
||||||
|
|
||||||
state = {
|
state = {
|
||||||
mascotDialogVisible: AsyncStorageManager.getBool(AsyncStorageManager.PREFERENCES.equipmentShowBanner.key),
|
mascotDialogVisible: AsyncStorageManager.getInstance().preferences.equipmentShowBanner.current === "1"
|
||||||
}
|
}
|
||||||
|
|
||||||
data: Array<Device>;
|
data: Array<Device>;
|
||||||
|
|
@ -146,7 +146,10 @@ class EquipmentListScreen extends React.Component<Props, State> {
|
||||||
};
|
};
|
||||||
|
|
||||||
hideMascotDialog = () => {
|
hideMascotDialog = () => {
|
||||||
AsyncStorageManager.set(AsyncStorageManager.PREFERENCES.equipmentShowBanner.key, false);
|
AsyncStorageManager.getInstance().savePref(
|
||||||
|
AsyncStorageManager.getInstance().preferences.equipmentShowBanner.key,
|
||||||
|
'0'
|
||||||
|
);
|
||||||
this.setState({mascotDialogVisible: false})
|
this.setState({mascotDialogVisible: false})
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ class LoginScreen extends React.Component<Props, State> {
|
||||||
loading: false,
|
loading: false,
|
||||||
dialogVisible: false,
|
dialogVisible: false,
|
||||||
dialogError: 0,
|
dialogError: 0,
|
||||||
mascotDialogVisible: AsyncStorageManager.getBool(AsyncStorageManager.PREFERENCES.loginShowBanner.key),
|
mascotDialogVisible: AsyncStorageManager.getInstance().preferences.loginShowBanner.current === "1"
|
||||||
};
|
};
|
||||||
|
|
||||||
onEmailChange: (value: string) => null;
|
onEmailChange: (value: string) => null;
|
||||||
|
|
@ -82,7 +82,10 @@ class LoginScreen extends React.Component<Props, State> {
|
||||||
}
|
}
|
||||||
|
|
||||||
hideMascotDialog = () => {
|
hideMascotDialog = () => {
|
||||||
AsyncStorageManager.set(AsyncStorageManager.PREFERENCES.loginShowBanner.key, false);
|
AsyncStorageManager.getInstance().savePref(
|
||||||
|
AsyncStorageManager.getInstance().preferences.loginShowBanner.key,
|
||||||
|
'0'
|
||||||
|
);
|
||||||
this.setState({mascotDialogVisible: false})
|
this.setState({mascotDialogVisible: false})
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -108,8 +111,11 @@ class LoginScreen extends React.Component<Props, State> {
|
||||||
* Saves in user preferences to not show the login banner again.
|
* Saves in user preferences to not show the login banner again.
|
||||||
*/
|
*/
|
||||||
handleSuccess = () => {
|
handleSuccess = () => {
|
||||||
// Do not show the home login banner again
|
// Do not show the login banner again
|
||||||
AsyncStorageManager.set(AsyncStorageManager.PREFERENCES.homeShowBanner.key, false);
|
AsyncStorageManager.getInstance().savePref(
|
||||||
|
AsyncStorageManager.getInstance().preferences.homeShowBanner.key,
|
||||||
|
'0'
|
||||||
|
);
|
||||||
if (this.nextScreen == null)
|
if (this.nextScreen == null)
|
||||||
this.props.navigation.goBack();
|
this.props.navigation.goBack();
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -108,7 +108,7 @@ export default class VoteScreen extends React.Component<Props, State> {
|
||||||
|
|
||||||
state = {
|
state = {
|
||||||
hasVoted: false,
|
hasVoted: false,
|
||||||
mascotDialogVisible: AsyncStorageManager.getBool(AsyncStorageManager.PREFERENCES.voteShowBanner.key),
|
mascotDialogVisible: AsyncStorageManager.getInstance().preferences.voteShowBanner.current === "1",
|
||||||
};
|
};
|
||||||
|
|
||||||
teams: Array<team>;
|
teams: Array<team>;
|
||||||
|
|
@ -326,7 +326,10 @@ export default class VoteScreen extends React.Component<Props, State> {
|
||||||
};
|
};
|
||||||
|
|
||||||
hideMascotDialog = () => {
|
hideMascotDialog = () => {
|
||||||
AsyncStorageManager.set(AsyncStorageManager.PREFERENCES.voteShowBanner.key, false);
|
AsyncStorageManager.getInstance().savePref(
|
||||||
|
AsyncStorageManager.getInstance().preferences.voteShowBanner.key,
|
||||||
|
'0'
|
||||||
|
);
|
||||||
this.setState({mascotDialogVisible: false})
|
this.setState({mascotDialogVisible: false})
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -46,13 +46,13 @@ class GameStartScreen extends React.Component<Props, State> {
|
||||||
isHighScore: boolean;
|
isHighScore: boolean;
|
||||||
|
|
||||||
state = {
|
state = {
|
||||||
mascotDialogVisible: AsyncStorageManager.getBool(AsyncStorageManager.PREFERENCES.gameStartShowBanner.key),
|
mascotDialogVisible: AsyncStorageManager.getInstance().preferences.gameStartShowBanner.current === "1",
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(props: Props) {
|
constructor(props: Props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.gridManager = new GridManager(4, 4, props.theme);
|
this.gridManager = new GridManager(4, 4, props.theme);
|
||||||
this.scores = AsyncStorageManager.getObject(AsyncStorageManager.PREFERENCES.gameScores.key);
|
this.scores = JSON.parse(AsyncStorageManager.getInstance().preferences.gameScores.current);
|
||||||
this.scores.sort((a, b) => b - a);
|
this.scores.sort((a, b) => b - a);
|
||||||
if (this.props.route.params != null)
|
if (this.props.route.params != null)
|
||||||
this.recoverGameScore();
|
this.recoverGameScore();
|
||||||
|
|
@ -72,11 +72,17 @@ class GameStartScreen extends React.Component<Props, State> {
|
||||||
}
|
}
|
||||||
if (this.scores.length > 3)
|
if (this.scores.length > 3)
|
||||||
this.scores.splice(3, 1);
|
this.scores.splice(3, 1);
|
||||||
AsyncStorageManager.set(AsyncStorageManager.PREFERENCES.gameScores.key, this.scores);
|
AsyncStorageManager.getInstance().savePref(
|
||||||
|
AsyncStorageManager.getInstance().preferences.gameScores.key,
|
||||||
|
JSON.stringify(this.scores)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
hideMascotDialog = () => {
|
hideMascotDialog = () => {
|
||||||
AsyncStorageManager.set(AsyncStorageManager.PREFERENCES.gameStartShowBanner.key, false);
|
AsyncStorageManager.getInstance().savePref(
|
||||||
|
AsyncStorageManager.getInstance().preferences.gameStartShowBanner.key,
|
||||||
|
'0'
|
||||||
|
);
|
||||||
this.setState({mascotDialogVisible: false})
|
this.setState({mascotDialogVisible: false})
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -162,7 +168,7 @@ class GameStartScreen extends React.Component<Props, State> {
|
||||||
}}>
|
}}>
|
||||||
{this.isHighScore
|
{this.isHighScore
|
||||||
? i18n.t("screens.game.newHighScore")
|
? i18n.t("screens.game.newHighScore")
|
||||||
: i18n.t("screens.game.gameOver")}
|
: i18n.t("screens.game.gameOver.text")}
|
||||||
</Headline>
|
</Headline>
|
||||||
<Divider/>
|
<Divider/>
|
||||||
<View style={{
|
<View style={{
|
||||||
|
|
|
||||||
|
|
@ -112,8 +112,7 @@ class HomeScreen extends React.Component<Props, State> {
|
||||||
});
|
});
|
||||||
this.state = {
|
this.state = {
|
||||||
dialogVisible: false,
|
dialogVisible: false,
|
||||||
mascotDialogVisible: AsyncStorageManager.getBool(
|
mascotDialogVisible: AsyncStorageManager.getInstance().preferences.homeShowBanner.current === "1"
|
||||||
AsyncStorageManager.PREFERENCES.homeShowBanner.key)
|
|
||||||
&& !this.isLoggedIn,
|
&& !this.isLoggedIn,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -185,7 +184,10 @@ class HomeScreen extends React.Component<Props, State> {
|
||||||
};
|
};
|
||||||
|
|
||||||
hideMascotDialog = () => {
|
hideMascotDialog = () => {
|
||||||
AsyncStorageManager.set(AsyncStorageManager.PREFERENCES.homeShowBanner.key, false);
|
AsyncStorageManager.getInstance().savePref(
|
||||||
|
AsyncStorageManager.getInstance().preferences.homeShowBanner.key,
|
||||||
|
'0'
|
||||||
|
);
|
||||||
this.setState({mascotDialogVisible: false})
|
this.setState({mascotDialogVisible: false})
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ class DashboardEditScreen extends React.Component<Props, State> {
|
||||||
constructor(props: Props) {
|
constructor(props: Props) {
|
||||||
super(props);
|
super(props);
|
||||||
let dashboardManager = new DashboardManager(this.props.navigation);
|
let dashboardManager = new DashboardManager(this.props.navigation);
|
||||||
this.initialDashboardIdList = AsyncStorageManager.getObject(AsyncStorageManager.PREFERENCES.dashboardItems.key);
|
this.initialDashboardIdList = JSON.parse(AsyncStorageManager.getInstance().preferences.dashboardItems.current);
|
||||||
this.initialDashboard = dashboardManager.getCurrentDashboard();
|
this.initialDashboard = dashboardManager.getCurrentDashboard();
|
||||||
this.state = {
|
this.state = {
|
||||||
currentDashboard: [...this.initialDashboard],
|
currentDashboard: [...this.initialDashboard],
|
||||||
|
|
@ -92,7 +92,10 @@ class DashboardEditScreen extends React.Component<Props, State> {
|
||||||
currentDashboard: currentDashboard,
|
currentDashboard: currentDashboard,
|
||||||
currentDashboardIdList: currentDashboardIdList,
|
currentDashboardIdList: currentDashboardIdList,
|
||||||
});
|
});
|
||||||
AsyncStorageManager.set(AsyncStorageManager.PREFERENCES.dashboardItems.key, currentDashboardIdList);
|
AsyncStorageManager.getInstance().savePref(
|
||||||
|
AsyncStorageManager.getInstance().preferences.dashboardItems.key,
|
||||||
|
JSON.stringify(currentDashboardIdList)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
undoDashboard = () => {
|
undoDashboard = () => {
|
||||||
|
|
@ -100,7 +103,10 @@ class DashboardEditScreen extends React.Component<Props, State> {
|
||||||
currentDashboard: [...this.initialDashboard],
|
currentDashboard: [...this.initialDashboard],
|
||||||
currentDashboardIdList: [...this.initialDashboardIdList]
|
currentDashboardIdList: [...this.initialDashboardIdList]
|
||||||
});
|
});
|
||||||
AsyncStorageManager.set(AsyncStorageManager.PREFERENCES.dashboardItems.key, this.initialDashboardIdList);
|
AsyncStorageManager.getInstance().savePref(
|
||||||
|
AsyncStorageManager.getInstance().preferences.dashboardItems.key,
|
||||||
|
JSON.stringify(this.initialDashboardIdList)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
getListHeader() {
|
getListHeader() {
|
||||||
|
|
|
||||||
|
|
@ -37,18 +37,18 @@ class SettingsScreen extends React.Component<Props, State> {
|
||||||
*/
|
*/
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
let notifReminder = AsyncStorageManager.getString(AsyncStorageManager.PREFERENCES.proxiwashNotifications.key);
|
let notifReminder = AsyncStorageManager.getInstance().preferences.proxiwashNotifications.current;
|
||||||
this.savedNotificationReminder = parseInt(notifReminder);
|
this.savedNotificationReminder = parseInt(notifReminder);
|
||||||
if (isNaN(this.savedNotificationReminder))
|
if (isNaN(this.savedNotificationReminder))
|
||||||
this.savedNotificationReminder = 0;
|
this.savedNotificationReminder = 0;
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
nightMode: ThemeManager.getNightMode(),
|
nightMode: ThemeManager.getNightMode(),
|
||||||
nightModeFollowSystem: AsyncStorageManager.getBool(AsyncStorageManager.PREFERENCES.nightModeFollowSystem.key)
|
nightModeFollowSystem: AsyncStorageManager.getInstance().preferences.nightModeFollowSystem.current === '1' &&
|
||||||
&& Appearance.getColorScheme() !== 'no-preference',
|
Appearance.getColorScheme() !== 'no-preference',
|
||||||
notificationReminderSelected: this.savedNotificationReminder,
|
notificationReminderSelected: this.savedNotificationReminder,
|
||||||
startScreenPickerSelected: AsyncStorageManager.getString(AsyncStorageManager.PREFERENCES.defaultStartScreen.key),
|
startScreenPickerSelected: AsyncStorageManager.getInstance().preferences.defaultStartScreen.current,
|
||||||
isDebugUnlocked: AsyncStorageManager.getBool(AsyncStorageManager.PREFERENCES.debugUnlocked.key)
|
isDebugUnlocked: AsyncStorageManager.getInstance().preferences.debugUnlocked.current === '1'
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -57,7 +57,8 @@ class SettingsScreen extends React.Component<Props, State> {
|
||||||
*/
|
*/
|
||||||
unlockDebugMode = () => {
|
unlockDebugMode = () => {
|
||||||
this.setState({isDebugUnlocked: true});
|
this.setState({isDebugUnlocked: true});
|
||||||
AsyncStorageManager.set(AsyncStorageManager.PREFERENCES.debugUnlocked.key, true);
|
let key = AsyncStorageManager.getInstance().preferences.debugUnlocked.key;
|
||||||
|
AsyncStorageManager.getInstance().savePref(key, '1');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -66,8 +67,9 @@ class SettingsScreen extends React.Component<Props, State> {
|
||||||
* @param value The value to store
|
* @param value The value to store
|
||||||
*/
|
*/
|
||||||
onProxiwashNotifPickerValueChange = (value: number) => {
|
onProxiwashNotifPickerValueChange = (value: number) => {
|
||||||
this.setState({notificationReminderSelected: value});
|
let key = AsyncStorageManager.getInstance().preferences.proxiwashNotifications.key;
|
||||||
AsyncStorageManager.set(AsyncStorageManager.PREFERENCES.proxiwashNotifications.key, value);
|
AsyncStorageManager.getInstance().savePref(key, value.toString());
|
||||||
|
this.setState({notificationReminderSelected: value})
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -77,8 +79,11 @@ class SettingsScreen extends React.Component<Props, State> {
|
||||||
*/
|
*/
|
||||||
onStartScreenPickerValueChange = (value: string) => {
|
onStartScreenPickerValueChange = (value: string) => {
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
this.setState({startScreenPickerSelected: value});
|
let key = AsyncStorageManager.getInstance().preferences.defaultStartScreen.key;
|
||||||
AsyncStorageManager.set(AsyncStorageManager.PREFERENCES.defaultStartScreen.key, value);
|
AsyncStorageManager.getInstance().savePref(key, value);
|
||||||
|
this.setState({
|
||||||
|
startScreenPickerSelected: value
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -134,7 +139,8 @@ class SettingsScreen extends React.Component<Props, State> {
|
||||||
onToggleNightModeFollowSystem = () => {
|
onToggleNightModeFollowSystem = () => {
|
||||||
const value = !this.state.nightModeFollowSystem;
|
const value = !this.state.nightModeFollowSystem;
|
||||||
this.setState({nightModeFollowSystem: value});
|
this.setState({nightModeFollowSystem: value});
|
||||||
AsyncStorageManager.set(AsyncStorageManager.PREFERENCES.nightModeFollowSystem.key, value);
|
let key = AsyncStorageManager.getInstance().preferences.nightModeFollowSystem.key;
|
||||||
|
AsyncStorageManager.getInstance().savePref(key, value ? '1' : '0');
|
||||||
if (value) {
|
if (value) {
|
||||||
const nightMode = Appearance.getColorScheme() === 'dark';
|
const nightMode = Appearance.getColorScheme() === 'dark';
|
||||||
ThemeManager.getInstance().setNightMode(nightMode);
|
ThemeManager.getInstance().setNightMode(nightMode);
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ class GroupSelectionScreen extends React.Component<Props, State> {
|
||||||
super(props);
|
super(props);
|
||||||
this.state = {
|
this.state = {
|
||||||
currentSearchString: '',
|
currentSearchString: '',
|
||||||
favoriteGroups: AsyncStorageManager.getObject(AsyncStorageManager.PREFERENCES.planexFavoriteGroups.key),
|
favoriteGroups: JSON.parse(AsyncStorageManager.getInstance().preferences.planexFavoriteGroups.current),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -172,7 +172,9 @@ class GroupSelectionScreen extends React.Component<Props, State> {
|
||||||
else
|
else
|
||||||
this.addGroupToFavorites(newFavorites, group);
|
this.addGroupToFavorites(newFavorites, group);
|
||||||
this.setState({favoriteGroups: newFavorites})
|
this.setState({favoriteGroups: newFavorites})
|
||||||
AsyncStorageManager.set(AsyncStorageManager.PREFERENCES.planexFavoriteGroups.key, newFavorites);
|
AsyncStorageManager.getInstance().savePref(
|
||||||
|
AsyncStorageManager.getInstance().preferences.planexFavoriteGroups.key,
|
||||||
|
JSON.stringify(newFavorites));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -135,7 +135,7 @@ class PlanexScreen extends React.Component<Props, State> {
|
||||||
this.webScreenRef = React.createRef();
|
this.webScreenRef = React.createRef();
|
||||||
this.barRef = React.createRef();
|
this.barRef = React.createRef();
|
||||||
|
|
||||||
let currentGroup = AsyncStorageManager.getString(AsyncStorageManager.PREFERENCES.planexCurrentGroup.key);
|
let currentGroup = AsyncStorageManager.getInstance().preferences.planexCurrentGroup.current;
|
||||||
if (currentGroup === '')
|
if (currentGroup === '')
|
||||||
currentGroup = {name: "SELECT GROUP", id: -1, isFav: false};
|
currentGroup = {name: "SELECT GROUP", id: -1, isFav: false};
|
||||||
else {
|
else {
|
||||||
|
|
@ -144,9 +144,8 @@ class PlanexScreen extends React.Component<Props, State> {
|
||||||
}
|
}
|
||||||
this.state = {
|
this.state = {
|
||||||
mascotDialogVisible:
|
mascotDialogVisible:
|
||||||
AsyncStorageManager.getBool(AsyncStorageManager.PREFERENCES.planexShowBanner.key)
|
AsyncStorageManager.getInstance().preferences.planexShowBanner.current === '1' &&
|
||||||
&& AsyncStorageManager.getString(AsyncStorageManager.PREFERENCES.defaultStartScreen.key)
|
AsyncStorageManager.getInstance().preferences.defaultStartScreen.current !== 'Planex',
|
||||||
.toLowerCase() !== 'planex',
|
|
||||||
dialogVisible: false,
|
dialogVisible: false,
|
||||||
dialogTitle: "",
|
dialogTitle: "",
|
||||||
dialogMessage: "",
|
dialogMessage: "",
|
||||||
|
|
@ -168,7 +167,10 @@ class PlanexScreen extends React.Component<Props, State> {
|
||||||
*/
|
*/
|
||||||
onMascotDialogCancel = () => {
|
onMascotDialogCancel = () => {
|
||||||
this.setState({mascotDialogVisible: false});
|
this.setState({mascotDialogVisible: false});
|
||||||
AsyncStorageManager.set(AsyncStorageManager.PREFERENCES.planexShowBanner.key, false);
|
AsyncStorageManager.getInstance().savePref(
|
||||||
|
AsyncStorageManager.getInstance().preferences.planexShowBanner.key,
|
||||||
|
'0'
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -206,7 +208,10 @@ class PlanexScreen extends React.Component<Props, State> {
|
||||||
selectNewGroup(group: group) {
|
selectNewGroup(group: group) {
|
||||||
this.sendMessage('setGroup', group.id);
|
this.sendMessage('setGroup', group.id);
|
||||||
this.setState({currentGroup: group});
|
this.setState({currentGroup: group});
|
||||||
AsyncStorageManager.set(AsyncStorageManager.PREFERENCES.planexCurrentGroup.key, group);
|
AsyncStorageManager.getInstance().savePref(
|
||||||
|
AsyncStorageManager.getInstance().preferences.planexCurrentGroup.key,
|
||||||
|
JSON.stringify(group)
|
||||||
|
);
|
||||||
this.props.navigation.setOptions({title: group.name});
|
this.props.navigation.setOptions({title: group.name});
|
||||||
this.generateInjectedJS(group.id);
|
this.generateInjectedJS(group.id);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ class PlanningScreen extends React.Component<Props, State> {
|
||||||
refreshing: false,
|
refreshing: false,
|
||||||
agendaItems: {},
|
agendaItems: {},
|
||||||
calendarShowing: false,
|
calendarShowing: false,
|
||||||
mascotDialogVisible: AsyncStorageManager.getBool(AsyncStorageManager.PREFERENCES.eventsShowBanner.key)
|
mascotDialogVisible: AsyncStorageManager.getInstance().preferences.eventsShowBanner.current === "1"
|
||||||
};
|
};
|
||||||
|
|
||||||
currentDate = getDateOnlyString(getCurrentDateString());
|
currentDate = getDateOnlyString(getCurrentDateString());
|
||||||
|
|
@ -111,7 +111,10 @@ class PlanningScreen extends React.Component<Props, State> {
|
||||||
*/
|
*/
|
||||||
onHideMascotDialog = () => {
|
onHideMascotDialog = () => {
|
||||||
this.setState({mascotDialogVisible: false});
|
this.setState({mascotDialogVisible: false});
|
||||||
AsyncStorageManager.set(AsyncStorageManager.PREFERENCES.eventsShowBanner.key, false);
|
AsyncStorageManager.getInstance().savePref(
|
||||||
|
AsyncStorageManager.getInstance().preferences.eventsShowBanner.key,
|
||||||
|
'0'
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -66,8 +66,8 @@ class ProxiwashScreen extends React.Component<Props, State> {
|
||||||
state = {
|
state = {
|
||||||
refreshing: false,
|
refreshing: false,
|
||||||
modalCurrentDisplayItem: null,
|
modalCurrentDisplayItem: null,
|
||||||
machinesWatched: AsyncStorageManager.getObject(AsyncStorageManager.PREFERENCES.proxiwashWatchedMachines.key),
|
machinesWatched: JSON.parse(AsyncStorageManager.getInstance().preferences.proxiwashWatchedMachines.current),
|
||||||
mascotDialogVisible: AsyncStorageManager.getBool(AsyncStorageManager.PREFERENCES.proxiwashShowBanner.key),
|
mascotDialogVisible: AsyncStorageManager.getInstance().preferences.proxiwashShowBanner.current === "1",
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -90,7 +90,10 @@ class ProxiwashScreen extends React.Component<Props, State> {
|
||||||
*/
|
*/
|
||||||
onHideMascotDialog = () => {
|
onHideMascotDialog = () => {
|
||||||
this.setState({mascotDialogVisible: false});
|
this.setState({mascotDialogVisible: false});
|
||||||
AsyncStorageManager.set(AsyncStorageManager.PREFERENCES.proxiwashShowBanner.key, false);
|
AsyncStorageManager.getInstance().savePref(
|
||||||
|
AsyncStorageManager.getInstance().preferences.proxiwashShowBanner.key,
|
||||||
|
'0'
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -182,7 +185,10 @@ class ProxiwashScreen extends React.Component<Props, State> {
|
||||||
|
|
||||||
saveNewWatchedList(list: Array<Machine>) {
|
saveNewWatchedList(list: Array<Machine>) {
|
||||||
this.setState({machinesWatched: list});
|
this.setState({machinesWatched: list});
|
||||||
AsyncStorageManager.set(AsyncStorageManager.PREFERENCES.proxiwashWatchedMachines.key, list);
|
AsyncStorageManager.getInstance().savePref(
|
||||||
|
AsyncStorageManager.getInstance().preferences.proxiwashWatchedMachines.key,
|
||||||
|
JSON.stringify(list),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ class ServicesScreen extends React.Component<Props, State> {
|
||||||
finalDataset: Array<listItem>
|
finalDataset: Array<listItem>
|
||||||
|
|
||||||
state = {
|
state = {
|
||||||
mascotDialogVisible: AsyncStorageManager.getBool(AsyncStorageManager.PREFERENCES.servicesShowBanner.key),
|
mascotDialogVisible: AsyncStorageManager.getInstance().preferences.servicesShowBanner.current === "1"
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
|
|
@ -60,7 +60,10 @@ class ServicesScreen extends React.Component<Props, State> {
|
||||||
*/
|
*/
|
||||||
onHideMascotDialog = () => {
|
onHideMascotDialog = () => {
|
||||||
this.setState({mascotDialogVisible: false});
|
this.setState({mascotDialogVisible: false});
|
||||||
AsyncStorageManager.set(AsyncStorageManager.PREFERENCES.servicesShowBanner.key, false);
|
AsyncStorageManager.getInstance().savePref(
|
||||||
|
AsyncStorageManager.getInstance().preferences.servicesShowBanner.key,
|
||||||
|
'0'
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
getAboutButton = () =>
|
getAboutButton = () =>
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ export async function askPermissions() {
|
||||||
* @param date The date to trigger the notification at
|
* @param date The date to trigger the notification at
|
||||||
*/
|
*/
|
||||||
function createNotifications(machineID: string, date: Date) {
|
function createNotifications(machineID: string, date: Date) {
|
||||||
let reminder = AsyncStorageManager.getNumber(AsyncStorageManager.PREFERENCES.proxiwashNotifications.key);
|
let reminder = parseInt(AsyncStorageManager.getInstance().preferences.proxiwashNotifications.current);
|
||||||
if (!isNaN(reminder) && reminder > 0) {
|
if (!isNaN(reminder) && reminder > 0) {
|
||||||
let id = reminderIdFactor * parseInt(machineID);
|
let id = reminderIdFactor * parseInt(machineID);
|
||||||
let reminderDate = new Date(date);
|
let reminderDate = new Date(date);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue