Merge pull request #180 from poanetwork/multiple-explorers-fix

(Fix) multiple explorers are opened on success tx notification click
This commit is contained in:
Victor Baranov 2018-11-06 17:27:32 +03:00 committed by GitHub
commit e8ece6643f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -110,14 +110,14 @@ class ExtensionPlatform {
}
_subscribeToNotificationClicked = () => {
if (!extension.notifications.onClicked.hasListener(this._viewOnExplorer)) {
extension.notifications.onClicked.addListener((url) => this._viewOnExplorer(url))
if (extension.notifications.onClicked.hasListener(this._viewOnExplorer)) {
extension.notifications.onClicked.removeListener(this._viewOnExplorer)
}
extension.notifications.onClicked.addListener(this._viewOnExplorer)
}
_viewOnExplorer (url) {
if (url.startsWith('http://') || url.startsWith('https://')) {
extension.notifications.onClicked.removeListener(this._viewOnExplorer)
global.metamaskController.platform.openWindow({ url })
}
}