WIP filters

This commit is contained in:
Ximi1970
2020-05-12 20:09:05 +02:00
parent b8a40ee159
commit 9c72b6bd06
2 changed files with 27 additions and 6 deletions

View File

@@ -411,12 +411,15 @@ async function start() {
// Get all accounts // Get all accounts
SysTrayX.Messaging.accounts = await browser.accounts.list(); SysTrayX.Messaging.accounts = await browser.accounts.list();
// Get the filters and convert old filters
const converted = await getFilters();
if( converted ) {
console.log("Filters converted to new format");
}
// Get the extended filters // Get the extended filters
SysTrayX.Messaging.filtersExt = await getFiltersExt(); SysTrayX.Messaging.filtersExt = await getFiltersExt();
// Get the filters
SysTrayX.Messaging.filters = await getFilters();
// Get the count type // Get the count type
SysTrayX.Messaging.countType = await getCountType(); SysTrayX.Messaging.countType = await getCountType();

View File

@@ -89,11 +89,23 @@ async function getMinimizeOnClose() {
// //
async function getFilters() { async function getFilters() {
function getFiltersCb(result) { function getFiltersCb(result) {
return result.filters || undefined; let filters = result.filters || undefined;
console.debug("Converting filters....")
// Store extended query filters
/*
browser.storage.sync.set({
filtersExt: filters,
});
*/
return true;
} }
function onFiltersError() { function onFiltersError() {
return undefined; return false;
} }
const getFilters = browser.storage.sync.get("filters"); const getFilters = browser.storage.sync.get("filters");
@@ -105,7 +117,13 @@ async function getFilters() {
// //
async function getFiltersExt() { async function getFiltersExt() {
function getFiltersExtCb(result) { function getFiltersExtCb(result) {
return result.filtersExt || undefined; const filtersExt = result.filtersExt || undefined;
console.debug("Accounts: " + SysTrayX.Messaging.accounts);
return filtersExt;
} }
function onFiltersExtError() { function onFiltersExtError() {