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