diff --git a/app/constants/settings.js b/app/constants/settings.js index f9ca4a54..78b22952 100644 --- a/app/constants/settings.js +++ b/app/constants/settings.js @@ -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' }, diff --git a/app/index.js b/app/index.js index c6978910..9be8979b 100644 --- a/app/index.js +++ b/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 }, { diff --git a/app/views/LegalView.js b/app/views/LegalView.js index 9a5be2f6..11c0249e 100644 --- a/app/views/LegalView.js +++ b/app/views/LegalView.js @@ -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 = () => ; +@connect(state => ({ + server: state.server.server +})) /** @extends React.Component */ export default class LegalView extends LoggedView { - static navigationOptions = ({ navigation }) => ({ - headerLeft: , + 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 { - {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' })} - {this.renderItem({ text: 'Privacy_Policy', route: 'PrivacyPolicyView', testID: 'legal-privacy-button' })} + {this.renderItem({ text: 'Privacy_Policy', route: 'privacy-policy', testID: 'legal-privacy-button' })} ); diff --git a/app/views/PrivacyPolicyView.js b/app/views/PrivacyPolicyView.js deleted file mode 100644 index 33296953..00000000 --- a/app/views/PrivacyPolicyView.js +++ /dev/null @@ -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 ( - - - - - ); - } -} diff --git a/app/views/TermsServiceView.js b/app/views/TermsServiceView.js deleted file mode 100644 index 2e8beaaf..00000000 --- a/app/views/TermsServiceView.js +++ /dev/null @@ -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 ( - - - - - ); - } -}