2018-11-14 21:42:03 +00:00
|
|
|
import React from 'react';
|
2019-04-26 20:51:09 +00:00
|
|
|
import { connect } from 'react-redux';
|
2021-10-06 20:36:46 +00:00
|
|
|
import { StackNavigationOptions } from '@react-navigation/stack';
|
2018-11-14 21:42:03 +00:00
|
|
|
|
|
|
|
import I18n from '../i18n';
|
2019-03-12 16:23:06 +00:00
|
|
|
import StatusBar from '../containers/StatusBar';
|
2019-04-26 20:51:09 +00:00
|
|
|
import openLink from '../utils/openLink';
|
2019-12-04 16:39:53 +00:00
|
|
|
import { withTheme } from '../theme';
|
2020-06-15 14:00:46 +00:00
|
|
|
import SafeAreaView from '../containers/SafeAreaView';
|
2020-10-30 13:59:44 +00:00
|
|
|
import * as List from '../containers/List';
|
2018-11-14 21:42:03 +00:00
|
|
|
|
2021-10-06 20:36:46 +00:00
|
|
|
interface ILegalView {
|
|
|
|
server: string;
|
|
|
|
theme: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
class LegalView extends React.Component<ILegalView, any> {
|
2022-01-17 16:10:39 +00:00
|
|
|
static navigationOptions = (): StackNavigationOptions => ({
|
2021-10-06 20:36:46 +00:00
|
|
|
title: I18n.t('Legal')
|
2022-01-17 16:10:39 +00:00
|
|
|
});
|
2018-11-14 21:42:03 +00:00
|
|
|
|
2021-10-06 20:36:46 +00:00
|
|
|
onPressItem = ({ route }: { route: string }) => {
|
2019-12-04 16:39:53 +00:00
|
|
|
const { server, theme } = this.props;
|
2019-04-26 20:51:09 +00:00
|
|
|
if (!server) {
|
|
|
|
return;
|
|
|
|
}
|
2021-09-13 20:41:05 +00:00
|
|
|
openLink(`${server}/${route}`, theme);
|
|
|
|
};
|
2018-11-14 21:42:03 +00:00
|
|
|
|
|
|
|
render() {
|
|
|
|
return (
|
2020-10-30 13:59:44 +00:00
|
|
|
<SafeAreaView testID='legal-view'>
|
|
|
|
<StatusBar />
|
|
|
|
<List.Container>
|
|
|
|
<List.Section>
|
|
|
|
<List.Separator />
|
|
|
|
<List.Item
|
|
|
|
title='Terms_of_Service'
|
|
|
|
onPress={() => this.onPressItem({ route: 'terms-of-service' })}
|
|
|
|
testID='legal-terms-button'
|
|
|
|
showActionIndicator
|
|
|
|
/>
|
|
|
|
<List.Separator />
|
|
|
|
<List.Item
|
|
|
|
title='Privacy_Policy'
|
|
|
|
onPress={() => this.onPressItem({ route: 'privacy-policy' })}
|
|
|
|
testID='legal-privacy-button'
|
|
|
|
showActionIndicator
|
|
|
|
/>
|
|
|
|
<List.Separator />
|
|
|
|
</List.Section>
|
|
|
|
</List.Container>
|
2018-11-14 21:42:03 +00:00
|
|
|
</SafeAreaView>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
2019-08-07 13:51:34 +00:00
|
|
|
|
2021-10-06 20:36:46 +00:00
|
|
|
const mapStateToProps = (state: any) => ({
|
2019-08-07 13:51:34 +00:00
|
|
|
server: state.server.server
|
|
|
|
});
|
|
|
|
|
2019-12-04 16:39:53 +00:00
|
|
|
export default connect(mapStateToProps)(withTheme(LegalView));
|