Merge branch 'master' into dev-sync-explicit

# Conflicts:
#	background/sync-manager.js
This commit is contained in:
tophf 2021-02-09 13:36:22 +03:00
commit f9e3e1e80c
2 changed files with 16 additions and 20 deletions

View File

@ -67,13 +67,15 @@ const iconMan = (() => {
refreshIconBadgeColor();
setBadgeText({text});
for (const tabId of tabMan.list()) {
if (badgeOvr) {
if (text) {
setBadgeText({tabId, text});
} else {
refreshIconBadgeText(tabId);
}
}
chrome.browserAction.setTitle({title});
chrome.browserAction.setTitle({
title: title && chrome.i18n.getMessage(title) || title || '',
});
},
};

View File

@ -204,24 +204,7 @@ const syncMan = (() => {
function emitStatusChange() {
msg.broadcastExtension({method: 'syncStatusUpdate', status});
if (status.state !== STATES.connected) {
iconMan.overrideBadge({});
} else if (!status.login) {
iconMan.overrideBadge({
text: 'x',
color: '#F00',
title: chrome.i18n.getMessage('syncErrorRelogin'),
});
} else if (lastError && !isNetworkError(lastError)) {
iconMan.overrideBadge({
text: 'x',
color: '#F00',
title: chrome.i18n.getMessage('syncError'),
});
} else {
iconMan.overrideBadge({});
}
iconMan.overrideBadge(getErrorBadge());
}
function isNetworkError(err) {
@ -234,6 +217,17 @@ const syncMan = (() => {
return false;
}
function getErrorBadge() {
if (status.state === STATES.connected &&
(!status.login || lastError && !isNetworkError(lastError))) {
return {
text: 'x',
color: '#F00',
title: !status.login ? 'syncErrorRelogin' : 'syncError',
};
}
}
function getDrive(name) {
if (name === 'dropbox' || name === 'google' || name === 'onedrive') {
return dbToCloud.drive[name]({