2019-08-06 19:18:45 +02:00
|
|
|
// @flow
|
|
|
|
|
|
|
|
import * as React from 'react';
|
2019-08-06 19:38:48 +02:00
|
|
|
import ThemeManager from "../utils/ThemeManager";
|
2019-11-02 15:44:19 +01:00
|
|
|
import WebViewScreen from "../components/WebViewScreen";
|
2019-08-06 19:18:45 +02:00
|
|
|
|
|
|
|
type Props = {
|
|
|
|
navigation: Object,
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-08-08 13:57:03 +02:00
|
|
|
const PLANEX_URL = 'http://planex.insa-toulouse.fr/';
|
2019-08-06 19:18:45 +02:00
|
|
|
|
2019-08-13 12:20:03 +02:00
|
|
|
const CUSTOM_CSS_GENERAL = 'https://srv-falcon.etud.insa-toulouse.fr/~amicale_app/custom_css/planex/customMobile.css';
|
|
|
|
const CUSTOM_CSS_NIGHTMODE = 'https://srv-falcon.etud.insa-toulouse.fr/~amicale_app/custom_css/planex/customDark.css';
|
2019-11-02 15:44:19 +01:00
|
|
|
|
2019-08-06 19:18:45 +02:00
|
|
|
/**
|
|
|
|
* Class defining the app's planex screen.
|
|
|
|
* This screen uses a webview to render the planex page
|
|
|
|
*/
|
2019-11-02 15:44:19 +01:00
|
|
|
export default class PlanexScreen extends React.Component<Props> {
|
2019-08-06 19:18:45 +02:00
|
|
|
|
2019-08-08 22:07:49 +02:00
|
|
|
customInjectedJS: string;
|
|
|
|
|
|
|
|
constructor() {
|
|
|
|
super();
|
|
|
|
this.customInjectedJS =
|
|
|
|
'document.querySelector(\'head\').innerHTML += \'<meta name="viewport" content="width=device-width, initial-scale=1.0">\';' +
|
2019-08-13 12:20:03 +02:00
|
|
|
'document.querySelector(\'head\').innerHTML += \'<link rel="stylesheet" href="' + CUSTOM_CSS_GENERAL + '" type="text/css"/>\';';
|
2019-08-08 22:07:49 +02:00
|
|
|
if (ThemeManager.getNightMode())
|
2019-08-13 12:20:03 +02:00
|
|
|
this.customInjectedJS += 'document.querySelector(\'head\').innerHTML += \'<link rel="stylesheet" href="' + CUSTOM_CSS_NIGHTMODE + '" type="text/css"/>\';';
|
2019-08-08 22:07:49 +02:00
|
|
|
}
|
|
|
|
|
2019-08-06 19:18:45 +02:00
|
|
|
render() {
|
|
|
|
const nav = this.props.navigation;
|
|
|
|
return (
|
2019-11-02 15:44:19 +01:00
|
|
|
<WebViewScreen
|
|
|
|
navigation={nav}
|
|
|
|
url={PLANEX_URL}
|
|
|
|
customInjectedJS={this.customInjectedJS}
|
|
|
|
headerTitle={'Planex'}
|
2019-11-07 10:57:58 +01:00
|
|
|
hasHeaderBackButton={false}
|
|
|
|
hasFooter={false}/>
|
2019-08-06 19:18:45 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|