stop creating an overlay configuration

This commit is contained in:
ivan grachev 2023-10-23 18:37:49 +03:00
parent 10d8579309
commit 102c8f8f09

View File

@ -16,40 +16,7 @@ document.addEventListener('visibilitychange', didChangeVisibility);
function platformSpecificProcessMessage(message) {
if (message.provider == "ethereum" && (message.name == "switchEthereumChain" || message.name == "addEthereumChain")) {
return;
} else {
var title = "Proceed<br>in Tokenary";
switch (message.name) {
case "signPersonalMessage":
case "signMessage":
case "signTypedMessage":
title = "Sign Message<br>in Tokenary";
break;
case "signTransaction":
case "signAndSendTransactions":
case "signAllTransactions":
case "signAndSendTransaction":
title = "Approve Transaction<br>in Tokenary";
break;
case "requestAccounts":
case "signIn":
case "connect":
title = "Connect<br>Tokenary";
break;
case "switchAccount":
const latestConfigurations = message.body.latestConfigurations;
if (Array.isArray(latestConfigurations) && latestConfigurations.length) {
title = "Switch<br>Account";
} else {
title = "Connect<br>Tokenary";
}
break;
}
const response = {overlayConfiguration: {request: message, title: title}};
window.postMessage({direction: "from-content-script", response: response, id: message.id}, "*");
if (document.inpageAvailable != true && message.name == "switchAccount") {
window.location.href = "tokenary://" + encodeURIComponent(JSON.stringify(message));
}
} else if (document.inpageAvailable != true && message.name == "switchAccount") {
window.location.href = "tokenary://" + encodeURIComponent(JSON.stringify(message));
}
}