Skip to content

Commit

Permalink
Link to support URLs using default browser, closes #1295 (#1303)
Browse files Browse the repository at this point in the history
This fix is not ideal. Unfortunately, there seems to be an incompatibility between the webview component and the vendor (zendesks') reCAPTCHA (by Google Inc.). One potential way to fix this would be to alter the display CSS and/or JavaScript on the vendor site to change the positioning of the captcha overlay? However, once we start on this road we'll be doing the same thing for all sorts of incompatibilities all over the web. That said, maybe it's worth looking into fixing this one somehow… Google's reCAPTCHA is everywhere.
  • Loading branch information
rickycodes authored Feb 5, 2020
1 parent b8a5da6 commit b1a591c
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions app/components/UI/DrawerView/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { PureComponent } from 'react';
import {
Alert,
Clipboard,
Linking,
Platform,
TouchableOpacity,
View,
Expand Down Expand Up @@ -285,6 +286,8 @@ const drawerBg = require('../../../images/drawer-bg.png'); // eslint-disable-lin
const instapay_logo_selected = require('../../../images/mm-instapay-selected.png'); // eslint-disable-line
const instapay_logo = require('../../../images/mm-instapay.png'); // eslint-disable-line

const USE_EXTERNAL_LINKS = Platform.OS === 'android' || false;

/**
* View component that displays the MetaMask fox
* in the middle of the screen
Expand Down Expand Up @@ -587,10 +590,22 @@ class DrawerView extends PureComponent {
closeSubmitFeedback = () => {
this.setState({ submitFeedback: false });
};

handleURL = url => {
const handleError = error => {
console.log(error);
this.closeSubmitFeedback();
};
if (USE_EXTERNAL_LINKS) {
Linking.openURL(url)
.then(this.closeSubmitFeedback)
.catch(handleError);
} else {
this.goToBrowserUrl(url, strings('drawer.submit_bug'));
this.closeSubmitFeedback();
}
};
goToBugFeedback = () => {
this.goToBrowserUrl(`https://metamask.zendesk.com/hc/en-us/requests/new`, strings('drawer.submit_bug'));
this.setState({ submitFeedback: false });
this.handleURL('https://metamask.zendesk.com/hc/en-us/requests/new');
};

goToGeneralFeedback = () => {
Expand All @@ -603,11 +618,9 @@ class DrawerView extends PureComponent {
const buildNumber = await getBuildNumber();
const systemName = await getSystemName();
const systemVersion = systemName === 'Android' ? await getApiLevel() : await getSystemVersion();
this.goToBrowserUrl(
`https://docs.google.com/forms/d/e/${formId}/viewform?entry.649573346=${systemName}+${systemVersion}+MM+${appVersion}+(${buildNumber})`,
strings('drawer.feedback')
this.handleURL(
`https://docs.google.com/forms/d/e/${formId}/viewform?entry.649573346=${systemName}+${systemVersion}+MM+${appVersion}+(${buildNumber})`
);
this.setState({ submitFeedback: false });
};

showHelp = () => {
Expand Down

0 comments on commit b1a591c

Please sign in to comment.