aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2018-02-20 16:17:05 +0100
committerFlorian Dold <florian.dold@gmail.com>2018-02-20 16:17:05 +0100
commit23f4998dfec5edc8f0ce134d848c996d434181ba (patch)
tree721515494496e64c26c7c7b1d61143ac8c77153b /src
parent6aa929f2a7dfb4264bbcb05e77e91984d3441cae (diff)
Firefox on Android compatibility
Diffstat (limited to 'src')
-rw-r--r--src/webex/wxBackend.ts16
1 files changed, 13 insertions, 3 deletions
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");
}