From 3a9c5f8e3f1bc9975324704d7aa7ce1fa636045e Mon Sep 17 00:00:00 2001 From: Ximi1970 Date: Sun, 8 Aug 2021 17:34:42 +0200 Subject: [PATCH] WIP new tb91 api test --- dist/arch/gnome/PKGBUILD | 2 +- dist/arch/kde/PKGBUILD | 2 +- dist/arch/minimal/PKGBUILD | 2 +- dist/deb/gnome/debian.control | 2 +- dist/deb/kde/debian.control | 2 +- dist/deb/minimal/debian.control | 2 +- dist/rpm/gnome/systray-x-gnome.spec | 4 +-- dist/rpm/kde/systray-x.spec | 4 +-- dist/rpm/minimal/systray-x-minimal.spec | 4 +-- webext/background.js | 43 ++++++++++++++++++++++++- webext/js/defaults.js | 5 +-- webext/js/options_accounts.js | 13 +++++++- webext/manifest.json | 2 +- 13 files changed, 70 insertions(+), 17 deletions(-) diff --git a/dist/arch/gnome/PKGBUILD b/dist/arch/gnome/PKGBUILD index 8d44690..0e704ce 100644 --- a/dist/arch/gnome/PKGBUILD +++ b/dist/arch/gnome/PKGBUILD @@ -12,7 +12,7 @@ depends=( 'qt5-base' 'gnome-shell-extension-appindicator' 'thunderbird>=68' - 'thunderbird<=89' + 'thunderbird<=91' ) makedepends=( 'git' diff --git a/dist/arch/kde/PKGBUILD b/dist/arch/kde/PKGBUILD index d195089..0db35e9 100644 --- a/dist/arch/kde/PKGBUILD +++ b/dist/arch/kde/PKGBUILD @@ -12,7 +12,7 @@ depends=( 'qt5-base' 'knotifications' 'thunderbird>=68' - 'thunderbird<=89' + 'thunderbird<=91' ) makedepends=( 'git' diff --git a/dist/arch/minimal/PKGBUILD b/dist/arch/minimal/PKGBUILD index 9aad835..8802745 100644 --- a/dist/arch/minimal/PKGBUILD +++ b/dist/arch/minimal/PKGBUILD @@ -11,7 +11,7 @@ license=(MPL-2.0) depends=( 'qt5-base' 'thunderbird>=68' - 'thunderbird<=89' + 'thunderbird<=91' ) makedepends=( 'git' diff --git a/dist/deb/gnome/debian.control b/dist/deb/gnome/debian.control index 4bf01d3..ed58c6f 100644 --- a/dist/deb/gnome/debian.control +++ b/dist/deb/gnome/debian.control @@ -6,7 +6,7 @@ Build-Depends: debhelper (>= 4.1.16), zip, g++, libx11-dev, qt5-qmake, qtbase5-d Package: systray-x-gnome Architecture: any -Depends: ${shlibs:Depends}, gnome-shell-extension-appindicator, thunderbird (>= 1:68), thunderbird (<= 1:89) +Depends: ${shlibs:Depends}, gnome-shell-extension-appindicator, thunderbird (>= 1:68), thunderbird (<= 1:91) Description: SysTray-X is a system tray extension for Thunderbird 68+ (GNOME). This version is optimized for the GNOME desktop. The add-on uses the WebExtension API's to control an external system diff --git a/dist/deb/kde/debian.control b/dist/deb/kde/debian.control index 35a0343..82f898d 100644 --- a/dist/deb/kde/debian.control +++ b/dist/deb/kde/debian.control @@ -6,7 +6,7 @@ Build-Depends: debhelper (>= 4.1.16), zip, g++, libx11-dev, qt5-qmake, qtbase5-d Package: systray-x Architecture: any -Depends: ${shlibs:Depends}, thunderbird (>= 1:68), thunderbird (<= 1:89) +Depends: ${shlibs:Depends}, thunderbird (>= 1:68), thunderbird (<= 1:91) Description: SysTray-X is a system tray extension for Thunderbird 68+ (KDE). This version is optimized for the KDE desktop. The add-on uses the WebExtension API's to control an external system diff --git a/dist/deb/minimal/debian.control b/dist/deb/minimal/debian.control index 5991fe8..a5a6107 100644 --- a/dist/deb/minimal/debian.control +++ b/dist/deb/minimal/debian.control @@ -6,7 +6,7 @@ Build-Depends: debhelper (>= 4.1.16), zip, g++, libx11-dev, qt5-qmake, qtbase5-d Package: systray-x-minimal Architecture: any -Depends: ${shlibs:Depends}, thunderbird (>= 1:68), thunderbird (<= 1:89) +Depends: ${shlibs:Depends}, thunderbird (>= 1:68), thunderbird (<= 1:91) Description: SysTray-X is a system tray extension for Thunderbird 68+ (non-GNOME,non-KDE). This version is for non-KDE and non-GNOME desktops. The add-on uses the WebExtension API's to control an external system diff --git a/dist/rpm/gnome/systray-x-gnome.spec b/dist/rpm/gnome/systray-x-gnome.spec index cca1db6..2e6ba00 100644 --- a/dist/rpm/gnome/systray-x-gnome.spec +++ b/dist/rpm/gnome/systray-x-gnome.spec @@ -33,10 +33,10 @@ BuildRequires: pkgconfig(x11) Requires: gnome-shell-extension-appindicator %if 0%{?fedora_version} || 0%{?centos_version} Requires: thunderbird >= 68 -Requires: thunderbird <= 89 +Requires: thunderbird <= 91 %else Requires: MozillaThunderbird >= 68 -Requires: MozillaThunderbird <= 89 +Requires: MozillaThunderbird <= 91 %endif %description diff --git a/dist/rpm/kde/systray-x.spec b/dist/rpm/kde/systray-x.spec index 2c09536..1acf904 100644 --- a/dist/rpm/kde/systray-x.spec +++ b/dist/rpm/kde/systray-x.spec @@ -34,12 +34,12 @@ BuildRequires: pkgconfig(x11) BuildRequires: kf5-knotifications-devel Requires: kf5-knotifications Requires: thunderbird >= 68 -Requires: thunderbird <= 89 +Requires: thunderbird <= 91 %else BuildRequires: knotifications-devel Requires: libKF5Notifications5 Requires: MozillaThunderbird >= 68 -Requires: MozillaThunderbird <= 89 +Requires: MozillaThunderbird <= 91 %endif %description diff --git a/dist/rpm/minimal/systray-x-minimal.spec b/dist/rpm/minimal/systray-x-minimal.spec index f9eb26c..679d712 100644 --- a/dist/rpm/minimal/systray-x-minimal.spec +++ b/dist/rpm/minimal/systray-x-minimal.spec @@ -32,10 +32,10 @@ BuildRequires: pkgconfig(Qt5DBus) BuildRequires: pkgconfig(x11) %if 0%{?fedora_version} || 0%{?centos_version} Requires: thunderbird >= 68 -Requires: thunderbird <= 89 +Requires: thunderbird <= 91 %else Requires: MozillaThunderbird >= 68 -Requires: MozillaThunderbird <= 89 +Requires: MozillaThunderbird <= 91 %endif %description diff --git a/webext/background.js b/webext/background.js index c725a2a..d5f4734 100644 --- a/webext/background.js +++ b/webext/background.js @@ -82,6 +82,16 @@ SysTrayX.Messaging = { // Try to catch the window state browser.windows.onFocusChanged.addListener(SysTrayX.Window.focusChanged); + + // Test new API from TB91 + browser.folders.onFolderInfoChanged.addListener( + SysTrayX.Messaging.listenerTest + ); + }, + + listenerTest: function (folder, folderInfo) { + console.debug("Folder: " + JSON.stringify(folder)); + console.debug("FolderInfo: " + JSON.stringify(folderInfo)); }, onCloseButton: function () { @@ -656,7 +666,14 @@ async function start() { await getIcon(); // Get all accounts - SysTrayX.Messaging.accounts = await browser.accounts.list(); + if (SysTrayX.browserInfo.majorVersion < 91) { + SysTrayX.Messaging.accounts = await browser.accounts.list(); + } else { + console.debug("Getting accounts with folders"); + + const includeFolders = true; + SysTrayX.Messaging.accounts = await browser.accounts.list(includeFolders); + } // Get folder tree SysTrayX.Messaging.folderTree = getFolderTree( @@ -670,6 +687,30 @@ async function start() { // Get the count type SysTrayX.Messaging.countType = await getCountType(); + // Test new API calls TB91 + + /* + const folder = { + accountId: "account1", + path: "/Inbox", + }; +*/ + + /* + const folder = { + accountId: "account1", + name: "Inbox", + path: "/Inbox", + type: "inbox", + subFolders: [], + }; +*/ + + /* + const mailFolderInfo = await browser.folders.getFolderInfo(folder); + console.debug("MailFolderInfo: " + JSON.stringify(mailFolderInfo)); +*/ + // Setup the link first SysTrayX.Link.init(); diff --git a/webext/js/defaults.js b/webext/js/defaults.js index b9a99a0..7939f2d 100644 --- a/webext/js/defaults.js +++ b/webext/js/defaults.js @@ -460,8 +460,9 @@ async function getFilters() { console.debug("Checked filters: " + JSON.stringify(newFilters)); - return newFilters; - } +// return newFilters; + return filters; +} function onFiltersError() { return undefined; diff --git a/webext/js/options_accounts.js b/webext/js/options_accounts.js index 070ad2f..792162a 100644 --- a/webext/js/options_accounts.js +++ b/webext/js/options_accounts.js @@ -18,7 +18,18 @@ SysTrayX.Accounts = { * Be aware that the data is only avaiable inside the callback */ getAccounts: async function () { - return await browser.accounts.list(); + if (BrowserInfo.version.split(".")[0] < 91) { + return await browser.accounts.list(); + } else { + console.debug("Get account with folders"); + + const includeFolders = true; + const accounts = await browser.accounts.list(includeFolders); + + console.debug("Options accounts: " + JSON.stringify(accounts)); + + return accounts; + } }, /* diff --git a/webext/manifest.json b/webext/manifest.json index e31aa78..73e33a7 100644 --- a/webext/manifest.json +++ b/webext/manifest.json @@ -10,7 +10,7 @@ "gecko": { "id": "systray-x@Ximi1970", "strict_min_version": "68.0", - "strict_max_version": "89.*" + "strict_max_version": "91.*" } },