Compare commits

..

No commits in common. "b150ac55ef7af7be5cccc9d862d7bbabf7cdad02" and "44cb35d6d95a6a3c8b57899f35cfffa1b984bd52" have entirely different histories.

12 changed files with 81 additions and 100 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 24 versionCode 23
versionName "3.0.7" versionName "3.0.6"
missingDimensionStrategy 'react-native-camera', 'general' missingDimensionStrategy 'react-native-camera', 'general'
} }
splits { splits {

View file

@ -1,6 +1,6 @@
{ {
"name": "campus", "name": "campus",
"version": "3.0.7", "version": "3.0.6",
"private": true, "private": true,
"scripts": { "scripts": {
"start": "react-native start", "start": "react-native start",

View file

@ -21,7 +21,6 @@ type Props = {
theme: CustomTheme, theme: CustomTheme,
url: string, url: string,
customJS: string, customJS: string,
customPaddingFunction: null | (padding: number) => string,
collapsibleStack: Collapsible, collapsibleStack: Collapsible,
onMessage: Function, onMessage: Function,
onScroll: Function, onScroll: Function,
@ -38,7 +37,6 @@ class WebViewScreen extends React.PureComponent<Props> {
static defaultProps = { static defaultProps = {
customJS: '', customJS: '',
showAdvancedControls: true, showAdvancedControls: true,
customPaddingFunction: null,
}; };
webviewRef: Object; webviewRef: Object;
@ -159,10 +157,8 @@ class WebViewScreen extends React.PureComponent<Props> {
getRenderLoading = () => <BasicLoadingScreen isAbsolute={true}/>; getRenderLoading = () => <BasicLoadingScreen isAbsolute={true}/>;
getJavascriptPadding(padding: number) { getJavascriptPadding(padding: number) {
const customPadding = this.props.customPaddingFunction != null ? this.props.customPaddingFunction(padding) : "";
return ( return (
"document.getElementsByTagName('body')[0].style.paddingTop = '" + padding + "px';" + "document.getElementsByTagName('body')[0].style.paddingTop = '" + padding + "px';" +
customPadding +
"true;" "true;"
); );
} }

View file

@ -24,11 +24,6 @@ export default class AsyncStorageManager {
// Object storing preferences keys, default and current values for use in the app // Object storing preferences keys, default and current values for use in the app
preferences = { preferences = {
debugUnlocked: {
key: 'debugUnlocked',
default: '0',
current: '',
},
showIntro: { showIntro: {
key: 'showIntro', key: 'showIntro',
default: '1', default: '1',
@ -54,6 +49,16 @@ export default class AsyncStorageManager {
default: '1', default: '1',
current: '', current: '',
}, },
expoToken: {
key: 'expoToken',
default: '',
current: '',
},
debugUnlocked: {
key: 'debugUnlocked',
default: '0',
current: '',
},
defaultStartScreen: { defaultStartScreen: {
key: 'defaultStartScreen', key: 'defaultStartScreen',
default: 'home', default: 'home',

View file

@ -3,6 +3,7 @@
import * as React from 'react'; import * as React from 'react';
import {FlatList, Linking, Platform, View} from 'react-native'; import {FlatList, Linking, Platform, View} from 'react-native';
import i18n from "i18n-js"; import i18n from "i18n-js";
import AsyncStorageManager from "../../managers/AsyncStorageManager";
import {Avatar, Card, List, Title, withTheme} from 'react-native-paper'; import {Avatar, Card, List, Title, withTheme} from 'react-native-paper';
import packageJson from "../../../package.json"; import packageJson from "../../../package.json";
@ -31,6 +32,10 @@ type Props = {
navigation: Object, navigation: Object,
}; };
type State = {
isDebugUnlocked: boolean,
};
/** /**
* Opens a link in the device's browser * Opens a link in the device's browser
* @param link The link to open * @param link The link to open
@ -42,8 +47,14 @@ function openWebLink(link) {
/** /**
* Class defining an about screen. This screen shows the user information about the app and it's author. * Class defining an about screen. This screen shows the user information about the app and it's author.
*/ */
class AboutScreen extends React.Component<Props> { class AboutScreen extends React.Component<Props, State> {
debugTapCounter = 0;
modalRef: Object;
state = {
isDebugUnlocked: AsyncStorageManager.getInstance().preferences.debugUnlocked.current === '1'
};
/** /**
* Data to be displayed in the app card * Data to be displayed in the app card
*/ */
@ -78,13 +89,20 @@ class AboutScreen extends React.Component<Props> {
text: i18n.t('aboutScreen.license'), text: i18n.t('aboutScreen.license'),
showChevron: true showChevron: true
}, },
{
onPressCallback: () => this.props.navigation.navigate('debug'),
icon: 'bug-check',
text: i18n.t('aboutScreen.debug'),
showChevron: true,
showOnlyInDebug: true
},
]; ];
/** /**
* Data to be displayed in the author card * Data to be displayed in the author card
*/ */
authorData: Array<Object> = [ authorData: Array<Object> = [
{ {
onPressCallback: () => console.log('cc'), onPressCallback: () => this.tryUnlockDebugMode(),
icon: 'account-circle', icon: 'account-circle',
text: 'Arnaud VERGNET', text: 'Arnaud VERGNET',
showChevron: false showChevron: false
@ -205,6 +223,7 @@ class AboutScreen extends React.Component<Props> {
<Card.Content> <Card.Content>
<FlatList <FlatList
data={this.appData} data={this.appData}
extraData={this.state.isDebugUnlocked}
keyExtractor={this.keyExtractor} keyExtractor={this.keyExtractor}
renderItem={this.getCardItem} renderItem={this.getCardItem}
/> />
@ -295,27 +314,52 @@ class AboutScreen extends React.Component<Props> {
* @returns {*} * @returns {*}
*/ */
getCardItem = ({item}: Object) => { getCardItem = ({item}: Object) => {
let shouldShow = item === undefined
|| !item.showOnlyInDebug
|| (item.showOnlyInDebug && this.state.isDebugUnlocked);
const getItemIcon = this.getItemIcon.bind(this, item); const getItemIcon = this.getItemIcon.bind(this, item);
if (item.showChevron) { if (shouldShow) {
return ( if (item.showChevron) {
<List.Item return (
title={item.text} <List.Item
left={getItemIcon} title={item.text}
right={this.getChevronIcon} left={getItemIcon}
onPress={item.onPressCallback} right={this.getChevronIcon}
/> onPress={item.onPressCallback}
); />
} else { );
return ( } else {
<List.Item return (
title={item.text} <List.Item
left={getItemIcon} title={item.text}
onPress={item.onPressCallback} left={getItemIcon}
/> onPress={item.onPressCallback}
); />
} );
}
} else
return null;
}; };
/**
* Tries to unlock debug mode
*/
tryUnlockDebugMode() {
this.debugTapCounter = this.debugTapCounter + 1;
if (this.debugTapCounter >= 4) {
this.unlockDebugMode();
}
}
/**
* Unlocks debug mode
*/
unlockDebugMode() {
this.setState({isDebugUnlocked: true});
let key = AsyncStorageManager.getInstance().preferences.debugUnlocked.key;
AsyncStorageManager.getInstance().savePref(key, '1');
}
/** /**
* Gets a card, depending on the given item's id * Gets a card, depending on the given item's id
* *

View file

@ -174,9 +174,11 @@ class HomeScreen extends React.Component<Props, State> {
} }
const onPressSettings = () => this.props.navigation.navigate("settings"); const onPressSettings = () => this.props.navigation.navigate("settings");
const onPressAbout = () => this.props.navigation.navigate("about");
return <MaterialHeaderButtons> return <MaterialHeaderButtons>
<Item title="log" iconName={logIcon} color={logColor} onPress={onPressLog}/> <Item title="log" iconName={logIcon} color={logColor} onPress={onPressLog}/>
<Item title={i18n.t("screens.settings")} iconName={"settings"} onPress={onPressSettings}/> <Item title={i18n.t("screens.settings")} iconName={"settings"} onPress={onPressSettings}/>
<Item title={i18n.t("screens.about")} iconName={"information"} onPress={onPressAbout}/>
</MaterialHeaderButtons>; </MaterialHeaderButtons>;
}; };

View file

@ -123,8 +123,6 @@ class ScannerScreen extends React.Component<Props, State> {
maskOpacity={0.5} maskOpacity={0.5}
animatedLineThickness={1} animatedLineThickness={1}
animationDuration={1000} animationDuration={1000}
width={250}
height={250}
/> />
</RNCamera> </RNCamera>
); );

View file

@ -9,10 +9,8 @@ import AsyncStorageManager from "../../managers/AsyncStorageManager";
import {Card, List, Switch, ToggleButton, withTheme} from 'react-native-paper'; import {Card, List, Switch, ToggleButton, withTheme} from 'react-native-paper';
import {Appearance} from "react-native-appearance"; import {Appearance} from "react-native-appearance";
import CustomSlider from "../../components/Overrides/CustomSlider"; import CustomSlider from "../../components/Overrides/CustomSlider";
import {StackNavigationProp} from "@react-navigation/stack";
type Props = { type Props = {
navigation: StackNavigationProp,
theme: CustomTheme, theme: CustomTheme,
}; };
@ -21,7 +19,6 @@ type State = {
nightModeFollowSystem: boolean, nightModeFollowSystem: boolean,
notificationReminderSelected: number, notificationReminderSelected: number,
startScreenPickerSelected: string, startScreenPickerSelected: string,
isDebugUnlocked: boolean,
}; };
/** /**
@ -44,19 +41,9 @@ class SettingsScreen extends React.Component<Props, State> {
Appearance.getColorScheme() !== 'no-preference', Appearance.getColorScheme() !== 'no-preference',
notificationReminderSelected: this.savedNotificationReminder, notificationReminderSelected: this.savedNotificationReminder,
startScreenPickerSelected: AsyncStorageManager.getInstance().preferences.defaultStartScreen.current, startScreenPickerSelected: AsyncStorageManager.getInstance().preferences.defaultStartScreen.current,
isDebugUnlocked: AsyncStorageManager.getInstance().preferences.debugUnlocked.current === '1'
}; };
} }
/**
* Unlocks debug mode
*/
unlockDebugMode = () => {
this.setState({isDebugUnlocked: true});
let key = AsyncStorageManager.getInstance().preferences.debugUnlocked.key;
AsyncStorageManager.getInstance().savePref(key, '1');
}
/** /**
* Saves the value for the proxiwash reminder notification time * Saves the value for the proxiwash reminder notification time
* *
@ -218,31 +205,6 @@ class SettingsScreen extends React.Component<Props, State> {
</View> </View>
</List.Section> </List.Section>
</Card> </Card>
<Card style={{margin: 5}}>
<Card.Title title={i18n.t('settingsScreen.information')}/>
<List.Section>
{this.state.isDebugUnlocked
? <List.Item
title={i18n.t('screens.debug')}
left={props => <List.Icon {...props} icon="bug-check"/>}
onPress={() => this.props.navigation.navigate("debug")}
/>
:null}
<List.Item
title={i18n.t('screens.about')}
description={i18n.t('aboutScreen.buttonDesc')}
left={props => <List.Icon {...props} icon="information"/>}
onPress={() => this.props.navigation.navigate("about")}
onLongPress={this.unlockDebugMode}
/>
<List.Item
title={i18n.t('feedbackScreen.homeButtonTitle')}
description={i18n.t('feedbackScreen.homeButtonSubtitle')}
left={props => <List.Icon {...props} icon="bug"/>}
onPress={() => this.props.navigation.navigate("feedback")}
/>
</List.Section>
</Card>
</ScrollView> </ScrollView>
); );
} }

View file

@ -4,15 +4,6 @@ import * as React from 'react';
import WebViewScreen from "../../../components/Screens/WebViewScreen"; import WebViewScreen from "../../../components/Screens/WebViewScreen";
const URL = 'https://etud-mel.insa-toulouse.fr/webmail/'; const URL = 'https://etud-mel.insa-toulouse.fr/webmail/';
const customPadding = (padding: string) => {
return (
"$('head').append('<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">');" +
"$('.minwidth').css('top', " + padding + ");" +
"$('#mailview-bottom').css('min-height', 500);"
);
}
/** /**
* Class defining the app's available rooms screen. * Class defining the app's available rooms screen.
* This screen uses a webview to render the page * This screen uses a webview to render the page
@ -21,7 +12,6 @@ export const BlueMindWebsiteScreen = (props: Object) => {
return ( return (
<WebViewScreen <WebViewScreen
{...props} {...props}
customPaddingFunction={customPadding}
url={URL}/> url={URL}/>
); );
}; };

View file

@ -4,17 +4,6 @@ import * as React from 'react';
import WebViewScreen from "../../../components/Screens/WebViewScreen"; import WebViewScreen from "../../../components/Screens/WebViewScreen";
const URL = 'https://wiki.etud.insa-toulouse.fr/'; const URL = 'https://wiki.etud.insa-toulouse.fr/';
const customPadding = (padding: string) => {
return (
"$('#p-logo-text').css('top', 10 + " + padding + ");" +
"$('#site-navigation h2').css('top', 10 + " + padding + ");" +
"$('#site-tools h2').css('top', 10 + " + padding + ");" +
"$('#user-tools h2').css('top', 10 + " + padding + ");"
);
}
/** /**
* Class defining the app's available rooms screen. * Class defining the app's available rooms screen.
* This screen uses a webview to render the page * This screen uses a webview to render the page
@ -23,7 +12,6 @@ export const WiketudWebsiteScreen = (props: Object) => {
return ( return (
<WebViewScreen <WebViewScreen
{...props} {...props}
customPaddingFunction={customPadding}
url={URL}/> url={URL}/>
); );
}; };

View file

@ -91,8 +91,7 @@
"startScreen": "Start Screen", "startScreen": "Start Screen",
"startScreenSub": "Select which screen to start the app on", "startScreenSub": "Select which screen to start the app on",
"proxiwashNotifReminder": "Machine running reminder", "proxiwashNotifReminder": "Machine running reminder",
"proxiwashNotifReminderSub": "How many minutes before", "proxiwashNotifReminderSub": "How many minutes before"
"information": "Information"
}, },
"homeScreen": { "homeScreen": {
"listUpdated": "List updated!", "listUpdated": "List updated!",
@ -111,7 +110,6 @@
} }
}, },
"aboutScreen": { "aboutScreen": {
"buttonDesc": "Information about the app and its creator",
"appstore": "See on the Appstore", "appstore": "See on the Appstore",
"playstore": "See on the Playstore", "playstore": "See on the Playstore",
"changelog": "Changelog", "changelog": "Changelog",

View file

@ -91,8 +91,7 @@
"startScreen": "Écran de démarrage", "startScreen": "Écran de démarrage",
"startScreenSub": "Choisissez l'écran utilisé au démarrage", "startScreenSub": "Choisissez l'écran utilisé au démarrage",
"proxiwashNotifReminder": "Rappel de machine en cours", "proxiwashNotifReminder": "Rappel de machine en cours",
"proxiwashNotifReminderSub": "Combien de minutes avant", "proxiwashNotifReminderSub": "Combien de minutes avant"
"information": "Informations"
}, },
"homeScreen": { "homeScreen": {
"listUpdated": "List mise à jour!", "listUpdated": "List mise à jour!",
@ -111,7 +110,6 @@
} }
}, },
"aboutScreen": { "aboutScreen": {
"buttonDesc": "Informations sur l'appli et son créateur",
"appstore": "Voir sur l'Appstore", "appstore": "Voir sur l'Appstore",
"playstore": "Voir sur le Playstore", "playstore": "Voir sur le Playstore",
"changelog": "Historique des modifications", "changelog": "Historique des modifications",