Skip to content

Commit

Permalink
enable shelf hiding only if extension is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
gautamkrishnar committed Oct 22, 2023
1 parent 7b7513b commit 3dfe5b0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/scripts/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ async function downloadAgent() {
const observable = new Observable((s) => subscribers.push(s));
const history = new Map();
// Hide bottom bar
browser.storage.sync.get(['hideChromeBar']).then(({ hideChromeBar }) => {
browser.downloads.setShelfEnabled?.(!hideChromeBar);
browser.storage.sync.get(['hideChromeBar', 'extensionStatus']).then(({ hideChromeBar, extensionStatus }) => {
if (extensionStatus) browser.downloads.setShelfEnabled?.(!hideChromeBar);
});
// Setup history
const { oldHistory = [] } = await browser.storage.local.get(['history']);
Expand Down
2 changes: 1 addition & 1 deletion app/scripts/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ function ConfigView() {
<Switch
checked={hideChromeBar}
onClick={() => {
if (browser.downloads.setShelfEnabled) {
if (browser.downloads.setShelfEnabled && extensionStatus) {
browser.downloads.setShelfEnabled(!!hideChromeBar);
}
browser.storage.sync.set({
Expand Down
1 change: 1 addition & 0 deletions app/scripts/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ function PopupView() {

const onExtensionStatusChange = (status) => {
browser.storage.sync.set({ extensionStatus: status });
if (!status) browser.downloads.setShelfEnabled?.(true);
setExtensionStatus(status);
};

Expand Down

0 comments on commit 3dfe5b0

Please sign in to comment.