Skip to content

Commit 0a2a050

Browse files
authored
Merge pull request #127 from tosdr/openSettings
Stop auto-opening settings on browser update
2 parents 0be8840 + 158bfd2 commit 0a2a050

File tree

6 files changed

+9
-9
lines changed

6 files changed

+9
-9
lines changed

src/manifest-ff.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"manifest_version": 3,
33
"name": "__MSG_extensionName__",
44
"description": "__MSG_extensionDescription__",
5-
"version": "6.0.0",
5+
"version": "6.0.1",
66
"homepage_url": "https://tosdr.org",
77
"permissions": ["tabs", "storage"],
88
"background": {

src/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"manifest_version": 3,
33
"name": "__MSG_extensionName__",
44
"description": "__MSG_extensionDescription__",
5-
"version": "6.0.0",
5+
"version": "6.0.1",
66
"homepage_url": "https://tosdr.org",
77
"permissions": ["tabs", "storage"],
88
"background": {

src/scripts/background.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ chrome.tabs.onActivated.addListener((activeInfo) => {
2121
});
2222
});
2323

24-
chrome.runtime.onInstalled.addListener(() => {
25-
void handleExtensionInstalled();
24+
chrome.runtime.onInstalled.addListener((reason) => {
25+
void handleExtensionInstalled(reason);
2626
});
2727

2828
chrome.runtime.onStartup.addListener(() => {

src/scripts/background/database.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export async function downloadDatabase(apiUrl?: string): Promise<void> {
3535
}
3636
}
3737

38-
export async function checkIfUpdateNeeded(firstStart = false): Promise<void> {
38+
export async function checkIfUpdateNeeded(firstStart = false, addonInstallReason?:chrome.runtime.InstalledDetails): Promise<void> {
3939
const data = await getLocal([
4040
'db',
4141
'lastModified',
@@ -62,7 +62,7 @@ export async function checkIfUpdateNeeded(firstStart = false): Promise<void> {
6262

6363
await downloadDatabase(api);
6464

65-
if (firstStart) {
65+
if (firstStart && addonInstallReason && ["update", "install"].includes(addonInstallReason?.reason)) {
6666
chrome.runtime.openOptionsPage();
6767
}
6868
}

src/scripts/background/install.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { checkIfUpdateNeeded } from './database';
33
import { donationReminderAllowed } from './donation';
44
import { initializePageAction } from './pageAction';
55

6-
export async function handleExtensionInstalled(): Promise<void> {
6+
export async function handleExtensionInstalled(reason:chrome.runtime.InstalledDetails): Promise<void> {
77
const donationAllowed = donationReminderAllowed(navigator.userAgent);
88

99
await setLocal({
@@ -15,7 +15,7 @@ export async function handleExtensionInstalled(): Promise<void> {
1515
},
1616
});
1717

18-
await checkIfUpdateNeeded(true);
18+
await checkIfUpdateNeeded(true, reason);
1919

2020
const [activeTab] = await queryActiveTab();
2121
if (activeTab) {

src/views/popup.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ <h3 style="display: none">
105105
<a>
106106
<button id="toggleButton">Toggle Darkmode</button> -
107107
<button id="settingsButton">Settings</button> -
108-
<button id="sourceButton">Source Code</button> - v6.0.0
108+
<button id="sourceButton">Source Code</button> - v6.0.1
109109
</a>
110110
<p id="translationWarning" class="translationWarning" style="display: none">
111111
Translations are machine translated. You can turn them off in Settings by choosing English.

0 commit comments

Comments
 (0)