mirror of
https://github.com/Ximi1970/systray-x.git
synced 2026-02-06 22:39:02 +01:00
Fix deprecated methods
This commit is contained in:
@@ -8,20 +8,34 @@ SysTrayX.Accounts = {
|
||||
},
|
||||
|
||||
getAccounts: async function () {
|
||||
let accounts;
|
||||
if (SysTrayX.Info.browserInfo.majorVersion < 121) {
|
||||
let accounts;
|
||||
|
||||
accounts = await browser.accounts.list(false);
|
||||
accounts = await browser.accounts.list(false);
|
||||
|
||||
// Fill the sub folders using the folders API, they are not same...
|
||||
for (let i = 0; i < accounts.length; ++i) {
|
||||
const subFolders = await browser.folders.getSubFolders(
|
||||
accounts[i],
|
||||
true
|
||||
);
|
||||
accounts[i].folders = subFolders;
|
||||
// Fill the sub folders using the folders API, they are not same...
|
||||
for (let i = 0; i < accounts.length; ++i) {
|
||||
const subFolders = await browser.folders.getSubFolders(
|
||||
accounts[i],
|
||||
true
|
||||
);
|
||||
accounts[i].folders = subFolders;
|
||||
}
|
||||
|
||||
return accounts;
|
||||
} else {
|
||||
let accounts = await browser.accounts.list();
|
||||
|
||||
for (let i = 0; i < accounts.length; ++i) {
|
||||
const subFolders = await browser.folders.getSubFolders(
|
||||
accounts[i].id,
|
||||
true
|
||||
);
|
||||
accounts[i].folders = subFolders;
|
||||
}
|
||||
|
||||
return accounts;
|
||||
}
|
||||
|
||||
return accounts;
|
||||
},
|
||||
|
||||
buildTree: function (mailAccount) {
|
||||
|
||||
@@ -1233,7 +1233,16 @@ SysTrayX.RestoreOptions = {
|
||||
)
|
||||
);
|
||||
|
||||
filter.folders.forEach((path) => {
|
||||
filter.folders.forEach((storedFolder) => {
|
||||
|
||||
if (typeof(storedFolder) === "string") {
|
||||
// Filters pre TB 121
|
||||
path = storedFolder;
|
||||
} else {
|
||||
// Filters TB 121
|
||||
path = storedFolder.path;
|
||||
}
|
||||
|
||||
checkboxes.forEach((checkbox) => {
|
||||
const value = JSON.parse(checkbox.value);
|
||||
if (value.path === path) {
|
||||
@@ -1539,8 +1548,8 @@ async function start() {
|
||||
browser.storage.onChanged.addListener(SysTrayX.StorageChanged.changed);
|
||||
|
||||
document.addEventListener("visibilitychange", function () {
|
||||
if (document.visibilityState === "hidden") {
|
||||
browser.storage.onChanged.removeListener(SysTrayX.StorageChanged.changed);
|
||||
if ( browser.storage.onChanged.hasListener(SysTrayX.StorageChanged.changed) ) {
|
||||
browser.storage.onChanged.removeListener(SysTrayX.StorageChanged.changed);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user