Compare commits
5 commits
d5e1e6c7eb
...
2c3f89816b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2c3f89816b | ||
|
|
538d4d2187 | ||
|
|
b654a928a2 | ||
|
|
b27864858b | ||
|
|
61647ce6ec |
4 changed files with 53 additions and 61 deletions
|
|
@ -99,7 +99,9 @@ class WebSectionList<T> extends React.PureComponent<PropsType<T>, StateType> {
|
||||||
*/
|
*/
|
||||||
onScreenFocus = () => {
|
onScreenFocus = () => {
|
||||||
const {props} = this;
|
const {props} = this;
|
||||||
if (props.refreshOnFocus && this.lastRefresh) this.onRefresh();
|
if (props.refreshOnFocus && this.lastRefresh) {
|
||||||
|
setTimeout(this.onRefresh, 200);
|
||||||
|
}
|
||||||
if (props.autoRefreshTime > 0)
|
if (props.autoRefreshTime > 0)
|
||||||
this.refreshInterval = setInterval(this.onRefresh, props.autoRefreshTime);
|
this.refreshInterval = setInterval(this.onRefresh, props.autoRefreshTime);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -17,4 +17,26 @@ export default {
|
||||||
5: 'alert',
|
5: 'alert',
|
||||||
6: 'help-circle-outline',
|
6: 'help-circle-outline',
|
||||||
},
|
},
|
||||||
|
washinsa: {
|
||||||
|
id: 'washinsa',
|
||||||
|
title: 'screens.proxiwash.washinsa.title',
|
||||||
|
subtitle: 'screens.proxiwash.washinsa.subtitle',
|
||||||
|
description: 'screens.proxiwash.washinsa.description',
|
||||||
|
tarif: 'screens.proxiwash.washinsa.tariff',
|
||||||
|
paymentMethods: 'screens.proxiwash.washinsa.paymentMethods',
|
||||||
|
icon: 'school-outline',
|
||||||
|
url:
|
||||||
|
'https://etud.insa-toulouse.fr/~amicale_app/v2/washinsa/washinsa_data.json',
|
||||||
|
},
|
||||||
|
tripodeB: {
|
||||||
|
id: 'tripodeB',
|
||||||
|
title: 'screens.proxiwash.tripodeB.title',
|
||||||
|
subtitle: 'screens.proxiwash.tripodeB.subtitle',
|
||||||
|
description: 'screens.proxiwash.tripodeB.description',
|
||||||
|
tarif: 'screens.proxiwash.tripodeB.tariff',
|
||||||
|
paymentMethods: 'screens.proxiwash.tripodeB.paymentMethods',
|
||||||
|
icon: 'domain',
|
||||||
|
url:
|
||||||
|
'https://etud.insa-toulouse.fr/~amicale_app/v2/washinsa/tripode_b_data.json',
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,11 @@ import i18n from 'i18n-js';
|
||||||
import {Card, Avatar, Paragraph, Title} from 'react-native-paper';
|
import {Card, Avatar, Paragraph, Title} from 'react-native-paper';
|
||||||
import CollapsibleScrollView from '../../components/Collapsible/CollapsibleScrollView';
|
import CollapsibleScrollView from '../../components/Collapsible/CollapsibleScrollView';
|
||||||
import type {CardTitleIconPropsType} from '../../constants/PaperStyles';
|
import type {CardTitleIconPropsType} from '../../constants/PaperStyles';
|
||||||
|
import ProxiwashConstants from '../../constants/ProxiwashConstants';
|
||||||
|
|
||||||
const LOGO = 'https://etud.insa-toulouse.fr/~amicale_app/images/Proxiwash.png';
|
const LOGO = 'https://etud.insa-toulouse.fr/~amicale_app/images/Proxiwash.png';
|
||||||
|
|
||||||
export type LaverieType = {
|
export type LaundromatType = {
|
||||||
id: string,
|
id: string,
|
||||||
title: string,
|
title: string,
|
||||||
subtitle: string,
|
subtitle: string,
|
||||||
|
|
@ -20,36 +21,11 @@ export type LaverieType = {
|
||||||
url: string,
|
url: string,
|
||||||
};
|
};
|
||||||
|
|
||||||
export const PROXIWASH_DATA = {
|
|
||||||
washinsa: {
|
|
||||||
id: 'washinsa',
|
|
||||||
title: 'screens.proxiwash.washinsa.title',
|
|
||||||
subtitle: 'screens.proxiwash.washinsa.subtitle',
|
|
||||||
description: 'screens.proxiwash.washinsa.description',
|
|
||||||
tarif: 'screens.proxiwash.washinsa.tariff',
|
|
||||||
paymentMethods: 'screens.proxiwash.washinsa.paymentMethods',
|
|
||||||
icon: 'school-outline',
|
|
||||||
url:
|
|
||||||
'https://etud.insa-toulouse.fr/~amicale_app/v2/washinsa/washinsa_data.json',
|
|
||||||
},
|
|
||||||
tripodeB: {
|
|
||||||
id: 'tripodeB',
|
|
||||||
title: 'screens.proxiwash.tripodeB.title',
|
|
||||||
subtitle: 'screens.proxiwash.tripodeB.subtitle',
|
|
||||||
description: 'screens.proxiwash.tripodeB.description',
|
|
||||||
tarif: 'screens.proxiwash.tripodeB.tariff',
|
|
||||||
paymentMethods: 'screens.proxiwash.tripodeB.paymentMethods',
|
|
||||||
icon: 'domain',
|
|
||||||
url:
|
|
||||||
'https://etud.insa-toulouse.fr/~amicale_app/v2/washinsa/tripode_b_data.json',
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class defining the proxiwash about screen.
|
* Class defining the proxiwash about screen.
|
||||||
*/
|
*/
|
||||||
export default class ProxiwashAboutScreen extends React.Component<null> {
|
export default class ProxiwashAboutScreen extends React.Component<null> {
|
||||||
static getCardItem(item: LaverieType): React.Node {
|
static getCardItem(item: LaundromatType): React.Node {
|
||||||
return (
|
return (
|
||||||
<Card style={{margin: 5}}>
|
<Card style={{margin: 5}}>
|
||||||
<Card.Title
|
<Card.Title
|
||||||
|
|
@ -88,9 +64,9 @@ export default class ProxiwashAboutScreen extends React.Component<null> {
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
{ProxiwashAboutScreen.getCardItem(PROXIWASH_DATA.washinsa)}
|
{ProxiwashAboutScreen.getCardItem(ProxiwashConstants.washinsa)}
|
||||||
|
|
||||||
{ProxiwashAboutScreen.getCardItem(PROXIWASH_DATA.tripodeB)}
|
{ProxiwashAboutScreen.getCardItem(ProxiwashConstants.tripodeB)}
|
||||||
|
|
||||||
<Card style={{margin: 5}}>
|
<Card style={{margin: 5}}>
|
||||||
<Card.Title
|
<Card.Title
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import {Alert, View} from 'react-native';
|
import {Alert, View} from 'react-native';
|
||||||
import i18n from 'i18n-js';
|
import i18n from 'i18n-js';
|
||||||
import {Avatar, Button, Card, List, Text, withTheme} from 'react-native-paper';
|
import {Avatar, Button, Card, Text, withTheme} from 'react-native-paper';
|
||||||
import {StackNavigationProp} from '@react-navigation/stack';
|
import {StackNavigationProp} from '@react-navigation/stack';
|
||||||
import {Modalize} from 'react-native-modalize';
|
import {Modalize} from 'react-native-modalize';
|
||||||
import WebSectionList from '../../components/Screens/WebSectionList';
|
import WebSectionList from '../../components/Screens/WebSectionList';
|
||||||
|
|
@ -26,8 +26,7 @@ import {
|
||||||
import {MASCOT_STYLE} from '../../components/Mascot/Mascot';
|
import {MASCOT_STYLE} from '../../components/Mascot/Mascot';
|
||||||
import MascotPopup from '../../components/Mascot/MascotPopup';
|
import MascotPopup from '../../components/Mascot/MascotPopup';
|
||||||
import type {SectionListDataType} from '../../components/Screens/WebSectionList';
|
import type {SectionListDataType} from '../../components/Screens/WebSectionList';
|
||||||
import type {ListIconPropsType} from '../../constants/PaperStyles';
|
import type {LaundromatType} from './ProxiwashAboutScreen';
|
||||||
import {PROXIWASH_DATA} from './ProxiwashAboutScreen';
|
|
||||||
|
|
||||||
const modalStateStrings = {};
|
const modalStateStrings = {};
|
||||||
|
|
||||||
|
|
@ -123,6 +122,11 @@ class ProxiwashScreen extends React.Component<PropsType, StateType> {
|
||||||
navigation.setOptions({
|
navigation.setOptions({
|
||||||
headerRight: (): React.Node => (
|
headerRight: (): React.Node => (
|
||||||
<MaterialHeaderButtons>
|
<MaterialHeaderButtons>
|
||||||
|
<Item
|
||||||
|
title="switch"
|
||||||
|
iconName="swap-horizontal"
|
||||||
|
onPress={():void => navigation.navigate('settings')}
|
||||||
|
/>
|
||||||
<Item
|
<Item
|
||||||
title="information"
|
title="information"
|
||||||
iconName="information"
|
iconName="information"
|
||||||
|
|
@ -131,6 +135,19 @@ class ProxiwashScreen extends React.Component<PropsType, StateType> {
|
||||||
</MaterialHeaderButtons>
|
</MaterialHeaderButtons>
|
||||||
),
|
),
|
||||||
});
|
});
|
||||||
|
navigation.addListener('focus', this.onScreenFocus);
|
||||||
|
}
|
||||||
|
|
||||||
|
onScreenFocus = () => {
|
||||||
|
const {state} = this;
|
||||||
|
const selected = AsyncStorageManager.getString(
|
||||||
|
AsyncStorageManager.PREFERENCES.selectedWash.key,
|
||||||
|
);
|
||||||
|
if (selected !== state.selectedWash) {
|
||||||
|
this.setState({
|
||||||
|
selectedWash: selected
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -343,31 +360,6 @@ class ProxiwashScreen extends React.Component<PropsType, StateType> {
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets a chevron icon
|
|
||||||
*
|
|
||||||
* @param props
|
|
||||||
* @return {*}
|
|
||||||
*/
|
|
||||||
static getChevronIcon(props: ListIconPropsType): React.Node {
|
|
||||||
return (
|
|
||||||
<List.Icon color={props.color} style={props.style} icon="chevron-right" />
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets a custom list item icon
|
|
||||||
*
|
|
||||||
* @param item The item to show the icon for
|
|
||||||
* @param props
|
|
||||||
* @return {*}
|
|
||||||
*/
|
|
||||||
static getItemIcon(item: ListItemType, props: ListIconPropsType): React.Node {
|
|
||||||
return (
|
|
||||||
<List.Icon color={props.color} style={props.style} icon={item.icon} />
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the dataset to be used by the FlatList
|
* Creates the dataset to be used by the FlatList
|
||||||
*
|
*
|
||||||
|
|
@ -472,13 +464,13 @@ class ProxiwashScreen extends React.Component<PropsType, StateType> {
|
||||||
render(): React.Node {
|
render(): React.Node {
|
||||||
const {state} = this;
|
const {state} = this;
|
||||||
const {navigation} = this.props;
|
const {navigation} = this.props;
|
||||||
let data: LaverieType;
|
let data: LaundromatType;
|
||||||
switch (state.selectedWash) {
|
switch (state.selectedWash) {
|
||||||
case 'tripodeB':
|
case 'tripodeB':
|
||||||
data = PROXIWASH_DATA.tripodeB;
|
data = ProxiwashConstants.tripodeB;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
data = PROXIWASH_DATA.washinsa;
|
data = ProxiwashConstants.washinsa;
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<View
|
<View
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue