Skip to content

Commit

Permalink
Use extensions api to close tab in permissions-connect
Browse files Browse the repository at this point in the history
  • Loading branch information
danjm committed Nov 20, 2019
1 parent 177c05b commit 5dd3f95
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
8 changes: 8 additions & 0 deletions app/scripts/platforms/extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,14 @@ class ExtensionPlatform {
extension.tabs.update(tabId, {highlighted: true}, cb)
}

closeTab (tabId) {
return new Promise(resolve => {
extension.tabs.remove(tabId, () => {
resolve()
})
})
}

_showConfirmedTransaction (txMeta) {

this._subscribeToNotificationClicked()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,12 @@ export default class PermissionConnect extends Component {
permissionAccepted: accepted,
})
setTimeout(() => {
global.platform.switchToTab(currentMetaMaskTabOpenerId, () => {
window.close()
})
global.platform.currentTab()
.then(({ id: currentTabId }) => {
global.platform.switchToTab(currentMetaMaskTabOpenerId, () => {
global.platform.closeTab(currentTabId)
})
})
}, 2000)
}

Expand Down

0 comments on commit 5dd3f95

Please sign in to comment.