Skip to content
This repository has been archived by the owner on Apr 28, 2023. It is now read-only.

Commit

Permalink
feat: iOS compatible refund flow (#224)
Browse files Browse the repository at this point in the history
  • Loading branch information
peartobear authored and michael1011 committed Oct 14, 2019
1 parent f9d0d4b commit 2a2f166
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
13 changes: 13 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"qrious": "^4.0.2",
"react": "^16.9.0",
"react-confetti": "^4.0.1",
"react-device-detect": "^1.9.10",
"react-dom": "^16.9.0",
"react-icons": "^3.7.0",
"react-jss": "^8.6.1",
Expand Down
16 changes: 16 additions & 0 deletions src/views/swap/steps/downloadRefund.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import React from 'react';
import PropTypes from 'prop-types';
import injectSheet from 'react-jss';
import { isIOS } from 'react-device-detect';
import View from '../../../components/view';
import { navigation } from '../../../actions';
import { createRefundQr } from '../../../utils/refundUtils';

const DownloadRefundStyles = () => ({
Expand Down Expand Up @@ -39,11 +41,23 @@ class StyledDownloadRefund extends React.Component {
super(props);
this.ref = React.createRef();
}

componentDidMount() {
this.ref.current.click();
}

render() {
if (isIOS) {
const dialog = window.confirm(
'Tapping OK will open refund.png in a new tab which will be needed in case of a refund.' +
'Please save it in your gallary. This is important for conserving the non-custodial nature of the swap'
);

if (dialog !== true) {
navigation.navHome();
}
}

const {
classes,
currency,
Expand All @@ -59,6 +73,8 @@ class StyledDownloadRefund extends React.Component {
<View className={classes.placer}>
<p className={classes.info}>
<a
target="_blank"
rel="noopener noreferrer"
ref={this.ref}
href={createRefundQr(
currency,
Expand Down

0 comments on commit 2a2f166

Please sign in to comment.