Skip to content

Commit 8a4c236

Browse files
committed
Do it better
1 parent d5c1fb3 commit 8a4c236

File tree

4 files changed

+5
-22
lines changed

4 files changed

+5
-22
lines changed

src/background/dynamic_content_scripts.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,3 @@ export async function unregisterContentScriptIfExists(
5555

5656
return true;
5757
}
58-
59-
export async function setStorageValues(payload: any): Promise<void> {
60-
await browser.storage.sync.set(payload);
61-
}

src/background/main.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,8 @@ import { MessageType } from "src/types";
44
import { Codecov } from "src/service";
55
import {
66
registerContentScript,
7-
setStorageValues,
87
unregisterContentScriptIfExists,
98
} from "./dynamic_content_scripts";
10-
import {
11-
selfHostedCodecovApiToken,
12-
selfHostedCodecovURLStorageKey,
13-
selfHostedGitHubURLStorageKey,
14-
useSelfHostedStorageKey,
15-
} from "src/constants";
169

1710
async function main(): Promise<void> {
1811
browser.runtime.onMessage.addListener(handleMessages);
@@ -38,8 +31,6 @@ async function handleMessages(message: {
3831
return registerContentScript(message.payload);
3932
case MessageType.UNREGISTER_CONTENT_SCRIPTS:
4033
return unregisterContentScriptIfExists(message.payload);
41-
case MessageType.SET_STORAGE_VALUES:
42-
return setStorageValues(message.payload);
4334
}
4435
}
4536

src/popup/main.tsx

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -142,14 +142,11 @@ const Popup = () => {
142142
}
143143
}
144144

145-
await browser.runtime.sendMessage({
146-
type: MessageType.SET_STORAGE_VALUES,
147-
payload: {
148-
[useSelfHostedStorageKey]: useSelfHosted,
149-
[selfHostedCodecovURLStorageKey]: codecovUrl,
150-
[selfHostedGitHubURLStorageKey]: githubUrl,
151-
[selfHostedCodecovApiToken]: codecovApiToken,
152-
},
145+
await browser.storage.sync.set({
146+
[useSelfHostedStorageKey]: useSelfHosted,
147+
[selfHostedCodecovURLStorageKey]: codecovUrl,
148+
[selfHostedGitHubURLStorageKey]: githubUrl,
149+
[selfHostedCodecovApiToken]: codecovApiToken,
153150
});
154151

155152
resetEphemeralState();

src/types.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,4 @@ export enum MessageType {
4343
FETCH_COMPONENTS_LIST = "fetch_components_list",
4444
REGISTER_CONTENT_SCRIPTS = "register_content_scripts",
4545
UNREGISTER_CONTENT_SCRIPTS = "unregister_content_scripts",
46-
SET_STORAGE_VALUES = "set_storage_values",
4746
}

0 commit comments

Comments
 (0)