Skip to content

Commit

Permalink
[BRG-516] Fix not working popup
Browse files Browse the repository at this point in the history
  • Loading branch information
kosAndrey22 authored and doomdabidon committed Dec 12, 2019
1 parent a1891b4 commit c833479
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
8 changes: 5 additions & 3 deletions extension/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -467,14 +467,16 @@ const onMessageHandler = (request, portObj) => {

portObj.addTask(id, method);

setBadge();
triggerPopup(INCOMING_CONNECTION_PATH, providerNotification);
try {
emitter.emit('addProviderRequest', request.id, origin);
setTimeout(() => {
emitter.emit('addProviderRequest', request.id, origin);
}, 300);
} catch (e) {
return null;
}

setBadge();
triggerPopup(INCOMING_CONNECTION_PATH, providerNotification);
return true;
}

Expand Down
7 changes: 6 additions & 1 deletion src/containers/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,16 @@ class App extends React.Component {

App.propTypes = {
children: PropTypes.element.isRequired,
loading: PropTypes.bool.isRequired,
loading: PropTypes.bool,
pathname: PropTypes.string.isRequired,
initApp: PropTypes.func.isRequired,
initListeners: PropTypes.func.isRequired,
};

App.defaultProps = {
loading: false,
};

export default connect(
(state) => ({
loading: state.global.get('loading'),
Expand Down
4 changes: 2 additions & 2 deletions src/helpers/FormatHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ class FormatHelper {
if (!this.isAmountVeryBig(amount, precision, sumbol)) {
return formatAmount;
}
const length = amount.indexOf('.') === -1 ? 18 - sumbol.length : 19 - sumbol.length;
const length = amount.indexOf('.') === -1 ? 11 - sumbol.length : 12 - sumbol.length;
return formatAmount.substring(0, length).trim().concat('...');
}
static isAmountVeryBig(amount = 0, precision = 0, sumbol = '') {
return new BN(amount).div(10 ** precision).toString(10).length + sumbol.length > 17;
return new BN(amount).div(10 ** precision).toString(10).length + sumbol.length > 10;
}

static formatError(err) {
Expand Down

0 comments on commit c833479

Please sign in to comment.