|
|
@ -768,13 +768,14 @@ chrome.runtime.onMessage.addListener((request, sender, sendResponse) => { |
|
|
|
sendResponse(true); |
|
|
|
sendResponse(true); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pendingResponses.delete(interactionId3); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
break; |
|
|
|
break; |
|
|
|
case "sendQortConfirmation": |
|
|
|
case "sendQortConfirmation": |
|
|
|
const { password, amount, receiver, isDecline } = request.payload; |
|
|
|
const { password, amount, receiver, isDecline } = request.payload; |
|
|
|
const interactionId2 = request.payload.interactionId; |
|
|
|
const interactionId2 = request.payload.interactionId; |
|
|
|
|
|
|
|
|
|
|
|
// Retrieve the stored sendResponse callback
|
|
|
|
// Retrieve the stored sendResponse callback
|
|
|
|
const originalSendResponse = pendingResponses.get(interactionId2); |
|
|
|
const originalSendResponse = pendingResponses.get(interactionId2); |
|
|
|
|
|
|
|
|
|
|
@ -782,6 +783,7 @@ chrome.runtime.onMessage.addListener((request, sender, sendResponse) => { |
|
|
|
if (isDecline) { |
|
|
|
if (isDecline) { |
|
|
|
originalSendResponse({ error: "User has declined" }); |
|
|
|
originalSendResponse({ error: "User has declined" }); |
|
|
|
sendResponse(false); |
|
|
|
sendResponse(false); |
|
|
|
|
|
|
|
pendingResponses.delete(interactionId2); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
sendCoin({ password, amount, receiver }, true) |
|
|
|
sendCoin({ password, amount, receiver }, true) |
|
|
@ -789,6 +791,8 @@ chrome.runtime.onMessage.addListener((request, sender, sendResponse) => { |
|
|
|
sendResponse(true); |
|
|
|
sendResponse(true); |
|
|
|
// Use the sendResponse callback to respond to the original message
|
|
|
|
// Use the sendResponse callback to respond to the original message
|
|
|
|
originalSendResponse(res); |
|
|
|
originalSendResponse(res); |
|
|
|
|
|
|
|
// Remove the callback from the Map as it's no longer needed
|
|
|
|
|
|
|
|
pendingResponses.delete(interactionId2); |
|
|
|
// chrome.runtime.sendMessage({
|
|
|
|
// chrome.runtime.sendMessage({
|
|
|
|
// action: "closePopup",
|
|
|
|
// action: "closePopup",
|
|
|
|
// });
|
|
|
|
// });
|
|
|
@ -799,8 +803,6 @@ chrome.runtime.onMessage.addListener((request, sender, sendResponse) => { |
|
|
|
originalSendResponse({ error: error.message }); |
|
|
|
originalSendResponse({ error: error.message }); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// Remove the callback from the Map as it's no longer needed
|
|
|
|
|
|
|
|
pendingResponses.delete(interactionId2); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
break; |
|
|
|
break; |
|
|
@ -813,7 +815,6 @@ chrome.runtime.onMessage.addListener((request, sender, sendResponse) => { |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
chrome.tabs.query({}, function(tabs) { |
|
|
|
chrome.tabs.query({}, function(tabs) { |
|
|
|
tabs.forEach(tab => { |
|
|
|
tabs.forEach(tab => { |
|
|
|
console.log({tab}) |
|
|
|
|
|
|
|
chrome.tabs.sendMessage(tab.id, { type: "LOGOUT" }); |
|
|
|
chrome.tabs.sendMessage(tab.id, { type: "LOGOUT" }); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|