[MM-13975] Add Terms of Service and Privacy Policy Links (#2559)

* [MM-13975] Add terms of service and privacy policy links

* [MM-13975] Address comments
This commit is contained in:
Ryan Wang 2019-02-20 06:08:07 -08:00 committed by Harrison Healey
parent 710ae4d601
commit f071deb003
2 changed files with 60 additions and 1 deletions

View file

@ -51,6 +51,14 @@ export default class About extends PureComponent {
Linking.openURL(Config.MobileNoticeURL);
};
handleTermsOfService = () => {
Linking.openURL(this.props.config.TermsOfServiceLink);
};
handlePrivacyPolicy = () => {
Linking.openURL(this.props.config.PrivacyPolicyLink);
}
render() {
const {theme, config, license} = this.props;
const style = getStyleSheet(theme);
@ -173,6 +181,39 @@ export default class About extends PureComponent {
);
}
let termsOfService;
if (config.TermsOfServiceLink) {
termsOfService = (
<FormattedText
id='mobile.tos_link'
defaultMessage='Terms of Service'
style={style.noticeLink}
onPress={this.handleTermsOfService}
/>
);
}
let privacyPolicy;
if (config.PrivacyPolicyLink) {
privacyPolicy = (
<FormattedText
id='mobile.privacy_link'
defaultMessage='Privacy Policy'
style={style.noticeLink}
onPress={this.handlePrivacyPolicy}
/>
);
}
let tosPrivacyHyphen;
if (termsOfService && privacyPolicy) {
tosPrivacyHyphen = (
<Text style={[style.footerText, style.hyphenText]}>
{' - '}
</Text>
);
}
return (
<View style={style.wrapper}>
<StatusBar/>
@ -228,11 +269,16 @@ export default class About extends PureComponent {
<FormattedText
id='mobile.about.copyright'
defaultMessage='Copyright 2015-{currentYear} Mattermost, Inc. All rights reserved'
style={style.footerText}
style={[style.footerText, style.copyrightText]}
values={{
currentYear: new Date().getFullYear(),
}}
/>
<View style={style.tosPrivacyContainer}>
{termsOfService}
{tosPrivacyHyphen}
{privacyPolicy}
</View>
<View style={style.noticeContainer}>
<View style={style.footerGroup}>
<FormattedText
@ -387,5 +433,16 @@ const getStyleSheet = makeStyleSheetFromTheme((theme) => {
lineHeight: 13,
marginBottom: 10,
},
copyrightText: {
marginBottom: 0,
},
hyphenText: {
marginBottom: 0,
},
tosPrivacyContainer: {
flex: 1,
flexDirection: 'row',
marginBottom: 10,
},
};
});

View file

@ -5,11 +5,13 @@
"about.enterpriseEditionSt": "Modern communication from behind your firewall.",
"about.hash": "Build Hash:",
"about.hashee": "EE Build Hash:",
"about.privacy": "Privacy Policy",
"about.teamEditionLearn": "Join the Mattermost community at ",
"about.teamEditionSt": "All your team communication in one place, instantly searchable and accessible anywhere.",
"about.teamEditiont0": "Team Edition",
"about.teamEditiont1": "Enterprise Edition",
"about.title": "About Mattermost",
"about.tos": "Terms of Service",
"announcment_banner.dont_show_again": "Don't show again",
"api.channel.add_member.added": "{addedUsername} added to the channel by {username}.",
"archivedChannelMessage": "You are viewing an **archived channel**. New messages cannot be posted.",