fix/simplify
This commit is contained in:
parent
3a0103dc8e
commit
d33bb76938
|
@ -1531,7 +1531,7 @@
|
|||
"description": "Displayed when trying to save an excessively big value via storage.sync API"
|
||||
},
|
||||
"syncErrorRelogin": {
|
||||
"message": "Sync failed.\nPlease re-login.",
|
||||
"message": "Sync failed.\nTry to re-login in Stylus options:\nclick 'disconnect' first, then 'connect'.",
|
||||
"description": "Tooltip for the toolbar icon"
|
||||
},
|
||||
"toggleStyle": {
|
||||
|
|
|
@ -58,8 +58,8 @@ const iconMan = (() => {
|
|||
|
||||
return {
|
||||
/** Calling with no params clears the override */
|
||||
overrideBadge({text = '', color = ''} = {}) {
|
||||
if (badgeOvr.text === text && badgeOvr.color === color) {
|
||||
overrideBadge({text = '', color = '', title = ''} = {}) {
|
||||
if (badgeOvr.text === text) {
|
||||
return;
|
||||
}
|
||||
badgeOvr.text = text;
|
||||
|
@ -73,9 +73,7 @@ const iconMan = (() => {
|
|||
refreshIconBadgeText(tabId);
|
||||
}
|
||||
}
|
||||
chrome.browserAction.setTitle({
|
||||
title: text ? chrome.i18n.getMessage('syncErrorRelogin') : '',
|
||||
}, ignoreChromeError);
|
||||
chrome.browserAction.setTitle({title});
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
@ -100,10 +100,8 @@ const syncMan = (() => {
|
|||
}
|
||||
await syncMan.syncNow();
|
||||
status.errorMessage = null;
|
||||
iconMan.overrideBadge();
|
||||
} catch (err) {
|
||||
status.errorMessage = err.message;
|
||||
iconMan.overrideBadge({text: 'x', color: '#F00'});
|
||||
// FIXME: should we move this logic to options.js?
|
||||
if (!fromPref) {
|
||||
console.error(err);
|
||||
|
@ -201,6 +199,11 @@ const syncMan = (() => {
|
|||
status.login = false;
|
||||
emitStatusChange();
|
||||
}
|
||||
iconMan.overrideBadge(!emit ? {} : {
|
||||
text: 'x',
|
||||
color: '#F00',
|
||||
title: chrome.i18n.getMessage('syncErrorRelogin'),
|
||||
});
|
||||
return Promise.reject(err);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user