Compare commits
No commits in common. "9baaed9f6a26c0d6a33501f88105e947112407ce" and "e693636464fc9d413246824b0c47204a1c5ca313" have entirely different histories.
9baaed9f6a
...
e693636464
11 changed files with 81 additions and 232 deletions
|
|
@ -45,13 +45,13 @@
|
||||||
"react-native-gesture-handler": "~1.6.0",
|
"react-native-gesture-handler": "~1.6.0",
|
||||||
"react-native-image-modal": "^1.0.1",
|
"react-native-image-modal": "^1.0.1",
|
||||||
"react-native-modalize": "^1.3.6",
|
"react-native-modalize": "^1.3.6",
|
||||||
"react-native-paper": "^3.8.0",
|
"react-native-paper": "^3.6.0",
|
||||||
"react-native-reanimated": "~1.7.0",
|
"react-native-reanimated": "~1.7.0",
|
||||||
"react-native-render-html": "^4.1.2",
|
"react-native-render-html": "^4.1.2",
|
||||||
"react-native-safe-area-context": "0.7.3",
|
"react-native-safe-area-context": "0.7.3",
|
||||||
"react-native-screens": "~2.2.0",
|
"react-native-screens": "~2.2.0",
|
||||||
"react-native-webview": "8.1.1",
|
"react-native-webview": "8.1.1",
|
||||||
"react-navigation-collapsible": "^5.5.0",
|
"react-navigation-collapsible": "^5.4.0",
|
||||||
"react-navigation-header-buttons": "^3.0.5"
|
"react-navigation-header-buttons": "^3.0.5"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import {StyleSheet, View} from "react-native";
|
import {StyleSheet, View} from "react-native";
|
||||||
import {FAB, IconButton, Surface, withTheme} from "react-native-paper";
|
import {Button, IconButton, Surface, withTheme} from "react-native-paper";
|
||||||
import AutoHideComponent from "./AutoHideComponent";
|
import AutoHideComponent from "./AutoHideComponent";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
|
|
@ -41,9 +41,8 @@ class AnimatedBottomBar extends React.Component<Props, State> {
|
||||||
this.displayModeIcons[DISPLAY_MODES.MONTH] = "calendar-range";
|
this.displayModeIcons[DISPLAY_MODES.MONTH] = "calendar-range";
|
||||||
}
|
}
|
||||||
|
|
||||||
shouldComponentUpdate(nextProps: Props, nextState: State) {
|
shouldComponentUpdate(nextProps: Props) {
|
||||||
return (nextProps.currentGroup !== this.props.currentGroup)
|
return (nextProps.currentGroup !== this.props.currentGroup);
|
||||||
|| (nextState.currentMode !== this.state.currentMode);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onScroll = (event: Object) => {
|
onScroll = (event: Object) => {
|
||||||
|
|
@ -86,13 +85,13 @@ class AnimatedBottomBar extends React.Component<Props, State> {
|
||||||
style={{marginLeft: 5}}
|
style={{marginLeft: 5}}
|
||||||
onPress={() => this.props.onPress('today', undefined)}/>
|
onPress={() => this.props.onPress('today', undefined)}/>
|
||||||
</View>
|
</View>
|
||||||
<View style={styles.fabContainer}>
|
<Button
|
||||||
<FAB
|
icon="book-variant"
|
||||||
style={styles.fab}
|
|
||||||
icon="account-clock"
|
|
||||||
onPress={() => this.props.navigation.navigate('group-select')}
|
onPress={() => this.props.navigation.navigate('group-select')}
|
||||||
/>
|
style={{maxWidth: '40%'}}
|
||||||
</View>
|
>
|
||||||
|
{this.props.currentGroup.replace(/_/g, " ")}
|
||||||
|
</Button>
|
||||||
<View style={{flexDirection: 'row'}}>
|
<View style={{flexDirection: 'row'}}>
|
||||||
<IconButton
|
<IconButton
|
||||||
icon="chevron-left"
|
icon="chevron-left"
|
||||||
|
|
@ -118,25 +117,13 @@ const styles = StyleSheet.create({
|
||||||
width: '90%',
|
width: '90%',
|
||||||
},
|
},
|
||||||
surface: {
|
surface: {
|
||||||
position: 'relative',
|
|
||||||
flexDirection: 'row',
|
flexDirection: 'row',
|
||||||
justifyContent: 'space-between',
|
justifyContent: 'space-between',
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
borderRadius: 50,
|
borderRadius: 50,
|
||||||
elevation: 2,
|
elevation: 2,
|
||||||
},
|
padding: 10,
|
||||||
fabContainer: {
|
paddingHorizontal: 20,
|
||||||
position: "absolute",
|
|
||||||
left: 0,
|
|
||||||
right: 0,
|
|
||||||
alignItems: "center",
|
|
||||||
width: '100%',
|
|
||||||
height: '100%'
|
|
||||||
},
|
|
||||||
fab: {
|
|
||||||
position: 'absolute',
|
|
||||||
alignSelf: 'center',
|
|
||||||
top: -10,
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,9 +12,6 @@ type Props = {
|
||||||
route: Object,
|
route: Object,
|
||||||
errorCode: number,
|
errorCode: number,
|
||||||
onRefresh: Function,
|
onRefresh: Function,
|
||||||
icon: string,
|
|
||||||
message: string,
|
|
||||||
showRetryButton: boolean,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type State = {
|
type State = {
|
||||||
|
|
@ -30,13 +27,6 @@ class ErrorView extends React.PureComponent<Props, State> {
|
||||||
|
|
||||||
showLoginButton: boolean;
|
showLoginButton: boolean;
|
||||||
|
|
||||||
static defaultProps = {
|
|
||||||
errorCode: 0,
|
|
||||||
icon: '',
|
|
||||||
message: '',
|
|
||||||
showRetryButton: true,
|
|
||||||
}
|
|
||||||
|
|
||||||
state = {
|
state = {
|
||||||
refreshing: false,
|
refreshing: false,
|
||||||
};
|
};
|
||||||
|
|
@ -48,7 +38,6 @@ class ErrorView extends React.PureComponent<Props, State> {
|
||||||
|
|
||||||
generateMessage() {
|
generateMessage() {
|
||||||
this.showLoginButton = false;
|
this.showLoginButton = false;
|
||||||
if (this.props.errorCode !== 0) {
|
|
||||||
switch (this.props.errorCode) {
|
switch (this.props.errorCode) {
|
||||||
case ERROR_TYPE.BAD_CREDENTIALS:
|
case ERROR_TYPE.BAD_CREDENTIALS:
|
||||||
this.message = i18n.t("errors.badCredentials");
|
this.message = i18n.t("errors.badCredentials");
|
||||||
|
|
@ -84,11 +73,6 @@ class ErrorView extends React.PureComponent<Props, State> {
|
||||||
this.icon = "alert-circle-outline";
|
this.icon = "alert-circle-outline";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
this.message = this.props.message;
|
|
||||||
this.icon = this.props.icon;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getRetryButton() {
|
getRetryButton() {
|
||||||
|
|
@ -107,8 +91,7 @@ class ErrorView extends React.PureComponent<Props, State> {
|
||||||
{
|
{
|
||||||
screen: 'login',
|
screen: 'login',
|
||||||
params: {nextScreen: this.props.route.name}
|
params: {nextScreen: this.props.route.name}
|
||||||
})
|
})};
|
||||||
};
|
|
||||||
|
|
||||||
getLoginButton() {
|
getLoginButton() {
|
||||||
return <Button
|
return <Button
|
||||||
|
|
@ -141,11 +124,9 @@ class ErrorView extends React.PureComponent<Props, State> {
|
||||||
}}>
|
}}>
|
||||||
{this.message}
|
{this.message}
|
||||||
</Subheading>
|
</Subheading>
|
||||||
{this.props.showRetryButton
|
{this.showLoginButton
|
||||||
? (this.showLoginButton
|
|
||||||
? this.getLoginButton()
|
? this.getLoginButton()
|
||||||
: this.getRetryButton())
|
: this.getRetryButton()}
|
||||||
: null}
|
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
|
|
@ -167,7 +148,6 @@ const styles = StyleSheet.create({
|
||||||
},
|
},
|
||||||
subheading: {
|
subheading: {
|
||||||
textAlign: 'center',
|
textAlign: 'center',
|
||||||
paddingHorizontal: 20
|
|
||||||
},
|
},
|
||||||
button: {
|
button: {
|
||||||
marginTop: 10,
|
marginTop: 10,
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,15 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import {IconButton, List, withTheme} from 'react-native-paper';
|
import {List} from 'react-native-paper';
|
||||||
import {FlatList} from "react-native";
|
import {FlatList} from "react-native";
|
||||||
import {stringMatchQuery} from "../../utils/Search";
|
import {stringMatchQuery} from "../../utils/Search";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
item: Object,
|
item: Object,
|
||||||
onGroupPress: Function,
|
onGroupPress: Function,
|
||||||
onFavoritePress: Function,
|
|
||||||
currentSearchString: string,
|
currentSearchString: string,
|
||||||
favoriteNumber: number,
|
|
||||||
height: number,
|
height: number,
|
||||||
theme: Object,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type State = {
|
type State = {
|
||||||
|
|
@ -21,13 +18,12 @@ type State = {
|
||||||
|
|
||||||
const LIST_ITEM_HEIGHT = 64;
|
const LIST_ITEM_HEIGHT = 64;
|
||||||
|
|
||||||
class GroupListAccordion extends React.Component<Props, State> {
|
const REPLACE_REGEX = /_/g;
|
||||||
|
|
||||||
constructor(props) {
|
export default class GroupListAccordion extends React.Component<Props, State> {
|
||||||
super(props);
|
|
||||||
this.state = {
|
state = {
|
||||||
expanded: props.item.id === "0",
|
expanded: false,
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
shouldComponentUpdate(nextProps: Props, nextSate: State) {
|
shouldComponentUpdate(nextProps: Props, nextSate: State) {
|
||||||
|
|
@ -35,37 +31,28 @@ class GroupListAccordion extends React.Component<Props, State> {
|
||||||
this.state.expanded = nextProps.currentSearchString.length > 0;
|
this.state.expanded = nextProps.currentSearchString.length > 0;
|
||||||
|
|
||||||
return (nextProps.currentSearchString !== this.props.currentSearchString)
|
return (nextProps.currentSearchString !== this.props.currentSearchString)
|
||||||
|| (nextSate.expanded !== this.state.expanded)
|
|| (nextSate.expanded !== this.state.expanded);
|
||||||
|| (nextProps.favoriteNumber !== this.props.favoriteNumber);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onPress = () => this.setState({expanded: !this.state.expanded});
|
onPress = () => this.setState({expanded: !this.state.expanded});
|
||||||
|
|
||||||
keyExtractor = (item: Object) => item.id.toString();
|
keyExtractor = (item: Object) => item.id.toString();
|
||||||
|
|
||||||
isItemFavorite(item: Object) {
|
|
||||||
return item.isFav !== undefined && item.isFav;
|
|
||||||
}
|
|
||||||
|
|
||||||
renderItem = ({item}: Object) => {
|
renderItem = ({item}: Object) => {
|
||||||
if (stringMatchQuery(item.name, this.props.currentSearchString)) {
|
if (stringMatchQuery(item.name, this.props.currentSearchString)) {
|
||||||
const onPress = () => this.props.onGroupPress(item);
|
const onPress = () => this.props.onGroupPress(item);
|
||||||
const onStartPress = () => this.props.onFavoritePress(item);
|
|
||||||
return (
|
return (
|
||||||
<List.Item
|
<List.Item
|
||||||
title={item.name}
|
title={item.name.replace(REPLACE_REGEX, " ")}
|
||||||
onPress={onPress}
|
onPress={onPress}
|
||||||
left={props =>
|
left={props =>
|
||||||
<List.Icon
|
<List.Icon
|
||||||
{...props}
|
{...props}
|
||||||
icon={"chevron-right"}/>}
|
icon={"chevron-right"}/>}
|
||||||
right={props =>
|
right={props =>
|
||||||
<IconButton
|
<List.Icon
|
||||||
{...props}
|
{...props}
|
||||||
icon={"star"}
|
icon={"star"}/>}
|
||||||
onPress={onStartPress}
|
|
||||||
color={this.isItemFavorite(item) ? this.props.theme.colors.tetrisScore : props.color}
|
|
||||||
/>}
|
|
||||||
style={{
|
style={{
|
||||||
height: LIST_ITEM_HEIGHT,
|
height: LIST_ITEM_HEIGHT,
|
||||||
justifyContent: 'center',
|
justifyContent: 'center',
|
||||||
|
|
@ -89,14 +76,6 @@ class GroupListAccordion extends React.Component<Props, State> {
|
||||||
height: this.props.height,
|
height: this.props.height,
|
||||||
justifyContent: 'center',
|
justifyContent: 'center',
|
||||||
}}
|
}}
|
||||||
left={props =>
|
|
||||||
item.id === "0"
|
|
||||||
? <List.Icon
|
|
||||||
{...props}
|
|
||||||
icon={"star"}
|
|
||||||
color={this.props.theme.colors.tetrisScore}
|
|
||||||
/>
|
|
||||||
: null}
|
|
||||||
>
|
>
|
||||||
{/*$FlowFixMe*/}
|
{/*$FlowFixMe*/}
|
||||||
<FlatList
|
<FlatList
|
||||||
|
|
@ -113,5 +92,3 @@ class GroupListAccordion extends React.Component<Props, State> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default withTheme(GroupListAccordion)
|
|
||||||
|
|
@ -84,11 +84,6 @@ export default class AsyncStorageManager {
|
||||||
default: '',
|
default: '',
|
||||||
current: '',
|
current: '',
|
||||||
},
|
},
|
||||||
planexFavoriteGroups: {
|
|
||||||
key: 'planexFavoriteGroups',
|
|
||||||
default: '[]',
|
|
||||||
current: '',
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -58,8 +58,4 @@ export default class DateManager {
|
||||||
return this.daysOfWeek[date.getDay()] + " " + date.getDate() + " " + this.monthsOfYear[date.getMonth()] + " " + date.getFullYear();
|
return this.daysOfWeek[date.getDay()] + " " + date.getDate() + " " + this.monthsOfYear[date.getMonth()] + " " + date.getFullYear();
|
||||||
}
|
}
|
||||||
|
|
||||||
static isWeekend(date: Date) {
|
|
||||||
return date.getDay() === 6 || date.getDay() === 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -291,9 +291,6 @@ function PlanexStackComponent() {
|
||||||
options={({navigation}) => {
|
options={({navigation}) => {
|
||||||
return {
|
return {
|
||||||
title: 'GroupSelectionScreen',
|
title: 'GroupSelectionScreen',
|
||||||
headerStyle: {
|
|
||||||
backgroundColor: colors.surface,
|
|
||||||
},
|
|
||||||
...TransitionPresets.ModalSlideFromBottomIOS,
|
...TransitionPresets.ModalSlideFromBottomIOS,
|
||||||
};
|
};
|
||||||
}}
|
}}
|
||||||
|
|
@ -348,14 +345,11 @@ class TabNavigator extends React.Component<Props> {
|
||||||
>
|
>
|
||||||
<Tab.Screen
|
<Tab.Screen
|
||||||
name="proximo"
|
name="proximo"
|
||||||
option
|
|
||||||
component={ProximoStackComponent}
|
component={ProximoStackComponent}
|
||||||
options={{title: i18n.t('screens.proximo')}}
|
|
||||||
/>
|
/>
|
||||||
<Tab.Screen
|
<Tab.Screen
|
||||||
name="planning"
|
name="planning"
|
||||||
component={PlanningStackComponent}
|
component={PlanningStackComponent}
|
||||||
options={{title: i18n.t('screens.planning')}}
|
|
||||||
/>
|
/>
|
||||||
<Tab.Screen
|
<Tab.Screen
|
||||||
name="home"
|
name="home"
|
||||||
|
|
@ -365,12 +359,10 @@ class TabNavigator extends React.Component<Props> {
|
||||||
<Tab.Screen
|
<Tab.Screen
|
||||||
name="proxiwash"
|
name="proxiwash"
|
||||||
component={ProxiwashStackComponent}
|
component={ProxiwashStackComponent}
|
||||||
options={{title: i18n.t('screens.proxiwash')}}
|
|
||||||
/>
|
/>
|
||||||
<Tab.Screen
|
<Tab.Screen
|
||||||
name="planex"
|
name="planex"
|
||||||
component={PlanexStackComponent}
|
component={PlanexStackComponent}
|
||||||
options={{title: "Planex"}}
|
|
||||||
/>
|
/>
|
||||||
</Tab.Navigator>
|
</Tab.Navigator>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@ import {Searchbar, withTheme} from "react-native-paper";
|
||||||
import {stringMatchQuery} from "../utils/Search";
|
import {stringMatchQuery} from "../utils/Search";
|
||||||
import WebSectionList from "../components/Lists/WebSectionList";
|
import WebSectionList from "../components/Lists/WebSectionList";
|
||||||
import GroupListAccordion from "../components/Lists/GroupListAccordion";
|
import GroupListAccordion from "../components/Lists/GroupListAccordion";
|
||||||
import AsyncStorageManager from "../managers/AsyncStorageManager";
|
|
||||||
|
|
||||||
const LIST_ITEM_HEIGHT = 70;
|
const LIST_ITEM_HEIGHT = 70;
|
||||||
|
|
||||||
|
|
@ -20,7 +19,6 @@ type Props = {
|
||||||
|
|
||||||
type State = {
|
type State = {
|
||||||
currentSearchString: string,
|
currentSearchString: string,
|
||||||
favoriteGroups: Array<Object>,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
function sortName(a, b) {
|
function sortName(a, b) {
|
||||||
|
|
@ -32,7 +30,6 @@ function sortName(a, b) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const GROUPS_URL = 'http://planex.insa-toulouse.fr/wsAdeGrp.php?projectId=1';
|
const GROUPS_URL = 'http://planex.insa-toulouse.fr/wsAdeGrp.php?projectId=1';
|
||||||
const REPLACE_REGEX = /_/g;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class defining proximo's article list of a certain category.
|
* Class defining proximo's article list of a certain category.
|
||||||
|
|
@ -43,7 +40,6 @@ class GroupSelectionScreen extends React.Component<Props, State> {
|
||||||
super(props);
|
super(props);
|
||||||
this.state = {
|
this.state = {
|
||||||
currentSearchString: '',
|
currentSearchString: '',
|
||||||
favoriteGroups: JSON.parse(AsyncStorageManager.getInstance().preferences.planexFavoriteGroups.current),
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -96,49 +92,6 @@ class GroupSelectionScreen extends React.Component<Props, State> {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
onListFavoritePress = (item: Object) => {
|
|
||||||
this.updateGroupFavorites(item);
|
|
||||||
};
|
|
||||||
|
|
||||||
isGroupInFavorites(group: Object) {
|
|
||||||
let isFav = false;
|
|
||||||
for (let i = 0; i < this.state.favoriteGroups.length; i++) {
|
|
||||||
if (group.id === this.state.favoriteGroups[i].id) {
|
|
||||||
isFav = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return isFav;
|
|
||||||
}
|
|
||||||
|
|
||||||
removeGroupFromFavorites(favorites: Array<Object>, group: Object) {
|
|
||||||
for (let i = 0; i < favorites.length; i++) {
|
|
||||||
if (group.id === favorites[i].id) {
|
|
||||||
favorites.splice(i, 1);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
addGroupToFavorites(favorites: Array<Object>, group: Object) {
|
|
||||||
group.isFav = true;
|
|
||||||
favorites.push(group);
|
|
||||||
favorites.sort(sortName);
|
|
||||||
}
|
|
||||||
|
|
||||||
updateGroupFavorites(group: Object) {
|
|
||||||
let newFavorites = [...this.state.favoriteGroups]
|
|
||||||
if (this.isGroupInFavorites(group))
|
|
||||||
this.removeGroupFromFavorites(newFavorites, group);
|
|
||||||
else
|
|
||||||
this.addGroupToFavorites(newFavorites, group);
|
|
||||||
this.setState({favoriteGroups: newFavorites})
|
|
||||||
console.log(newFavorites);
|
|
||||||
AsyncStorageManager.getInstance().savePref(
|
|
||||||
AsyncStorageManager.getInstance().preferences.planexFavoriteGroups.key,
|
|
||||||
JSON.stringify(newFavorites));
|
|
||||||
}
|
|
||||||
|
|
||||||
shouldDisplayAccordion(item: Object) {
|
shouldDisplayAccordion(item: Object) {
|
||||||
let shouldDisplay = false;
|
let shouldDisplay = false;
|
||||||
for (let i = 0; i < item.content.length; i++) {
|
for (let i = 0; i < item.content.length; i++) {
|
||||||
|
|
@ -162,9 +115,7 @@ class GroupSelectionScreen extends React.Component<Props, State> {
|
||||||
<GroupListAccordion
|
<GroupListAccordion
|
||||||
item={item}
|
item={item}
|
||||||
onGroupPress={this.onListItemPress}
|
onGroupPress={this.onListItemPress}
|
||||||
onFavoritePress={this.onListFavoritePress}
|
|
||||||
currentSearchString={this.state.currentSearchString}
|
currentSearchString={this.state.currentSearchString}
|
||||||
favoriteNumber={this.state.favoriteGroups.length}
|
|
||||||
height={LIST_ITEM_HEIGHT}
|
height={LIST_ITEM_HEIGHT}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
@ -175,21 +126,12 @@ class GroupSelectionScreen extends React.Component<Props, State> {
|
||||||
generateData(fetchedData: Object) {
|
generateData(fetchedData: Object) {
|
||||||
let data = [];
|
let data = [];
|
||||||
for (let key in fetchedData) {
|
for (let key in fetchedData) {
|
||||||
this.formatGroups(fetchedData[key]);
|
|
||||||
data.push(fetchedData[key]);
|
data.push(fetchedData[key]);
|
||||||
}
|
}
|
||||||
data.sort(sortName);
|
data.sort(sortName);
|
||||||
data.unshift({name: "FAVORITES", id: "0", content: this.state.favoriteGroups});
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
formatGroups(item: Object) {
|
|
||||||
for (let i = 0; i < item.content.length; i++) {
|
|
||||||
item.content[i].name = item.content[i].name.replace(REPLACE_REGEX, " ")
|
|
||||||
item.content[i].isFav = this.isGroupInFavorites(item.content[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the dataset to be used in the FlatList
|
* Creates the dataset to be used in the FlatList
|
||||||
*
|
*
|
||||||
|
|
@ -217,7 +159,7 @@ class GroupSelectionScreen extends React.Component<Props, State> {
|
||||||
refreshOnFocus={false}
|
refreshOnFocus={false}
|
||||||
fetchUrl={GROUPS_URL}
|
fetchUrl={GROUPS_URL}
|
||||||
renderItem={this.renderItem}
|
renderItem={this.renderItem}
|
||||||
updateData={this.state.currentSearchString + this.state.favoriteGroups.length}
|
updateData={this.state.currentSearchString}
|
||||||
itemHeight={LIST_ITEM_HEIGHT}
|
itemHeight={LIST_ITEM_HEIGHT}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,6 @@ import {dateToString, getTimeOnlyString} from "../../utils/Planning";
|
||||||
import DateManager from "../../managers/DateManager";
|
import DateManager from "../../managers/DateManager";
|
||||||
import AnimatedBottomBar from "../../components/Custom/AnimatedBottomBar";
|
import AnimatedBottomBar from "../../components/Custom/AnimatedBottomBar";
|
||||||
import {CommonActions} from "@react-navigation/native";
|
import {CommonActions} from "@react-navigation/native";
|
||||||
import ErrorView from "../../components/Custom/ErrorView";
|
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
navigation: Object,
|
navigation: Object,
|
||||||
|
|
@ -137,18 +136,16 @@ class PlanexScreen extends React.Component<Props, State> {
|
||||||
/**
|
/**
|
||||||
* Defines custom injected JavaScript to improve the page display on mobile
|
* Defines custom injected JavaScript to improve the page display on mobile
|
||||||
*/
|
*/
|
||||||
constructor(props) {
|
constructor() {
|
||||||
super(props);
|
super();
|
||||||
this.webScreenRef = React.createRef();
|
this.webScreenRef = React.createRef();
|
||||||
this.barRef = React.createRef();
|
this.barRef = React.createRef();
|
||||||
|
|
||||||
let currentGroup = AsyncStorageManager.getInstance().preferences.planexCurrentGroup.current;
|
let currentGroup = AsyncStorageManager.getInstance().preferences.planexCurrentGroup.current;
|
||||||
if (currentGroup === '')
|
if (currentGroup === '')
|
||||||
currentGroup = {name: "SELECT GROUP", id: -1};
|
currentGroup = {name: "SELECT GROUP", id: 0};
|
||||||
else {
|
else
|
||||||
currentGroup = JSON.parse(currentGroup);
|
currentGroup = JSON.parse(currentGroup);
|
||||||
props.navigation.setOptions({title: currentGroup.name})
|
|
||||||
}
|
|
||||||
this.state = {
|
this.state = {
|
||||||
bannerVisible:
|
bannerVisible:
|
||||||
AsyncStorageManager.getInstance().preferences.planexShowBanner.current === '1' &&
|
AsyncStorageManager.getInstance().preferences.planexShowBanner.current === '1' &&
|
||||||
|
|
@ -185,7 +182,6 @@ class PlanexScreen extends React.Component<Props, State> {
|
||||||
AsyncStorageManager.getInstance().savePref(
|
AsyncStorageManager.getInstance().savePref(
|
||||||
AsyncStorageManager.getInstance().preferences.planexCurrentGroup.key,
|
AsyncStorageManager.getInstance().preferences.planexCurrentGroup.key,
|
||||||
JSON.stringify(group));
|
JSON.stringify(group));
|
||||||
this.props.navigation.setOptions({title: group.name})
|
|
||||||
this.generateInjectedJS(group.id);
|
this.generateInjectedJS(group.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -194,7 +190,6 @@ class PlanexScreen extends React.Component<Props, State> {
|
||||||
+ OBSERVE_MUTATIONS_INJECTED
|
+ OBSERVE_MUTATIONS_INJECTED
|
||||||
+ FULL_CALENDAR_SETTINGS
|
+ FULL_CALENDAR_SETTINGS
|
||||||
+ "displayAde(" + groupID + ");" // Reset Ade
|
+ "displayAde(" + groupID + ");" // Reset Ade
|
||||||
+ (DateManager.isWeekend(new Date()) ? "calendar.next()" : "")
|
|
||||||
+ LISTEN_TO_MESSAGES
|
+ LISTEN_TO_MESSAGES
|
||||||
+ INJECT_STYLE;
|
+ INJECT_STYLE;
|
||||||
|
|
||||||
|
|
@ -265,19 +260,7 @@ class PlanexScreen extends React.Component<Props, State> {
|
||||||
};
|
};
|
||||||
|
|
||||||
getWebView() {
|
getWebView() {
|
||||||
const showWebview = this.state.currentGroup.id !== -1;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={{height: '100%'}}>
|
|
||||||
{!showWebview
|
|
||||||
? <ErrorView
|
|
||||||
{...this.props}
|
|
||||||
icon={'account-clock'}
|
|
||||||
message={i18n.t("planexScreen.noGroupSelected")}
|
|
||||||
showRetryButton={false}
|
|
||||||
/>
|
|
||||||
: null}
|
|
||||||
|
|
||||||
<WebViewScreen
|
<WebViewScreen
|
||||||
ref={this.webScreenRef}
|
ref={this.webScreenRef}
|
||||||
navigation={this.props.navigation}
|
navigation={this.props.navigation}
|
||||||
|
|
@ -286,7 +269,6 @@ class PlanexScreen extends React.Component<Props, State> {
|
||||||
onMessage={this.onMessage}
|
onMessage={this.onMessage}
|
||||||
onScroll={this.onScroll}
|
onScroll={this.onScroll}
|
||||||
/>
|
/>
|
||||||
</View>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -212,8 +212,7 @@
|
||||||
"planexScreen": {
|
"planexScreen": {
|
||||||
"enableStartScreen": "Come here often? Set it as default screen!",
|
"enableStartScreen": "Come here often? Set it as default screen!",
|
||||||
"enableStartOK": "Yes please!",
|
"enableStartOK": "Yes please!",
|
||||||
"enableStartCancel": "Later",
|
"enableStartCancel": "Later"
|
||||||
"noGroupSelected": "No group selected. Please select your group using the big beautiful red button bellow."
|
|
||||||
},
|
},
|
||||||
"availableRoomScreen": {
|
"availableRoomScreen": {
|
||||||
"normalRoom": "Work",
|
"normalRoom": "Work",
|
||||||
|
|
|
||||||
|
|
@ -212,8 +212,7 @@
|
||||||
"planexScreen": {
|
"planexScreen": {
|
||||||
"enableStartScreen": "Vous venez souvent ici ? Démarrez l'appli sur cette page!",
|
"enableStartScreen": "Vous venez souvent ici ? Démarrez l'appli sur cette page!",
|
||||||
"enableStartOK": "Oui svp!",
|
"enableStartOK": "Oui svp!",
|
||||||
"enableStartCancel": "Plus tard",
|
"enableStartCancel": "Plus tard"
|
||||||
"noGroupSelected": "Pas de group sélectionné. Merci de choisir un groupe avec le beau bouton rouge ci-dessous."
|
|
||||||
},
|
},
|
||||||
"availableRoomScreen": {
|
"availableRoomScreen": {
|
||||||
"normalRoom": "Travail",
|
"normalRoom": "Travail",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue