Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Notification click listener doesn't unsubscribe #25

Closed
lukaw3d opened this issue Aug 16, 2021 · 1 comment · Fixed by #156 or #280
Closed

Notification click listener doesn't unsubscribe #25

lukaw3d opened this issue Aug 16, 2021 · 1 comment · Fixed by #156 or #280
Labels
p:2 Priority: potential feature

Comments

@lukaw3d
Copy link
Member

lukaw3d commented Aug 16, 2021

let id = hash
extension.notifications &&
extension.notifications.onClicked.addListener(function (id) {
let url = getExplorerUrl() + "transactions/" + id
openTab(url)
});
let title = getLanguage('notificationTitle')
let message = getLanguage('notificationContent')
extension.notifications.create(id, {

If user creates 3 transactions (without closing the popup), and clicks on 3rd notification, then it will open 3 duplicate tabs

  • listener should probably filter if (id === id) and then removeListener
  • I would prefix id with e.g. 'txConfirmed-' + id, so adding different notifications won't cause a conflict
@peterjgilbert peterjgilbert added the p:2 Priority: potential feature label Aug 17, 2021
@lukaw3d lukaw3d reopened this Nov 19, 2021
@lukaw3d
Copy link
Member Author

lukaw3d commented Nov 19, 2021

It is slightly better now that it has filtering by ID

let notifyId = runtimeId ? hash +"?runtime="+runtimeId : hash
let myNotificationID
extension.notifications &&
extension.notifications.onClicked.addListener(function (clickId) {
if(myNotificationID === clickId){
let url
if(runtimeId){
url = getExplorerUrl() + "paratimes/transactions/" + clickId
}else{
url = getExplorerUrl() + "transactions/" + clickId
}
openTab(url)
}
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p:2 Priority: potential feature
Projects
None yet
2 participants