Skip to content

Commit

Permalink
Merge pull request #36 from masonmcelvain/drop-legacy-links
Browse files Browse the repository at this point in the history
fix: drop legacy link support
  • Loading branch information
masonmcelvain authored Dec 6, 2022
2 parents 5cb5f38 + 1f4326e commit d0547b2
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 33 deletions.
10 changes: 0 additions & 10 deletions src/contexts/Links/getLegacyLinks.ts

This file was deleted.

23 changes: 0 additions & 23 deletions src/contexts/Links/index.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import * as React from "react";
import browser from "webextension-polyfill";
import {
getStorageKeyForLink,
setNextStoredLinkId,
setStoredLinksAndKeys,
StorageKey,
} from "../../lib/webextension";
import { getLegacyLinks } from "./getLegacyLinks";
import {
Reducer,
LinkAction,
Expand Down Expand Up @@ -48,8 +46,6 @@ export const LinksProvider = ({
nextLinkId: state.nextLinkId,
};

const fetchLegacyLinks = async () => await getLegacyLinks();

browser.storage.local
.get([StorageKey.LINK_STORAGE_KEYS, StorageKey.NEXT_LINK_ID])
.then((result) => {
Expand All @@ -70,25 +66,6 @@ export const LinksProvider = ({
payload,
});
});
} else if (nextLinkId) {
// Migrate legacy links to new storage format
fetchLegacyLinks().then((legacyLinks) => {
if (legacyLinks && legacyLinks.length > 0) {
payload.nextLinkId = nextLinkId;
payload.links = legacyLinks;
payload.linkKeys = legacyLinks.map((link) =>
getStorageKeyForLink(link)
);

setStoredLinksAndKeys(legacyLinks, payload.linkKeys);
dispatch({
type: LinkAction.SET_STATE_FROM_STORAGE,
payload,
});
} else {
cleanseStoredState();
}
});
} else {
cleanseStoredState();
}
Expand Down

0 comments on commit d0547b2

Please sign in to comment.