Skip to content

Commit

Permalink
Rollback change to fix icon not switching (#5508)
Browse files Browse the repository at this point in the history
* Rollback change to fix icon not switching

* Fix API name changes
  • Loading branch information
benmcgarry committed Mar 29, 2024
1 parent abf25d4 commit ee462dd
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/environment/background/pageAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
import { addListener, sendMessage } from './messaging';

(process.env.BUILD_TARGET === 'firefox' ? chrome.pageAction : chrome.action).onClicked.addListener(tab => {
sendMessage((process.env.BUILD_TARGET === 'firefox' ? 'pageActionClick' : 'actionClick'), undefined, tab.id);
sendMessage('pageActionClick', undefined, tab.id);
});

addListener((process.env.BUILD_TARGET === 'firefox' ? 'pageAction' : 'action'), ({ operation, state }, { tab }) => {
addListener('pageAction', ({ operation, state }, { tab }) => {
switch (operation) {
case 'show':
(process.env.BUILD_TARGET === 'firefox' ? chrome.pageAction : chrome.action).show(tab.id);
(process.env.BUILD_TARGET === 'firefox' ? chrome.pageAction.show : chrome.action.enable)(tab.id);
(process.env.BUILD_TARGET === 'firefox' ? chrome.pageAction : chrome.action).setIcon({
tabId: tab.id,
path: {
Expand All @@ -23,7 +23,7 @@ addListener((process.env.BUILD_TARGET === 'firefox' ? 'pageAction' : 'action'),
});
break;
case 'hide':
(process.env.BUILD_TARGET === 'firefox' ? chrome.pageAction : chrome.action).hide(tab.id);
(process.env.BUILD_TARGET === 'firefox' ? chrome.pageAction.hide : chrome.action.disable)(tab.id);
break;
default:
throw new Error(`Invalid action operation: ${operation}`);
Expand Down

0 comments on commit ee462dd

Please sign in to comment.