Load legal pages from web (#849)
This commit is contained in:
parent
2f25b10681
commit
c15fab7c84
|
@ -14,12 +14,6 @@ export default {
|
|||
CROWD_Enable: {
|
||||
type: 'valueAsBoolean'
|
||||
},
|
||||
Layout_Privacy_Policy: {
|
||||
type: 'valueAsString'
|
||||
},
|
||||
Layout_Terms_of_Service: {
|
||||
type: 'valueAsString'
|
||||
},
|
||||
LDAP_Enable: {
|
||||
type: 'valueAsBoolean'
|
||||
},
|
||||
|
|
14
app/index.js
14
app/index.js
|
@ -33,8 +33,6 @@ import ThreadMessagesView from './views/ThreadMessagesView';
|
|||
import SelectedUsersView from './views/SelectedUsersView';
|
||||
import CreateChannelView from './views/CreateChannelView';
|
||||
import LegalView from './views/LegalView';
|
||||
import TermsServiceView from './views/TermsServiceView';
|
||||
import PrivacyPolicyView from './views/PrivacyPolicyView';
|
||||
import ForgotPasswordView from './views/ForgotPasswordView';
|
||||
import RegisterView from './views/RegisterView';
|
||||
import OAuthView from './views/OAuthView';
|
||||
|
@ -81,15 +79,8 @@ const OutsideStack = createStackNavigator({
|
|||
LoginSignupView,
|
||||
LoginView,
|
||||
ForgotPasswordView,
|
||||
RegisterView
|
||||
}, {
|
||||
defaultNavigationOptions: defaultHeader
|
||||
});
|
||||
|
||||
const LegalStack = createStackNavigator({
|
||||
LegalView,
|
||||
TermsServiceView,
|
||||
PrivacyPolicyView
|
||||
RegisterView,
|
||||
LegalView
|
||||
}, {
|
||||
defaultNavigationOptions: defaultHeader
|
||||
});
|
||||
|
@ -102,7 +93,6 @@ const OAuthStack = createStackNavigator({
|
|||
|
||||
const OutsideStackModal = createStackNavigator({
|
||||
OutsideStack,
|
||||
LegalStack,
|
||||
OAuthStack
|
||||
},
|
||||
{
|
||||
|
|
|
@ -5,15 +5,16 @@ import {
|
|||
} from 'react-native';
|
||||
import { SafeAreaView } from 'react-navigation';
|
||||
import { RectButton } from 'react-native-gesture-handler';
|
||||
import { connect } from 'react-redux';
|
||||
|
||||
import sharedStyles from './Styles';
|
||||
import scrollPersistTaps from '../utils/scrollPersistTaps';
|
||||
import LoggedView from './View';
|
||||
import I18n from '../i18n';
|
||||
import DisclosureIndicator from '../containers/DisclosureIndicator';
|
||||
import { CloseModalButton } from '../containers/HeaderButton';
|
||||
import StatusBar from '../containers/StatusBar';
|
||||
import { COLOR_SEPARATOR, COLOR_WHITE } from '../constants/colors';
|
||||
import openLink from '../utils/openLink';
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
container: {
|
||||
|
@ -52,15 +53,17 @@ const styles = StyleSheet.create({
|
|||
|
||||
const Separator = () => <View style={styles.separator} />;
|
||||
|
||||
@connect(state => ({
|
||||
server: state.server.server
|
||||
}))
|
||||
/** @extends React.Component */
|
||||
export default class LegalView extends LoggedView {
|
||||
static navigationOptions = ({ navigation }) => ({
|
||||
headerLeft: <CloseModalButton testID='legal-view-close' navigation={navigation} />,
|
||||
static navigationOptions = () => ({
|
||||
title: I18n.t('Legal')
|
||||
})
|
||||
|
||||
static propTypes = {
|
||||
navigation: PropTypes.object
|
||||
server: PropTypes.string
|
||||
}
|
||||
|
||||
constructor(props) {
|
||||
|
@ -68,8 +71,11 @@ export default class LegalView extends LoggedView {
|
|||
}
|
||||
|
||||
onPressItem = ({ route }) => {
|
||||
const { navigation } = this.props;
|
||||
navigation.navigate(route);
|
||||
const { server } = this.props;
|
||||
if (!server) {
|
||||
return;
|
||||
}
|
||||
openLink(`${ server }/${ route }`);
|
||||
}
|
||||
|
||||
renderItem = ({ text, route, testID }) => (
|
||||
|
@ -84,9 +90,9 @@ export default class LegalView extends LoggedView {
|
|||
<SafeAreaView style={styles.container} testID='legal-view' forceInset={{ bottom: 'never' }}>
|
||||
<StatusBar />
|
||||
<ScrollView {...scrollPersistTaps} contentContainerStyle={styles.scroll}>
|
||||
{this.renderItem({ text: 'Terms_of_Service', route: 'TermsServiceView', testID: 'legal-terms-button' })}
|
||||
{this.renderItem({ text: 'Terms_of_Service', route: 'terms-of-service', testID: 'legal-terms-button' })}
|
||||
<Separator />
|
||||
{this.renderItem({ text: 'Privacy_Policy', route: 'PrivacyPolicyView', testID: 'legal-privacy-button' })}
|
||||
{this.renderItem({ text: 'Privacy_Policy', route: 'privacy-policy', testID: 'legal-privacy-button' })}
|
||||
</ScrollView>
|
||||
</SafeAreaView>
|
||||
);
|
||||
|
|
|
@ -1,39 +0,0 @@
|
|||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { WebView } from 'react-native';
|
||||
import { connect } from 'react-redux';
|
||||
import { SafeAreaView } from 'react-navigation';
|
||||
|
||||
import styles from './Styles';
|
||||
import LoggedView from './View';
|
||||
import I18n from '../i18n';
|
||||
import StatusBar from '../containers/StatusBar';
|
||||
|
||||
@connect(state => ({
|
||||
privacyPolicy: state.settings.Layout_Privacy_Policy
|
||||
}))
|
||||
/** @extends React.Component */
|
||||
export default class PrivacyPolicyView extends LoggedView {
|
||||
static navigationOptions = {
|
||||
title: I18n.t('Privacy_Policy')
|
||||
}
|
||||
|
||||
static propTypes = {
|
||||
privacyPolicy: PropTypes.string
|
||||
}
|
||||
|
||||
constructor(props) {
|
||||
super('PrivacyPolicyView', props);
|
||||
}
|
||||
|
||||
render() {
|
||||
const { privacyPolicy } = this.props;
|
||||
|
||||
return (
|
||||
<SafeAreaView style={styles.container} testID='privacy-view'>
|
||||
<StatusBar />
|
||||
<WebView originWhitelist={['*']} source={{ html: privacyPolicy, baseUrl: '' }} />
|
||||
</SafeAreaView>
|
||||
);
|
||||
}
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { WebView } from 'react-native';
|
||||
import { connect } from 'react-redux';
|
||||
import { SafeAreaView } from 'react-navigation';
|
||||
|
||||
import styles from './Styles';
|
||||
import LoggedView from './View';
|
||||
import I18n from '../i18n';
|
||||
import StatusBar from '../containers/StatusBar';
|
||||
|
||||
@connect(state => ({
|
||||
termsService: state.settings.Layout_Terms_of_Service
|
||||
}))
|
||||
/** @extends React.Component */
|
||||
export default class TermsServiceView extends LoggedView {
|
||||
static navigationOptions = {
|
||||
title: I18n.t('Terms_of_Service')
|
||||
}
|
||||
|
||||
static propTypes = {
|
||||
termsService: PropTypes.string
|
||||
}
|
||||
|
||||
constructor(props) {
|
||||
super('TermsServiceView', props);
|
||||
}
|
||||
|
||||
render() {
|
||||
const { termsService } = this.props;
|
||||
return (
|
||||
<SafeAreaView style={styles.container} testID='terms-view'>
|
||||
<StatusBar />
|
||||
<WebView originWhitelist={['*']} source={{ html: termsService, baseUrl: '' }} />
|
||||
</SafeAreaView>
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue