diff options
-rw-r--r-- | manifest.json | 2 | ||||
-rw-r--r-- | src/webex/wxBackend.ts | 16 |
2 files changed, 14 insertions, 4 deletions
diff --git a/manifest.json b/manifest.json index b27fcd235..23cb3dfec 100644 --- a/manifest.json +++ b/manifest.json @@ -4,7 +4,7 @@ "name": "GNU Taler Wallet (git)", "description": "Privacy preserving and transparent payments", "author": "GNU Taler Developers", - "version": "0.6.56", + "version": "0.6.57", "version_name": "0.5.0-pre9", "minimum_chrome_version": "51", diff --git a/src/webex/wxBackend.ts b/src/webex/wxBackend.ts index d7c43225d..0b4f0976e 100644 --- a/src/webex/wxBackend.ts +++ b/src/webex/wxBackend.ts @@ -105,7 +105,7 @@ function handleMessage(sender: MessageSender, } } deleteDb(); - chrome.browserAction.setBadgeText({ text: "" }); + setBadgeText({ text: "" }); console.log("reset done"); if (!currentWallet) { reinitWallet(); @@ -458,6 +458,16 @@ function getTab(tabId: number): Promise<chrome.tabs.Tab> { } +function setBadgeText(options: chrome.browserAction.BadgeTextDetails) { + // not supported by all browsers ... + if (chrome && chrome.browserAction && chrome.browserAction.setBadgeText) { + chrome.browserAction.setBadgeText(options); + } else { + console.warn("can't set badge text, not supported", options); + } +} + + function waitMs(timeoutMs: number): Promise<void> { return new Promise((resolve, reject) => { chrome.extension.getBackgroundPage().setTimeout(() => resolve(), timeoutMs); @@ -675,7 +685,7 @@ async function reinitWallet() { currentWallet.stop(); currentWallet = undefined; } - chrome.browserAction.setBadgeText({ text: "" }); + setBadgeText({ text: "" }); const badge = new ChromeBadge(); let db: IDBDatabase; try { @@ -894,7 +904,7 @@ function openTalerDb(): Promise<IDBDatabase> { chrome.tabs.create({ url: chrome.extension.getURL("/src/webex/pages/reset-required.html"), }); - chrome.browserAction.setBadgeText({text: "err"}); + setBadgeText({text: "err"}); chrome.browserAction.setBadgeBackgroundColor({color: "#F00"}); throw Error("incompatible DB"); } |