|
|
@ -4,6 +4,7 @@ import { BrowserQRCodeReader } from '@zxing/library' |
|
|
|
import adapter from 'webrtc-adapter' // eslint-disable-line import/no-nodejs-modules, no-unused-vars
|
|
|
|
import adapter from 'webrtc-adapter' // eslint-disable-line import/no-nodejs-modules, no-unused-vars
|
|
|
|
import Spinner from '../../spinner' |
|
|
|
import Spinner from '../../spinner' |
|
|
|
import WebcamUtils from '../../../../lib/webcam-utils' |
|
|
|
import WebcamUtils from '../../../../lib/webcam-utils' |
|
|
|
|
|
|
|
import PageContainerFooter from '../../page-container/page-container-footer/page-container-footer.component'; |
|
|
|
|
|
|
|
|
|
|
|
export default class QrScanner extends Component { |
|
|
|
export default class QrScanner extends Component { |
|
|
|
static propTypes = { |
|
|
|
static propTypes = { |
|
|
@ -104,9 +105,19 @@ export default class QrScanner extends Component { |
|
|
|
// To parse other type of links
|
|
|
|
// To parse other type of links
|
|
|
|
// For ex. EIP-681 (https://eips.ethereum.org/EIPS/eip-681)
|
|
|
|
// For ex. EIP-681 (https://eips.ethereum.org/EIPS/eip-681)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Ethereum address links - fox ex. ethereum:0x.....1111
|
|
|
|
if (content.split('ethereum:').length > 1) { |
|
|
|
if (content.split('ethereum:').length > 1) { |
|
|
|
|
|
|
|
|
|
|
|
type = 'address' |
|
|
|
type = 'address' |
|
|
|
values = {'address': content.split('ethereum:')[1] } |
|
|
|
values = {'address': content.split('ethereum:')[1] } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Regular ethereum addresses - fox ex. 0x.....1111
|
|
|
|
|
|
|
|
} else if (content.substring(0, 2).toLowerCase() === '0x') { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
type = 'address' |
|
|
|
|
|
|
|
values = {'address': content } |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
return {type, values} |
|
|
|
return {type, values} |
|
|
|
} |
|
|
|
} |
|
|
@ -169,14 +180,12 @@ export default class QrScanner extends Component { |
|
|
|
<div className={'qr-scanner__error'}> |
|
|
|
<div className={'qr-scanner__error'}> |
|
|
|
{msg} |
|
|
|
{msg} |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div className={'qr-scanner__footer'}> |
|
|
|
<PageContainerFooter |
|
|
|
<button className="btn-default btn--large" onClick={this.stopAndClose}> |
|
|
|
onCancel={this.stopAndClose} |
|
|
|
CANCEL |
|
|
|
onSubmit={this.tryAgain} |
|
|
|
</button> |
|
|
|
cancelText={this.context.t('cancel')} |
|
|
|
<button className="btn-primary btn--large" onClick={this.tryAgain}> |
|
|
|
submitText={this.context.t('tryAgain')} |
|
|
|
TRY AGAIN |
|
|
|
/> |
|
|
|
</button> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
</div> |
|
|
|
</div> |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|