This repository was archived by the owner on Oct 25, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
implement StorageApi for browser.storage.StorageArea #396
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Just implements 1 method for now, but it's indicative of how the code for other ones might look like |
The basics of this Media1.mp4To film the above video in addition to the changes in the PR I applied the following diff: diff --git a/archaeologist/src/background.ts b/archaeologist/src/background.ts
index 341f2df..484248e 100644
--- a/archaeologist/src/background.ts
+++ b/archaeologist/src/background.ts
@@ -27,7 +27,6 @@ import {
NodeUtil,
TotalUserActivity,
ResourceVisit,
- makeDatacenterStorageApi,
UserExternalPipelineId,
NodeCreatedVia,
UserExternalPipelineIngestionProgress,
@@ -35,6 +34,7 @@ import {
steroid,
} from 'smuggler-api'
+import { makeBrowserExtStorageApi } from './storage_api_browser_ext'
import { isReadyToBeAutoSaved } from './background/pageAutoSaving'
import { suggestAssociations } from './background/suggestAssociations'
import { isMemorable } from './content/extractor/url/unmemorable'
@@ -878,7 +878,7 @@ browser.contextMenus.onClicked.addListener(
}
)
-const storage: StorageApi = makeDatacenterStorageApi()
+const storage: StorageApi = makeBrowserExtStorageApi(browser.storage.local)
auth.register()
browserBookmarks.register(storage)
diff --git a/archaeologist/src/content/App.tsx b/archaeologist/src/content/App.tsx
index e8698f6..0c3caca 100644
--- a/archaeologist/src/content/App.tsx
+++ b/archaeologist/src/content/App.tsx
@@ -5,13 +5,14 @@ import browser from 'webextension-polyfill'
import { PostHog } from 'posthog-js'
import { v4 as uuidv4 } from 'uuid'
-import { NodeUtil, NodeType, makeDatacenterStorageApi } from 'smuggler-api'
+import { NodeUtil, NodeType } from 'smuggler-api'
import type { TNode, TNodeJson } from 'smuggler-api'
import { genOriginId, OriginIdentity, log, productanalytics } from 'armoury'
import * as truthsayer_archaeologist_communication from 'truthsayer-archaeologist-communication'
import { mazed } from '../util/mazed'
+import { makeBrowserExtStorageApi } from './../storage_api_browser_ext'
import {
FromContent,
ToContent,
@@ -392,7 +393,7 @@ const App = () => {
<ContentContext.Provider
value={{
analytics: state.analytics,
- storage: makeDatacenterStorageApi(),
+ storage: makeBrowserExtStorageApi(browser.storage.local),
}}
>
<BrowserHistoryImportControlPortal
diff --git a/archaeologist/src/popup/PopUpApp.tsx b/archaeologist/src/popup/PopUpApp.tsx
index c656c70..81f2ed1 100644
--- a/archaeologist/src/popup/PopUpApp.tsx
+++ b/archaeologist/src/popup/PopUpApp.tsx
@@ -15,7 +15,7 @@ import { mazed } from '../util/mazed'
import { MdiLaunch } from 'elementary'
import { productanalytics } from 'armoury'
import { PopUpContext } from './context'
-import { makeDatacenterStorageApi } from 'smuggler-api'
+import { makeBrowserExtStorageApi } from './../storage_api_browser_ext'
const AppContainer = styled.div`
width: 340px;
@@ -74,7 +74,9 @@ export const PopUpApp = () => {
return (
<AppContainer>
- <PopUpContext.Provider value={{ storage: makeDatacenterStorageApi() }}>
+ <PopUpContext.Provider
+ value={{ storage: makeBrowserExtStorageApi(browser.storage.local) }}
+ >
{state.userUid == null ? <LoginPage /> : <ViewActiveTabStatus />}
</PopUpContext.Provider>
</AppContainer> |
20ceb6c
to
ace30b8
Compare
akindyakov
approved these changes
Jan 14, 2023
"webNavigation" | ||
"webNavigation", | ||
"storage", | ||
"unlimitedStorage" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
#351