Skip to content

Commit

Permalink
Use decoding in a single place on scan
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxStalker committed Jul 16, 2019
1 parent 6159aa9 commit 9d7784c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/components/SendByScan.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class SendByScan extends Component {
amount: parseFloat(dataSplit[1], 10)
}
if (dataSplit.length > 1) {
returnState.message = dataSplit[2]
returnState.message = decodeURI(dataSplit[2])
}
if (dataSplit.length > 2) {
returnState.currency = dataSplit[3]
Expand Down
11 changes: 4 additions & 7 deletions src/components/SendToAddress.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export default class SendToAddress extends React.Component {
if (props.scannerState) {
const {
scannerState: {
message,
extraMessage,
toAddress,
},
Expand All @@ -32,7 +33,7 @@ export default class SendToAddress extends React.Component {
} = props;


let { scannerState: { amount, currency, message } } = props;
let { scannerState: { amount, currency } } = props;
let currencyWarning = false;
let requestedAmount = 0;

Expand All @@ -55,7 +56,6 @@ export default class SendToAddress extends React.Component {
.toFixed(2);
currencyWarning = true;
}
message = decodeURI(message);

initialState = {
amount,
Expand Down Expand Up @@ -104,12 +104,9 @@ export default class SendToAddress extends React.Component {

componentWillReceiveProps(newProps) {
if (this.props.scannerState !== newProps.scannerState) {
const { message,...rest } = newProps.scannerState;

this.setState({
this.setState({
...this.state,
...rest,
message: decodeURI(message)
...newProps.scannerState
})
}
}
Expand Down

0 comments on commit 9d7784c

Please sign in to comment.