diff --git a/App.js b/App.js index 5ebd217..585b137 100644 --- a/App.js +++ b/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 { 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 { // 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 { 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 diff --git a/components/CustomIntroSlider.js b/components/CustomIntroSlider.js index 47a467f..8c19ba3 100644 --- a/components/CustomIntroSlider.js +++ b/components/CustomIntroSlider.js @@ -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 { 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'], }, ]; diff --git a/constants/Update.js b/constants/Update.js new file mode 100644 index 0000000..072a50e --- /dev/null +++ b/constants/Update.js @@ -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; + } + +}; diff --git a/package.json b/package.json index 5e31f94..7c6672f 100644 --- a/package.json +++ b/package.json @@ -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" diff --git a/translations/en.json b/translations/en.json index f679bac..6bf72c7 100644 --- a/translations/en.json +++ b/translations/en.json @@ -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!", diff --git a/translations/fr.json b/translations/fr.json index 81f3177..1c5d442 100644 --- a/translations/fr.json +++ b/translations/fr.json @@ -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 !", diff --git a/utils/AsyncStorageManager.js b/utils/AsyncStorageManager.js index 70975a5..94f27ab 100644 --- a/utils/AsyncStorageManager.js +++ b/utils/AsyncStorageManager.js @@ -29,8 +29,8 @@ export default class AsyncStorageManager { default: '1', current: '', }, - showUpdate5: { - key: 'showUpdate5', + updateNumber: { + key: 'updateNumber', default: '1', current: '', },