feat: rework consent

This commit is contained in:
Lewis Crichton 2023-10-28 18:07:19 +01:00
parent 3de02708a6
commit 5d1736d020
No known key found for this signature in database
2 changed files with 23 additions and 20 deletions

View file

@ -62,7 +62,7 @@ export interface Settings {
settingsSyncVersion: number; settingsSyncVersion: number;
}; };
telemetry: boolean; telemetry?: boolean; // tri-state, undefined = ask
} }
const DefaultSettings: Settings = { const DefaultSettings: Settings = {
@ -95,7 +95,7 @@ const DefaultSettings: Settings = {
settingsSyncVersion: 0 settingsSyncVersion: 0
}, },
telemetry: true telemetry: undefined
}; };
try { try {

View file

@ -5,41 +5,44 @@
*/ */
import { Settings } from "@api/Settings"; import { Settings } from "@api/Settings";
import { Alerts, SettingsRouter } from "@webpack/common"; import { Alerts } from "@webpack/common";
import { isPluginEnabled } from "../plugins"; import { isPluginEnabled } from "../plugins";
import { Plugins } from "../Vencord"; import { Plugins } from "../Vencord";
import { isLinux, isMac, isWindows } from "./constants"; import { isLinux, isMac, isWindows } from "./constants";
import { localStorage } from "./localStorage";
export function sendTelemetry() { export function sendTelemetry() {
// TODO: READD THIS CHECK BEFORE RELEASING!! // TODO: READ THIS CHECK BEFORE RELEASING!!
// if (IS_DEV) return; // don't send on devbuilds, usually contains incorrect data // if (IS_DEV) return; // don't send on devbuilds, usually contains incorrect data
// if we have not yet told the user about the telemetry's existence, DON'T send // if we have not yet told the user about the telemetry's existence, or they haven't agreed at all, DON'T send a
// a probe now, but tell them and then let them decide if they want to opt in or // probe now, but tell them and then let them decide if they want to opt in or not.
// not. this only takes place the next time the mod starts. if (Settings.telemetry === undefined) {
if (!localStorage.getItem("Vencord_telemetryAcknowledged")) {
Alerts.show({ Alerts.show({
title: "Telemetry Notice", title: "Telemetry Notice",
body: <> body: <>
<p> <p>
Vencord has a telemetry feature that sends anonymous data to us, which we use to improve the mod. Vencord has a telemetry feature that sends anonymous data to us, which we use to improve the mod. We
gather your operating system, the version of Vencord you're using and a list of enabled plugins, and
we can use this data to help improve it for yourself and everyone else.
</p> </p>
<p> <p>
If you don't want this, that's okay! We haven't sent anything yet. You can disable this in the If you don't want this, that's okay! We haven't sent anything yet. Please decide if you want to allow
settings at any time, easily. If you choose to do nothing, we'll send some information the next time us to gather a little bit of data. You can change this setting at any time in the future. If you
you reload or restart Discord. grant consent, we will start sending the data above the next time you reload or restart Discord.
</p> </p>
</>, </>,
confirmText: "Okay", confirmText: "Yes, that's fine",
secondaryConfirmText: "Vencord Settings", cancelText: "No, I don't want that",
onConfirmSecondary() {
SettingsRouter.open("VencordSettings");
},
});
localStorage.setItem("Vencord_telemetryAcknowledged", "1"); onConfirm() {
Settings.telemetry = true;
},
onCancel() {
Settings.telemetry = false;
}
});
return; return;
} }