Skip to content

Commit 385f0e5

Browse files
committed
fix: Prevent crashes on multiple connects
1 parent c047f8c commit 385f0e5

1 file changed

Lines changed: 15 additions & 15 deletions

File tree

src/ext.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@ export async function activate(context: flashpoint.ExtensionContext) {
2121
}
2222

2323
const firstLaunch = !flashpoint.getExtConfigValue('com.analytics.setup-complete');
24-
const firstConnect = true;
24+
let firstConnect = true;
2525
flashpoint.onDidConnect(async () => {
2626
if (firstConnect) {
27+
firstConnect = false;
2728
// First Launch Prompts
2829
if (firstLaunch) {
2930
const trackingInfoHuman = [
@@ -126,21 +127,20 @@ export async function activate(context: flashpoint.ExtensionContext) {
126127
}
127128
}
128129
});
129-
}
130130

131-
// Wipe User Data
132-
registerSub(flashpoint.commands.registerCommand('com.analytics.deletion-request', async () => {
133-
await flashpoint.setExtConfigValue('com.analytics.basic', false);
134-
await flashpoint.setExtConfigValue('com.analytics.games', false);
135-
await flashpoint.setExtConfigValue('com.analytics.hardware', false);
136-
await flashpoint.setExtConfigValue('com.analytics.php-reporting', false);
137-
let userId = flashpoint.getExtConfigValue('com.analytics.user-id');
138-
const deletionFormUrl = `https://docs.google.com/forms/d/e/1FAIpQLScPeAKFmieGuHdu3FcyiSXqDdfcEFAfjIpM7nzlUsJbi9NYuw/viewform?entry.818267307=${userId}`;
139-
userId = uuid();
140-
await flashpoint.setExtConfigValue('com.analytics.user-id', userId);
141-
open(deletionFormUrl);
142-
}));
143-
131+
// Wipe User Data
132+
registerSub(flashpoint.commands.registerCommand('com.analytics.deletion-request', async () => {
133+
await flashpoint.setExtConfigValue('com.analytics.basic', false);
134+
await flashpoint.setExtConfigValue('com.analytics.games', false);
135+
await flashpoint.setExtConfigValue('com.analytics.hardware', false);
136+
await flashpoint.setExtConfigValue('com.analytics.php-reporting', false);
137+
let userId = flashpoint.getExtConfigValue('com.analytics.user-id');
138+
const deletionFormUrl = `https://docs.google.com/forms/d/e/1FAIpQLScPeAKFmieGuHdu3FcyiSXqDdfcEFAfjIpM7nzlUsJbi9NYuw/viewform?entry.818267307=${userId}`;
139+
userId = uuid();
140+
await flashpoint.setExtConfigValue('com.analytics.user-id', userId);
141+
open(deletionFormUrl);
142+
}));
143+
}
144144
}
145145
});
146146
}

0 commit comments

Comments
 (0)