Compare commits

..

No commits in common. "23bc034b34011f06efff91ba646aa38f341dae09" and "4131b795614db6591e9e3c257fdb85d5bd102195" have entirely different histories.

9 changed files with 48 additions and 75 deletions

View file

@ -136,8 +136,8 @@ android {
applicationId 'fr.amicaleinsat.application' applicationId 'fr.amicaleinsat.application'
minSdkVersion rootProject.ext.minSdkVersion minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 27 versionCode 24
versionName "3.0.10" versionName "3.0.7"
missingDimensionStrategy 'react-native-camera', 'general' missingDimensionStrategy 'react-native-camera', 'general'
} }
splits { splits {

View file

@ -2,10 +2,10 @@
buildscript { buildscript {
ext { ext {
buildToolsVersion = "29.0.3" buildToolsVersion = "28.0.3"
minSdkVersion = 21 minSdkVersion = 21
compileSdkVersion = 29 compileSdkVersion = 28
targetSdkVersion = 29 targetSdkVersion = 28
} }
repositories { repositories {
google() google()

View file

@ -1,6 +1,6 @@
{ {
"name": "campus", "name": "campus",
"version": "3.0.10", "version": "3.0.7",
"private": true, "private": true,
"scripts": { "scripts": {
"start": "react-native start", "start": "react-native start",
@ -39,7 +39,7 @@
"react-native-collapsible": "^1.5.2", "react-native-collapsible": "^1.5.2",
"react-native-gesture-handler": "^1.6.1", "react-native-gesture-handler": "^1.6.1",
"react-native-image-modal": "^1.0.8", "react-native-image-modal": "^1.0.8",
"react-native-keychain": "^6.1.1", "react-native-keychain": "6.0.0",
"react-native-linear-gradient": "^2.5.6", "react-native-linear-gradient": "^2.5.6",
"react-native-localize": "^1.4.0", "react-native-localize": "^1.4.0",
"react-native-modalize": "^2.0.4", "react-native-modalize": "^2.0.4",

View file

@ -5,11 +5,9 @@ import ProxiwashConstants from "../../../constants/ProxiwashConstants";
import i18n from "i18n-js"; import i18n from "i18n-js";
import AprilFoolsManager from "../../../managers/AprilFoolsManager"; import AprilFoolsManager from "../../../managers/AprilFoolsManager";
import * as Animatable from "react-native-animatable"; import * as Animatable from "react-native-animatable";
import type {CustomTheme} from "../../../managers/ThemeManager";
type Props = { type Props = {
item: Object, item: Object,
theme: CustomTheme,
onPress: Function, onPress: Function,
isWatched: boolean, isWatched: boolean,
isDryer: boolean, isDryer: boolean,
@ -55,24 +53,20 @@ class ProxiwashListItem extends React.Component<Props> {
} }
updateStateStrings() { updateStateStrings() {
this.stateStrings[ProxiwashConstants.machineStates.AVAILABLE] = i18n.t('proxiwashScreen.states.ready'); this.stateStrings[ProxiwashConstants.machineStates.TERMINE] = i18n.t('proxiwashScreen.states.finished');
this.stateStrings[ProxiwashConstants.machineStates.RUNNING] = i18n.t('proxiwashScreen.states.running'); this.stateStrings[ProxiwashConstants.machineStates.DISPONIBLE] = i18n.t('proxiwashScreen.states.ready');
this.stateStrings[ProxiwashConstants.machineStates.RUNNING_NOT_STARTED] = i18n.t('proxiwashScreen.states.runningNotStarted'); this.stateStrings[ProxiwashConstants.machineStates["EN COURS"]] = i18n.t('proxiwashScreen.states.running');
this.stateStrings[ProxiwashConstants.machineStates.FINISHED] = i18n.t('proxiwashScreen.states.finished'); this.stateStrings[ProxiwashConstants.machineStates.HS] = i18n.t('proxiwashScreen.states.broken');
this.stateStrings[ProxiwashConstants.machineStates.UNAVAILABLE] = i18n.t('proxiwashScreen.states.broken'); this.stateStrings[ProxiwashConstants.machineStates.ERREUR] = i18n.t('proxiwashScreen.states.error');
this.stateStrings[ProxiwashConstants.machineStates.ERROR] = i18n.t('proxiwashScreen.states.error');
this.stateStrings[ProxiwashConstants.machineStates.UNKNOWN] = i18n.t('proxiwashScreen.states.unknown');
} }
updateStateColors() { updateStateColors() {
const colors = this.props.theme.colors; const colors = this.props.theme.colors;
this.stateColors[ProxiwashConstants.machineStates.AVAILABLE] = colors.proxiwashReadyColor; this.stateColors[ProxiwashConstants.machineStates.TERMINE] = colors.proxiwashFinishedColor;
this.stateColors[ProxiwashConstants.machineStates.RUNNING] = colors.proxiwashRunningColor; this.stateColors[ProxiwashConstants.machineStates.DISPONIBLE] = colors.proxiwashReadyColor;
this.stateColors[ProxiwashConstants.machineStates.RUNNING_NOT_STARTED] = colors.proxiwashRunningNotStartedColor; this.stateColors[ProxiwashConstants.machineStates["EN COURS"]] = colors.proxiwashRunningColor;
this.stateColors[ProxiwashConstants.machineStates.FINISHED] = colors.proxiwashFinishedColor; this.stateColors[ProxiwashConstants.machineStates.HS] = colors.proxiwashBrokenColor;
this.stateColors[ProxiwashConstants.machineStates.UNAVAILABLE] = colors.proxiwashBrokenColor; this.stateColors[ProxiwashConstants.machineStates.ERREUR] = colors.proxiwashErrorColor;
this.stateColors[ProxiwashConstants.machineStates.ERROR] = colors.proxiwashErrorColor;
this.stateColors[ProxiwashConstants.machineStates.UNKNOWN] = colors.proxiwashUnknownColor;
} }
onListItemPress = () => this.props.onPress(this.title, this.props.item, this.props.isDryer); onListItemPress = () => this.props.onPress(this.title, this.props.item, this.props.isDryer);
@ -81,14 +75,14 @@ class ProxiwashListItem extends React.Component<Props> {
const props = this.props; const props = this.props;
const colors = props.theme.colors; const colors = props.theme.colors;
const machineState = props.item.state; const machineState = props.item.state;
const isRunning = machineState === ProxiwashConstants.machineStates.RUNNING; const isRunning = ProxiwashConstants.machineStates[machineState] === ProxiwashConstants.machineStates["EN COURS"];
const isReady = machineState === ProxiwashConstants.machineStates.AVAILABLE; const isReady = ProxiwashConstants.machineStates[machineState] === ProxiwashConstants.machineStates.DISPONIBLE;
const description = isRunning ? props.item.startTime + '/' + props.item.endTime : ''; const description = isRunning ? props.item.startTime + '/' + props.item.endTime : '';
const stateIcon = ProxiwashConstants.stateIcons[machineState]; const stateIcon = ProxiwashConstants.stateIcons[machineState];
const stateString = this.stateStrings[machineState]; const stateString = this.stateStrings[ProxiwashConstants.machineStates[machineState]];
const progress = isRunning const progress = isRunning
? props.item.donePercent !== '' ? props.item.donePercent !== ''
? parseFloat(props.item.donePercent) / 100 ? parseInt(props.item.donePercent) / 100
: 0 : 0
: 1; : 1;
@ -129,7 +123,7 @@ class ProxiwashListItem extends React.Component<Props> {
height: props.height height: props.height
}} }}
progress={progress} progress={progress}
color={this.stateColors[machineState]} color={this.stateColors[ProxiwashConstants.machineStates[machineState]]}
/> />
: null : null
} }
@ -146,7 +140,7 @@ class ProxiwashListItem extends React.Component<Props> {
<View style={{flexDirection: 'row',}}> <View style={{flexDirection: 'row',}}>
<View style={{justifyContent: 'center',}}> <View style={{justifyContent: 'center',}}>
<Text style={ <Text style={
machineState === ProxiwashConstants.machineStates.FINISHED ? ProxiwashConstants.machineStates[machineState] === ProxiwashConstants.machineStates.TERMINE ?
{fontWeight: 'bold',} : {}} {fontWeight: 'bold',} : {}}
> >
{stateString} {stateString}

View file

@ -1,20 +1,16 @@
export default { export default {
machineStates: { machineStates: {
"AVAILABLE": 0, "TERMINE": "0",
"RUNNING": 1, "DISPONIBLE": "1",
"RUNNING_NOT_STARTED": 2, "EN COURS": "2",
"FINISHED": 3, "HS": "3",
"UNAVAILABLE": 4, "ERREUR": "4"
"ERROR": 5,
"UNKNOWN": 6,
}, },
stateIcons: { stateIcons: {
0: 'radiobox-blank', "TERMINE": 'check-circle',
1: 'progress-check', "DISPONIBLE": 'radiobox-blank',
2: 'alert-circle-outline', "EN COURS": 'progress-check',
3: 'check-circle', "HS": 'alert-octagram-outline',
4: 'alert-octagram-outline', "ERREUR": 'alert'
5: 'alert',
6: 'help-circle-outline',
} }
}; };

View file

@ -31,11 +31,9 @@ export type CustomTheme = {
proxiwashFinishedColor: string, proxiwashFinishedColor: string,
proxiwashReadyColor: string, proxiwashReadyColor: string,
proxiwashRunningColor: string, proxiwashRunningColor: string,
proxiwashRunningNotStartedColor: string,
proxiwashRunningBgColor: string, proxiwashRunningBgColor: string,
proxiwashBrokenColor: string, proxiwashBrokenColor: string,
proxiwashErrorColor: string, proxiwashErrorColor: string,
proxiwashUnknownColor: string,
// Screens // Screens
planningColor: string, planningColor: string,
@ -102,11 +100,9 @@ export default class ThemeManager {
proxiwashFinishedColor: "#a5dc9d", proxiwashFinishedColor: "#a5dc9d",
proxiwashReadyColor: "transparent", proxiwashReadyColor: "transparent",
proxiwashRunningColor: "#a0ceff", proxiwashRunningColor: "#a0ceff",
proxiwashRunningNotStartedColor: "#c9e0ff",
proxiwashRunningBgColor: "#c7e3ff", proxiwashRunningBgColor: "#c7e3ff",
proxiwashBrokenColor: "#ffa8a2", proxiwashBrokenColor: "#8e8e8e",
proxiwashErrorColor: "#ffa8a2", proxiwashErrorColor: "rgba(204,7,0,0.31)#e35f57",
proxiwashUnknownColor: "#b6b6b6",
// Screens // Screens
planningColor: '#d9b10a', planningColor: '#d9b10a',
@ -162,11 +158,9 @@ export default class ThemeManager {
proxiwashFinishedColor: "#31682c", proxiwashFinishedColor: "#31682c",
proxiwashReadyColor: "transparent", proxiwashReadyColor: "transparent",
proxiwashRunningColor: "#213c79", proxiwashRunningColor: "#213c79",
proxiwashRunningNotStartedColor: "#1e263e",
proxiwashRunningBgColor: "#1a2033", proxiwashRunningBgColor: "#1a2033",
proxiwashBrokenColor: "#7e2e2f", proxiwashBrokenColor: "#656565",
proxiwashErrorColor: "#7e2e2f", proxiwashErrorColor: "#7e2e2f",
proxiwashUnknownColor: "#535353",
// Screens // Screens
planningColor: '#d99e09', planningColor: '#d99e09',

View file

@ -20,7 +20,7 @@ import {StackNavigationProp} from "@react-navigation/stack";
import {getCleanedMachineWatched, getMachineEndDate, isMachineWatched} from "../../utils/Proxiwash"; import {getCleanedMachineWatched, getMachineEndDate, isMachineWatched} from "../../utils/Proxiwash";
import {Modalize} from "react-native-modalize"; import {Modalize} from "react-native-modalize";
const DATA_URL = "https://etud.insa-toulouse.fr/~amicale_app/v2/washinsa/washinsa_data.json"; const DATA_URL = "https://etud.insa-toulouse.fr/~amicale_app/washinsa/washinsa.json";
let modalStateStrings = {}; let modalStateStrings = {};
@ -34,7 +34,6 @@ export type Machine = {
endTime: string, endTime: string,
donePercent: string, donePercent: string,
remainingTime: string, remainingTime: string,
program: string,
} }
type Props = { type Props = {
@ -76,13 +75,11 @@ class ProxiwashScreen extends React.Component<Props, State> {
*/ */
constructor(props) { constructor(props) {
super(props); super(props);
modalStateStrings[ProxiwashConstants.machineStates.AVAILABLE] = i18n.t('proxiwashScreen.modal.ready'); modalStateStrings[ProxiwashConstants.machineStates.TERMINE] = i18n.t('proxiwashScreen.modal.finished');
modalStateStrings[ProxiwashConstants.machineStates.RUNNING] = i18n.t('proxiwashScreen.modal.running'); modalStateStrings[ProxiwashConstants.machineStates.DISPONIBLE] = i18n.t('proxiwashScreen.modal.ready');
modalStateStrings[ProxiwashConstants.machineStates.RUNNING_NOT_STARTED] = i18n.t('proxiwashScreen.modal.runningNotStarted'); modalStateStrings[ProxiwashConstants.machineStates["EN COURS"]] = i18n.t('proxiwashScreen.modal.running');
modalStateStrings[ProxiwashConstants.machineStates.FINISHED] = i18n.t('proxiwashScreen.modal.finished'); modalStateStrings[ProxiwashConstants.machineStates.HS] = i18n.t('proxiwashScreen.modal.broken');
modalStateStrings[ProxiwashConstants.machineStates.UNAVAILABLE] = i18n.t('proxiwashScreen.modal.broken'); modalStateStrings[ProxiwashConstants.machineStates.ERREUR] = i18n.t('proxiwashScreen.modal.error');
modalStateStrings[ProxiwashConstants.machineStates.ERROR] = i18n.t('proxiwashScreen.modal.error');
modalStateStrings[ProxiwashConstants.machineStates.UNKNOWN] = i18n.t('proxiwashScreen.modal.unknown');
} }
/** /**
@ -267,9 +264,9 @@ class ProxiwashScreen extends React.Component<Props, State> {
icon: '', icon: '',
onPress: undefined onPress: undefined
}; };
let message = modalStateStrings[item.state]; let message = modalStateStrings[ProxiwashConstants.machineStates[item.state]];
const onPress = this.onSetupNotificationsPress.bind(this, item); const onPress = this.onSetupNotificationsPress.bind(this, item);
if (item.state === ProxiwashConstants.machineStates.RUNNING) { if (ProxiwashConstants.machineStates[item.state] === ProxiwashConstants.machineStates["EN COURS"]) {
let remainingTime = parseInt(item.remainingTime) let remainingTime = parseInt(item.remainingTime)
if (remainingTime < 0) if (remainingTime < 0)
remainingTime = 0; remainingTime = 0;
@ -289,7 +286,7 @@ class ProxiwashScreen extends React.Component<Props, State> {
end: item.endTime, end: item.endTime,
remaining: remainingTime remaining: remainingTime
}); });
} else if (item.state === ProxiwashConstants.machineStates.AVAILABLE) { } else if (ProxiwashConstants.machineStates[item.state] === ProxiwashConstants.machineStates.DISPONIBLE) {
if (isDryer) if (isDryer)
message += '\n' + i18n.t('proxiwashScreen.dryersTariff'); message += '\n' + i18n.t('proxiwashScreen.dryersTariff');
else else
@ -350,7 +347,7 @@ class ProxiwashScreen extends React.Component<Props, State> {
data = this.fetchedData.washers; data = this.fetchedData.washers;
let count = 0; let count = 0;
for (let i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
if (data[i].state === ProxiwashConstants.machineStates.AVAILABLE) if (ProxiwashConstants.machineStates[data[i].state] === ProxiwashConstants.machineStates["DISPONIBLE"])
count += 1; count += 1;
} }
return count; return count;

View file

@ -182,10 +182,8 @@
"finished": "This machine is finished. If you started it, you can get back your laundry.", "finished": "This machine is finished. If you started it, you can get back your laundry.",
"ready": "This machine is empty and ready to use.", "ready": "This machine is empty and ready to use.",
"running": "This machine has been started at %{start} and will end at %{end}.\nRemaining time: %{remaining} min", "running": "This machine has been started at %{start} and will end at %{end}.\nRemaining time: %{remaining} min",
"runningNotStarted": "This machine is ready but not started. Please make sure you pressed the start button.",
"broken": "This machine is broken and cannot be used. Thank you for your comprehension.", "broken": "This machine is broken and cannot be used. Thank you for your comprehension.",
"error": "There has been an error and we are unable to get information from this machine. Sorry for the inconvenience.", "error": "There has been an error and we are unable to get information from this machine. Sorry for the inconvenience.",
"unknown": "This machine is in an unknown state. Sorry for the inconvenience.",
"notificationErrorTitle": "Error", "notificationErrorTitle": "Error",
"notificationErrorDescription": "Impossible to create notifications. Please make sure you enabled notifications then restart the app." "notificationErrorDescription": "Impossible to create notifications. Please make sure you enabled notifications then restart the app."
}, },
@ -193,10 +191,8 @@
"finished": "FINISHED", "finished": "FINISHED",
"ready": "READY", "ready": "READY",
"running": "RUNNING", "running": "RUNNING",
"runningNotStarted": "NOT STARTED",
"broken": "BROKEN", "broken": "BROKEN",
"error": "ERROR", "error": "ERROR"
"unknown": "UNKNOWN"
}, },
"notifications": { "notifications": {
"machineFinishedTitle": "Laundry Ready", "machineFinishedTitle": "Laundry Ready",

View file

@ -182,10 +182,8 @@
"finished": "Cette machine est terminée. Si vous l'avez démarrée, vous pouvez récupérer votre linge.", "finished": "Cette machine est terminée. Si vous l'avez démarrée, vous pouvez récupérer votre linge.",
"ready": "Cette machine est vide et prête à être utilisée.", "ready": "Cette machine est vide et prête à être utilisée.",
"running": "Cette machine a démarré à %{start} et terminera à %{end}.\nTemps restant : %{remaining} min", "running": "Cette machine a démarré à %{start} et terminera à %{end}.\nTemps restant : %{remaining} min",
"runningNotStarted": "Cette machine est prête mais n'est pas démarrée. Assurez vous de bien avoir appuyé sur le bouton start.",
"broken": "Cette machine est hors service. Merci pour votre compréhension.", "broken": "Cette machine est hors service. Merci pour votre compréhension.",
"error": "Il y a eu une erreur et il est impossible de récupérer les informations de cette machine. Veuillez nous excuser pour le gène occasionnée.", "error": "Il y a eu une erreur et il est impossible de récupérer les informations de cette machine. Veuillez nous excuser pour le gène occasionnée.",
"unknown": "Cette machine est dans un état inconnu. Veuillez nous excuser pour ce problème.",
"notificationErrorTitle": "Erreur", "notificationErrorTitle": "Erreur",
"notificationErrorDescription": "Impossible de créer les notifications. Merci de vérifier que vous avez activé les notifications puis redémarrez l'appli." "notificationErrorDescription": "Impossible de créer les notifications. Merci de vérifier que vous avez activé les notifications puis redémarrez l'appli."
}, },
@ -193,10 +191,8 @@
"finished": "TERMINÉ", "finished": "TERMINÉ",
"ready": "DISPONIBLE", "ready": "DISPONIBLE",
"running": "EN COURS", "running": "EN COURS",
"runningNotStarted": "NON DÉMARRÉE",
"broken": "HORS SERVICE", "broken": "HORS SERVICE",
"error": "ERREUR", "error": "ERREUR"
"unknown": "INCONNU"
}, },
"notifications": { "notifications": {
"machineFinishedTitle": "Linge prêt", "machineFinishedTitle": "Linge prêt",