mirror of
https://github.com/lil-org/tokenary.git
synced 2024-11-22 21:49:51 +03:00
stop creating an overlay configuration
This commit is contained in:
parent
10d8579309
commit
102c8f8f09
@ -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));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user