Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Transaction notifications #4840

Merged
merged 5 commits into from
Jul 20, 2018
Merged

Conversation

scsaba
Copy link
Contributor

@scsaba scsaba commented Jul 20, 2018

Fixes #4203

@scsaba
Copy link
Contributor Author

scsaba commented Jul 20, 2018

Hi @danfinlay

Could you please review this PR?

I think notifications for dropped transactions is also informative, so I added that also. However it can cause problems in Firefox as mentioned in the documentation:

If you call notifications.create() more than once in rapid succession, Firefox may end up not displaying any notification at all.

I experienced this a few times.

Also, about "View on EtherScan" on the confirmed transaction's notification: it cannot be added as a link, so I had to handle the notifications.OnClicked event to open the transaction details on a new tab.

Copy link
Contributor

@danfinlay danfinlay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks so much, @scsaba!

Two small changes I would request:

  • Let's remove the dropped tx handler, the firefox issue puts it over the top for now.
  • Please add a changelog entry under the master header, noting Now shows notifications when transactions are completed.

this.txController.on(`tx:status-update`, (txId, status) => {
if (status === 'confirmed' || status === 'failed' || status === 'dropped') {
const txMeta = this.txController.txStateManager.getTx(txId)
this.platform.showTransactionNotification(txMeta)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the generic handler.

} else if (status === 'failed') {
this._showFailedTransaction(txMeta)
} else if (status === 'dropped') {
this._showDroppedTransaction(txMeta)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was already on the fence about showing dropped txs, but if Firefox risks not showing any, I think I'd rather remove the dropped handler.

@scsaba
Copy link
Contributor Author

scsaba commented Jul 20, 2018

@danfinlay thank you for the quick review. I applied the requested changes. I was not sure about the changelog entry if I need to add the pull request nr also, I hope this is the correct version :)

Copy link
Contributor

@danfinlay danfinlay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job, thank you!

@danfinlay danfinlay merged commit e094d4a into MetaMask:develop Jul 20, 2018
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants