mirror of
https://github.com/lil-org/tokenary.git
synced 2024-11-22 21:49:51 +03:00
Cancel pending inpage request on overlay being dismissed
This commit is contained in:
parent
b5beb3e3db
commit
707a15de62
File diff suppressed because one or more lines are too long
@ -110,6 +110,11 @@ function deliverResponseToSpecificProvider(id, response, provider) {
|
||||
|
||||
window.tokenary.overlayTapped = () => {
|
||||
window.tokenary.hideOverlay();
|
||||
const request = window.tokenary.overlayConfiguration.request;
|
||||
deliverResponseToSpecificProvider(request.id, {id: request.id, error: "Canceled", name: request.name}, request.provider);
|
||||
|
||||
// TODO: cancel pending request in extension pipeline
|
||||
// window.tokenary.postMessage(name, id, body, provider)
|
||||
};
|
||||
|
||||
window.tokenary.hideOverlay = () => {
|
||||
@ -144,7 +149,7 @@ window.tokenary.createOverlay = () => {
|
||||
};
|
||||
|
||||
window.tokenary.overlayButtonTapped = () => {
|
||||
const overlayConfiguration = window.tokenary.overlayConfiguration;
|
||||
window.location.href = "https://tokenary.io/extension?query=" + encodeURIComponent(JSON.stringify(overlayConfiguration));
|
||||
const request = window.tokenary.overlayConfiguration.request;
|
||||
window.location.href = "https://tokenary.io/extension?query=" + encodeURIComponent(JSON.stringify(request));
|
||||
window.tokenary.hideOverlay();
|
||||
};
|
||||
|
@ -27,7 +27,7 @@ function platformSpecificProcessMessage(message) {
|
||||
// + если он inpage будет отвечать на запрос ошибкой, то мне нужно будет как-то подчищать тот запрос, который ушел extension handler-у
|
||||
// или на iOS сделать так, чтобы запрос extension handler-у не уходил до того момента, пока он не нажал на overlay кнопку
|
||||
|
||||
const response = {overlayConfiguration: message};
|
||||
const response = {overlayConfiguration: {request: message}};
|
||||
window.postMessage({direction: "from-content-script", response: response, id: message.id}, "*");
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user