forked from vergnet/application-amicale
Improved update management
This commit is contained in:
parent
4948456204
commit
2c99d2bb62
7 changed files with 39 additions and 11 deletions
7
App.js
7
App.js
|
@ -13,6 +13,7 @@ import DrawerNavigator from './navigation/DrawerNavigator';
|
|||
import NotificationsManager from "./utils/NotificationsManager";
|
||||
import {Provider as PaperProvider} from 'react-native-paper';
|
||||
import AprilFoolsManager from "./utils/AprilFoolsManager";
|
||||
import Update from "./constants/Update";
|
||||
|
||||
type Props = {};
|
||||
|
||||
|
@ -77,7 +78,7 @@ export default class App extends React.Component<Props, State> {
|
|||
showAprilFools: false,
|
||||
});
|
||||
AsyncStorageManager.getInstance().savePref(AsyncStorageManager.getInstance().preferences.showIntro.key, '0');
|
||||
AsyncStorageManager.getInstance().savePref(AsyncStorageManager.getInstance().preferences.showUpdate5.key, '0');
|
||||
AsyncStorageManager.getInstance().savePref(AsyncStorageManager.getInstance().preferences.updateNumber.key, Update.number.toString());
|
||||
AsyncStorageManager.getInstance().savePref(AsyncStorageManager.getInstance().preferences.showAprilFoolsStart.key, '0');
|
||||
}
|
||||
|
||||
|
@ -89,7 +90,7 @@ export default class App extends React.Component<Props, State> {
|
|||
// Wait for custom fonts to be loaded before showing the app
|
||||
await AsyncStorageManager.getInstance().loadPreferences();
|
||||
ThemeManager.getInstance().setUpdateThemeCallback(this.onUpdateTheme);
|
||||
// await NotificationsManager.initExpoToken();
|
||||
await NotificationsManager.initExpoToken();
|
||||
this.onLoadFinished();
|
||||
}
|
||||
|
||||
|
@ -100,7 +101,7 @@ export default class App extends React.Component<Props, State> {
|
|||
isLoading: false,
|
||||
currentTheme: ThemeManager.getCurrentTheme(),
|
||||
showIntro: AsyncStorageManager.getInstance().preferences.showIntro.current === '1',
|
||||
showUpdate: AsyncStorageManager.getInstance().preferences.showUpdate5.current === '1',
|
||||
showUpdate: AsyncStorageManager.getInstance().preferences.updateNumber.current !== Update.number.toString(),
|
||||
showAprilFools: AprilFoolsManager.getInstance().isAprilFoolsEnabled() && AsyncStorageManager.getInstance().preferences.showAprilFoolsStart.current === '1',
|
||||
});
|
||||
// Status bar goes dark if set too fast
|
||||
|
|
|
@ -7,6 +7,7 @@ import {MaterialCommunityIcons} from "@expo/vector-icons";
|
|||
import {Text} from "react-native-paper";
|
||||
import i18n from 'i18n-js';
|
||||
import AppIntroSlider from "react-native-app-intro-slider";
|
||||
import Update from "../constants/Update";
|
||||
|
||||
// Content to be used int the intro slides
|
||||
|
||||
|
@ -105,9 +106,9 @@ export default class CustomIntroSlider extends React.Component<Props> {
|
|||
this.updateSlides = [
|
||||
{
|
||||
key: '1',
|
||||
title: i18n.t('intro.updateSlide.title'),
|
||||
text: i18n.t('intro.updateSlide.text'),
|
||||
icon: 'email',
|
||||
title: Update.getInstance().title,
|
||||
text: Update.getInstance().description,
|
||||
icon: Update.icon,
|
||||
colors: ['#e01928', '#be1522'],
|
||||
},
|
||||
];
|
||||
|
|
25
constants/Update.js
Normal file
25
constants/Update.js
Normal file
|
@ -0,0 +1,25 @@
|
|||
import i18n from "i18n-js";
|
||||
|
||||
export default class Update {
|
||||
|
||||
static number = 5;
|
||||
static icon = 'surround-sound-2-0';
|
||||
|
||||
static instance: Update | null = null;
|
||||
|
||||
constructor() {
|
||||
this.title = i18n.t('intro.updateSlide.title');
|
||||
this.description = i18n.t('intro.updateSlide.text');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get this class instance or create one if none is found
|
||||
* @returns {Update}
|
||||
*/
|
||||
static getInstance(): Update {
|
||||
return Update.instance === null ?
|
||||
Update.instance = new Update() :
|
||||
Update.instance;
|
||||
}
|
||||
|
||||
};
|
|
@ -34,7 +34,8 @@
|
|||
"react-native-safe-area-context": "0.6.0",
|
||||
"react-native-screens": "2.0.0-alpha.12",
|
||||
"react-native-webview": "7.4.3",
|
||||
"react-native-appearance": "~0.3.1"
|
||||
"react-native-appearance": "~0.3.1",
|
||||
"expo-linear-gradient": "~8.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-preset-expo": "^8.0.0"
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
},
|
||||
"updateSlide": {
|
||||
"title": "New in this update!",
|
||||
"text": "Never miss an email anymore! Acces your INSA webmail from the app using the left menu.\nPlanex has also seen some improvements!\n\nSome of your remarks where taken into account for this update, more to come.\nThanks for your feedback on the survey! "
|
||||
"text": "The app got a new UI ! Faster, prettier and more modern, we hope you'll love it!"
|
||||
},
|
||||
"aprilFoolsSlide": {
|
||||
"title": "New in this update!",
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
},
|
||||
"updateSlide": {
|
||||
"title": "Nouveau dans cette mise à jour !",
|
||||
"text": "Ne ratez plus jamais un email ! Accédez à vos mails INSA depuis le menu à gauche.\nPlanex a aussi été un peu amélioré !\n\nUne partie de vos remarques ont été prises en compte pour cette mise à jour, d'autres sont à venir.\nMerci pour votre retour lors du sondage !"
|
||||
"text": "L'appli fait peau neuve ! Avec une interface plus rapide, plus jolie et moderne, nous espérons que vous allez l'apprécier !"
|
||||
},
|
||||
"aprilFoolsSlide": {
|
||||
"title": "Nouveau dans cette mise à jour !",
|
||||
|
|
|
@ -29,8 +29,8 @@ export default class AsyncStorageManager {
|
|||
default: '1',
|
||||
current: '',
|
||||
},
|
||||
showUpdate5: {
|
||||
key: 'showUpdate5',
|
||||
updateNumber: {
|
||||
key: 'updateNumber',
|
||||
default: '1',
|
||||
current: '',
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue