diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 495ec7b4..db137368 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -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": { diff --git a/background/icon-manager.js b/background/icon-manager.js index 122b7e5b..5e13a15c 100644 --- a/background/icon-manager.js +++ b/background/icon-manager.js @@ -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}); }, }; diff --git a/background/sync-manager.js b/background/sync-manager.js index 48f3c7a3..c680898d 100644 --- a/background/sync-manager.js +++ b/background/sync-manager.js @@ -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); }