Skip to content

Commit

Permalink
Fixed new install bug
Browse files Browse the repository at this point in the history
  • Loading branch information
banjo committed Jan 22, 2021
1 parent f2296c2 commit f2acabf
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 10 deletions.
1 change: 0 additions & 1 deletion src/models/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ export interface ThumbnailSettingsState {
showVotes: boolean;
infiniteScroll: boolean;
isExtensionActive: boolean;
settingsInitiatedFromPopup: boolean;
}

export interface FilterOptions {
Expand Down
11 changes: 7 additions & 4 deletions src/services/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,15 @@ export async function loadStorageSettings() {
showVotes: false,
sorting: SortingOrder.Standard,
infiniteScroll: false,
isExtensionActive: false,
settingsInitiatedFromPopup: false,
isExtensionActive: true,
};

const settings = await getThumbnailSettingsStateFromStorage();

if (!settings) {
setThumbnailSettingsStateToStorage(initialSettings);
}

let updated = false;
Object.keys(initialSettings).forEach((key) => {
if (settings[key] == null) {
Expand All @@ -24,8 +27,8 @@ export async function loadStorageSettings() {
}
});

if (!settings || updated) {
setThumbnailSettingsStateToStorage(initialSettings);
if (updated) {
setThumbnailSettingsStateToStorage(settings);
}
}

Expand Down
1 change: 0 additions & 1 deletion src/services/scrape-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { getDayAfter, getDayBefore, insertAfter } from "./helpers";
import {
getArticleStateFromStorage,
getExtraArticleStateFromStorage,
getThumbnailSettingsStateFromStorage,
setArticleStateToStorage,
setExtraArticleStateToStorage,
} from "./storage-service";
Expand Down
4 changes: 0 additions & 4 deletions src/thumbnails.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import {
setArticleStateToStorage,
setExtraArticleStateToStorage,
setInitialHtmlState,
setThumbnailSettingsStateToStorage,
} from "./services/storage-service";
import { ArticleState, FilterOptions } from "./models/interfaces";
import { SortingOrder } from "./models/enums";
Expand All @@ -36,9 +35,6 @@ import { getNextPage } from "./services/scrape-service";
await initializeThumbnailsPage();
})();

// when button is clicked in plugin menu
chrome.runtime.onMessage.addListener(function (msg, sender, sendResponse) {});

async function changeBackToDisabledExtension() {
const html = await getInitialHtmlState();
document.querySelector("body").innerHTML = html;
Expand Down

0 comments on commit f2acabf

Please sign in to comment.