summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorErik Larkö <erik@mullvad.net>2018-01-31 10:15:12 +0100
committerErik Larkö <erik@mullvad.net>2018-01-31 10:15:12 +0100
commitc5499bf826dacd1c8e30a0631d6b9338be2e52e4 (patch)
tree92122cbfcfef52c892f4e79808e077a7b132e821
parent58a80ae3da2f4e71b5f211911dff2fb1d97b58aa (diff)
parent039aec8952fa0cc21e7eaae4bdfb7b788e9a1c49 (diff)
downloadmullvadvpn-c5499bf826dacd1c8e30a0631d6b9338be2e52e4.tar.xz
mullvadvpn-c5499bf826dacd1c8e30a0631d6b9338be2e52e4.zip
Merge branch 'email-confirmation'
-rw-r--r--app/components/Support.js64
-rw-r--r--app/components/SupportStyles.js9
-rw-r--r--package.json2
-rw-r--r--test/components/Support.spec.js8
-rw-r--r--yarn.lock2
5 files changed, 64 insertions, 21 deletions
diff --git a/app/components/Support.js b/app/components/Support.js
index 18baed32c4..dc646bdb0e 100644
--- a/app/components/Support.js
+++ b/app/components/Support.js
@@ -17,7 +17,7 @@ export type SupportState = {
email: string,
message: string,
savedReport: ?string,
- sendState: 'INITIAL' | 'LOADING' | 'SUCCESS' | 'FAILED',
+ sendState: 'INITIAL' | 'CONFIRM_NO_EMAIL' | 'LOADING' | 'SUCCESS' | 'FAILED',
};
export type SupportProps = {
account: AccountReduxState,
@@ -72,6 +72,16 @@ export default class Support extends Component {
}
onSend = () => {
+ if (this.state.sendState === 'INITIAL' && this.state.email.length === 0) {
+ this.setState({
+ sendState: 'CONFIRM_NO_EMAIL',
+ });
+ } else {
+ this._sendProblemReport();
+ }
+ }
+
+ _sendProblemReport() {
this.setState({
sendState: 'LOADING',
}, () => {
@@ -94,9 +104,10 @@ export default class Support extends Component {
render() {
+ const { sendState } = this.state;
const header = <View style={styles.support__header}>
<Text style={styles.support__title}>Report a problem</Text>
- { this.state.sendState === 'INITIAL' && <Text style={styles.support__subtitle}>
+ { (sendState === 'INITIAL' || sendState === 'CONFIRM_NO_EMAIL') && <Text style={styles.support__subtitle}>
{ 'To help you more effectively, your app\'s log file will be attached to this message. Your data will remain secure and private, as it is anonymised before being sent over an encrypted channel.' }
</Text>
}
@@ -110,8 +121,10 @@ export default class Support extends Component {
<Container>
<View style={styles.support}>
<Button style={styles.support__close} onPress={ this.props.onClose } testName="support__close">
- <Img style={styles.support__close_icon} source="icon-back" />
- <Text style={styles.support__close_title}>Settings</Text>
+ <View style={styles.support__close}>
+ <Img style={styles.support__close_icon} source="icon-back" />
+ <Text style={styles.support__close_title}>Settings</Text>
+ </View>
</Button>
<View style={styles.support__container}>
@@ -129,6 +142,7 @@ export default class Support extends Component {
_renderContent() {
switch(this.state.sendState) {
case 'INITIAL':
+ case 'CONFIRM_NO_EMAIL':
return this._renderForm();
case 'LOADING':
return this._renderLoading();
@@ -142,6 +156,7 @@ export default class Support extends Component {
}
_renderForm() {
+
return <View style={styles.support__content}>
<View style={styles.support__form}>
<View style={styles.support__form_row}>
@@ -163,21 +178,42 @@ export default class Support extends Component {
</View>
</View>
<View style={styles.support__footer}>
- <Button onPress={ this.onViewLog } style={{'flex':1}} testName='support__view_logs'>
- <View style={styles.support__form_view_logs}>
- <View style={styles.support__open_icon}></View>
- <Text style={styles.support__button_label}>View app logs</Text>
- <Img source="icon-extLink" style={styles.support__open_icon} tintColor='currentColor'/>
- </View>
- </Button>
- <Button style={styles.support__form_send} disabled={ !this.validate() } onPress={ this.onSend } testName='support__send_logs'>
- <Text style={styles.support__button_label}>Send</Text>
- </Button>
+ {
+ this.state.sendState === 'CONFIRM_NO_EMAIL'
+ ? this._renderNoEmailWarning()
+ : this._renderActionButtons()
+ }
</View>
</View>
</View>;
}
+ _renderNoEmailWarning() {
+ return <View>
+ <Text style={styles.support__no_email_warning}>
+ You are about to send the problem report without a way for us to get back to you. If you want an answer to your report you will have to enter an email address.
+ </Text>
+ <Button style={styles.support__form_send} disabled={ !this.validate() } onPress={ this.onSend } testName='support__send_logs'>
+ <Text style={styles.support__button_label}>Send anyway</Text>
+ </Button>
+ </View>;
+ }
+
+ _renderActionButtons() {
+ return [
+ <Button key={1} onPress={ this.onViewLog } style={{'flex':1}} testName='support__view_logs'>
+ <View style={styles.support__form_view_logs}>
+ <View style={styles.support__open_icon}></View>
+ <Text style={styles.support__button_label}>View app logs</Text>
+ <Img source="icon-extLink" style={styles.support__open_icon} tintColor='currentColor'/>
+ </View>
+ </Button>,
+ <Button key={2} style={styles.support__form_send} disabled={ !this.validate() } onPress={ this.onSend } testName='support__send_logs'>
+ <Text style={styles.support__button_label}>Send</Text>
+ </Button>
+ ];
+ }
+
_renderLoading() {
return <View style={styles.support__content}>
<View style={styles.support__form}>
diff --git a/app/components/SupportStyles.js b/app/components/SupportStyles.js
index e23f26bd6d..9bb1007f04 100644
--- a/app/components/SupportStyles.js
+++ b/app/components/SupportStyles.js
@@ -208,4 +208,11 @@ export default Object.assign(createViewStyles({
justifyContent: 'center',
alignItems: 'center',
},
-})); \ No newline at end of file
+ support__no_email_warning: {
+ fontFamily: 'Open Sans',
+ fontSize: 13,
+ lineHeight: 1.3,
+
+ color: 'rgba(255,255,255,0.8)',
+ },
+}));
diff --git a/package.json b/package.json
index 65aa06dd60..8f1a5d70be 100644
--- a/package.json
+++ b/package.json
@@ -41,7 +41,7 @@
"devDependencies": {
"babel-cli": "^6.22.2",
"babel-core": "^6.25.0",
- "babel-eslint": "^8.1.1",
+ "babel-eslint": "^8.2.1",
"babel-plugin-inline-react-svg": "^0.4.0",
"babel-plugin-transform-runtime": "^6.22.0",
"babel-preset-es2015": "^6.1.18",
diff --git a/test/components/Support.spec.js b/test/components/Support.spec.js
index 90b0c0d8fa..a1a953fa2c 100644
--- a/test/components/Support.spec.js
+++ b/test/components/Support.spec.js
@@ -50,7 +50,7 @@ describe('components/Support', () => {
});
const component = render(props);
- component.setState({ message: 'abc' });
+ component.setState({ message: 'abc', email: 'foo' });
const sendButton = getComponent(component, 'support__send_logs');
expect(sendButton.prop('disabled')).to.be.false;
@@ -102,10 +102,10 @@ describe('components/Support', () => {
}
});
- const component = render(makeProps());
- component.setState({ message: '' });
+ const component = render(props);
+ component.setState({ message: '', email: 'foo' });
- const sendButton = getComponent(render(props), 'support__send_logs');
+ const sendButton = getComponent(component, 'support__send_logs');
click(sendButton);
});
diff --git a/yarn.lock b/yarn.lock
index 95f07a20a1..feaf643384 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -453,7 +453,7 @@ babel-core@^6.24.1, babel-core@^6.25.0, babel-core@^6.26.0, babel-core@^6.7.2:
slash "^1.0.0"
source-map "^0.5.6"
-babel-eslint@^8.1.1:
+babel-eslint@^8.2.1:
version "8.2.1"
resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-8.2.1.tgz#136888f3c109edc65376c23ebf494f36a3e03951"
dependencies: