Verified Commit a7c72445 authored by Thomas Rientjes's avatar Thomas Rientjes
Browse files

Improve support for mobile versions of Firefox

parent f10e4e1f
......@@ -35,7 +35,7 @@ stateManager.registerInjection = function (tabIdentifier, injection) {
if (injectionCount > 0) {
chrome.browserAction.setTitle({
helpers.updateBrowserActionTitle({
'tabId': tabIdentifier,
'title': `Decentraleyes (${injectionCount})`
});
......@@ -162,7 +162,7 @@ stateManager._updateTab = function (details) {
return;
}
chrome.browserAction.setTitle({
helpers.updateBrowserActionTitle({
'tabId': tabIdentifier,
'title': 'Decentraleyes (0)'
});
......@@ -171,7 +171,7 @@ stateManager._updateTab = function (details) {
stateManager._setIconDisabled(tabIdentifier);
chrome.browserAction.setTitle({
helpers.updateBrowserActionTitle({
'tabId': tabIdentifier,
'title': 'Decentraleyes (–)'
});
......
......@@ -277,3 +277,14 @@ helpers.formatVersion = function (version) {
return 'BETA';
}
};
helpers.updateBrowserActionTitle = function (details) {
chrome.runtime.getPlatformInfo(function (information) {
if (information.os !== chrome.runtime.PlatformOs.ANDROID ||
chrome.browserAction.setBadgeText === undefined) {
chrome.browserAction.setTitle(details);
}
});
};
......@@ -390,8 +390,23 @@ popup._onTestingUtilityLinkClicked = function (event) {
popup._onOptionsButtonClicked = function () {
chrome.runtime.openOptionsPage();
return window.close();
chrome.runtime.getPlatformInfo(function (information) {
if (information.os === chrome.runtime.PlatformOs.ANDROID) {
chrome.tabs.create({
'url': chrome.runtime.getURL('pages/options/options.html'),
'active': true
});
return window.close();
} else {
chrome.runtime.openOptionsPage();
return window.close();
}
});
};
popup._onProtectionToggled = function () {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment