Skip to content

Commit

Permalink
Added uninstall survey (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
WesleyBranton committed May 5, 2022
1 parent 4c50902 commit 08b2181
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion firefox/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ function handleInstalled(details) {
if (details.reason == 'update') {
const previousVersion = parseFloat(details.previousVersion);
if (previousVersion < 2.5) {
browser.tabs.create({ url: 'https://addons.wesleybranton.com/addon/outlook-mailto/update/v2_5' });
browser.tabs.create({ url: `${webBase}/update/v2_5` });
}
}
}
Expand Down Expand Up @@ -290,10 +290,34 @@ function hasPermission(permission, type) {
return permissions[type].includes(permission);
}

/**
* Set up uninstall page
*/
function setUninstallPage() {
getSystemDetails((details) => {
browser.runtime.setUninstallURL(`${webBase}/uninstall/?browser=${details.browser}&os=${details.os}&version=${details.version}`);
});
}

/**
* Send system details to callback
* @param {Function} callback
*/
function getSystemDetails(callback) {
browser.runtime.getPlatformInfo((platform) => {
callback({
browser: 'firefox',
version: browser.runtime.getManifest().version,
os: platform.os
});
});
}

const permissionType = {
ORIGINS: 'origins',
PERMISSIONS: 'permissions'
}
const webBase = 'https://addons.wesleybranton.com/addon/outlook-mailto';
let tmpUrl, permissions;
let openInNewWindow = false;
let showContextMenu = true;
Expand All @@ -309,6 +333,7 @@ const filter = {
let data = browser.storage.local.get();
data.then(verify);
updatePermissionsCache();
setUninstallPage();

browser.runtime.onInstalled.addListener(handleInstalled);
browser.runtime.onMessage.addListener(saveMessage);
Expand Down

0 comments on commit 08b2181

Please sign in to comment.