2022-05-10 21:19:57 +00:00
|
|
|
import React, { useEffect } from 'react';
|
|
|
|
import { useSelector } from 'react-redux';
|
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';
|
2022-05-10 21:19:57 +00:00
|
|
|
import { useTheme } 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';
|
2022-05-10 21:19:57 +00:00
|
|
|
import { OutsideParamList } from '../stacks/types';
|
|
|
|
import { IBaseScreen, IApplicationState } from '../definitions';
|
2018-11-14 21:42:03 +00:00
|
|
|
|
2022-05-10 21:19:57 +00:00
|
|
|
interface ILegalViewProps extends IBaseScreen<OutsideParamList, 'LegalView'> {
|
2021-10-06 20:36:46 +00:00
|
|
|
server: string;
|
|
|
|
}
|
|
|
|
|
2022-05-10 21:19:57 +00:00
|
|
|
const LegalView = ({ navigation }: ILegalViewProps): React.ReactElement => {
|
|
|
|
const server = useSelector((state: IApplicationState) => state.server.server);
|
|
|
|
const { theme } = useTheme();
|
2018-11-14 21:42:03 +00:00
|
|
|
|
2022-05-10 21:19:57 +00:00
|
|
|
useEffect(() => {
|
|
|
|
navigation.setOptions({
|
|
|
|
title: I18n.t('Legal')
|
|
|
|
});
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
const onPressItem = ({ route }: { route: string }) => {
|
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
|
|
|
|
2022-05-10 21:19:57 +00:00
|
|
|
return (
|
|
|
|
<SafeAreaView testID='legal-view'>
|
|
|
|
<StatusBar />
|
|
|
|
<List.Container>
|
|
|
|
<List.Section>
|
|
|
|
<List.Separator />
|
|
|
|
<List.Item
|
|
|
|
title='Terms_of_Service'
|
|
|
|
onPress={() => onPressItem({ route: 'terms-of-service' })}
|
|
|
|
testID='legal-terms-button'
|
|
|
|
showActionIndicator
|
|
|
|
/>
|
|
|
|
<List.Separator />
|
|
|
|
<List.Item
|
|
|
|
title='Privacy_Policy'
|
|
|
|
onPress={() => onPressItem({ route: 'privacy-policy' })}
|
|
|
|
testID='legal-privacy-button'
|
|
|
|
showActionIndicator
|
|
|
|
/>
|
|
|
|
<List.Separator />
|
|
|
|
</List.Section>
|
|
|
|
</List.Container>
|
|
|
|
</SafeAreaView>
|
|
|
|
);
|
|
|
|
};
|
2019-08-07 13:51:34 +00:00
|
|
|
|
2022-05-10 21:19:57 +00:00
|
|
|
export default LegalView;
|