Compare commits
No commits in common. "2c3f89816bdd893cf4231dea5ded30cb3974848e" and "d5e1e6c7eb40d0b8b4ab79fbcab746155083c167" have entirely different histories.
2c3f89816b
...
d5e1e6c7eb
4 changed files with 61 additions and 53 deletions
|
|
@ -99,9 +99,7 @@ class WebSectionList<T> extends React.PureComponent<PropsType<T>, StateType> {
|
||||||
*/
|
*/
|
||||||
onScreenFocus = () => {
|
onScreenFocus = () => {
|
||||||
const {props} = this;
|
const {props} = this;
|
||||||
if (props.refreshOnFocus && this.lastRefresh) {
|
if (props.refreshOnFocus && this.lastRefresh) this.onRefresh();
|
||||||
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,26 +17,4 @@ 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,11 +6,10 @@ 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 LaundromatType = {
|
export type LaverieType = {
|
||||||
id: string,
|
id: string,
|
||||||
title: string,
|
title: string,
|
||||||
subtitle: string,
|
subtitle: string,
|
||||||
|
|
@ -21,11 +20,36 @@ export type LaundromatType = {
|
||||||
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: LaundromatType): React.Node {
|
static getCardItem(item: LaverieType): React.Node {
|
||||||
return (
|
return (
|
||||||
<Card style={{margin: 5}}>
|
<Card style={{margin: 5}}>
|
||||||
<Card.Title
|
<Card.Title
|
||||||
|
|
@ -64,9 +88,9 @@ export default class ProxiwashAboutScreen extends React.Component<null> {
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
{ProxiwashAboutScreen.getCardItem(ProxiwashConstants.washinsa)}
|
{ProxiwashAboutScreen.getCardItem(PROXIWASH_DATA.washinsa)}
|
||||||
|
|
||||||
{ProxiwashAboutScreen.getCardItem(ProxiwashConstants.tripodeB)}
|
{ProxiwashAboutScreen.getCardItem(PROXIWASH_DATA.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, Text, withTheme} from 'react-native-paper';
|
import {Avatar, Button, Card, List, 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,7 +26,8 @@ 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 {LaundromatType} from './ProxiwashAboutScreen';
|
import type {ListIconPropsType} from '../../constants/PaperStyles';
|
||||||
|
import {PROXIWASH_DATA} from './ProxiwashAboutScreen';
|
||||||
|
|
||||||
const modalStateStrings = {};
|
const modalStateStrings = {};
|
||||||
|
|
||||||
|
|
@ -122,11 +123,6 @@ 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"
|
||||||
|
|
@ -135,19 +131,6 @@ 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
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -360,6 +343,31 @@ 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
|
||||||
*
|
*
|
||||||
|
|
@ -464,13 +472,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: LaundromatType;
|
let data: LaverieType;
|
||||||
switch (state.selectedWash) {
|
switch (state.selectedWash) {
|
||||||
case 'tripodeB':
|
case 'tripodeB':
|
||||||
data = ProxiwashConstants.tripodeB;
|
data = PROXIWASH_DATA.tripodeB;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
data = ProxiwashConstants.washinsa;
|
data = PROXIWASH_DATA.washinsa;
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<View
|
<View
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue