Autoclose the consent screen after user choice. Show consent screen only in FireFox

This commit is contained in:
ilyaigpetrov 2024-07-15 23:40:31 +05:00
parent 1c38137200
commit 2f5d425f34
2 changed files with 7 additions and 3 deletions

View File

@ -280,8 +280,10 @@ console.log('Extension started.');
const compareVersions = (a, b) => versionToInt(a) - versionToInt(b); const compareVersions = (a, b) => versionToInt(a) - versionToInt(b);
const ifFirefox = navigator.userAgent.toLowerCase().includes('firefox');
let give; let give;
const promise = new Promise((resolve) => { const promise = !ifFirefox ? Promise.resolve() : new Promise((resolve) => {
give = resolve; give = resolve;
}); });
@ -291,7 +293,7 @@ console.log('Extension started.');
give, give,
}, },
platform: { platform: {
ifFirefox: navigator.userAgent.toLowerCase().includes('firefox'), ifFirefox,
}, },
version: { version: {
ifMini: false, ifMini: false,

View File

@ -3,8 +3,10 @@
chrome.runtime.getBackgroundPage( (backgroundPage) => chrome.runtime.getBackgroundPage( (backgroundPage) =>
backgroundPage.apis.errorHandlers.installListenersOn( backgroundPage.apis.errorHandlers.installListenersOn(
window, 'CONSENT', () => { window, 'CONSENT', () => {
agreeBtn.onclick = () => agreeBtn.onclick = () => {
backgroundPage.apis.consent.give(); backgroundPage.apis.consent.give();
window.close();
}
rejectBtn.onclick = () => rejectBtn.onclick = () =>
chrome.management.uninstallSelf(); chrome.management.uninstallSelf();
}, },