From d67d58824b0a25a92b92627ab15d0b1393ef6663 Mon Sep 17 00:00:00 2001 From: HorizonCode Date: Sun, 7 Dec 2025 00:46:33 +0100 Subject: [PATCH] feat: implement app tracking consent dialog and update tracking state management --- src-tauri/tauri.conf.json | 2 +- src/lib/config.ts | 5 +++ src/lib/global.ts | 2 + src/routes/+layout.svelte | 5 +++ src/screens/Launch.svelte | 84 +++++++++++++++++++++++++++++++++++++++ 5 files changed, 97 insertions(+), 1 deletion(-) diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index fd200be..9988d68 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -15,7 +15,7 @@ { "title": "EZPPLauncher", "width": 1000, - "height": 700, + "height": 737, "decorations": false, "resizable": false, "maximizable": false diff --git a/src/lib/config.ts b/src/lib/config.ts index 9af522d..0bdabb1 100644 --- a/src/lib/config.ts +++ b/src/lib/config.ts @@ -65,10 +65,15 @@ export class Config { } value(key: string) { + console.log('Accessing config key:', key, this.config[key]); return { set: (val: T) => { this.config[key] = val; }, + exists: () => { + console.log('Checking existence of key:', key, this.config[key] !== undefined); + return this.config[key] !== undefined; + }, get: (fallback: T): T => { return (this.config[key] as T) ?? fallback; }, diff --git a/src/lib/global.ts b/src/lib/global.ts index 888e219..38b06e5 100644 --- a/src/lib/global.ts +++ b/src/lib/global.ts @@ -14,6 +14,8 @@ export const newVersion = writable(undefined); export const launcherStreams = writable(['stable']); export const launcherStream = writable('stable'); +export const trackingEnabled = writable(false); + export const discordPresence = writable(false); export const presenceLoading = writable(false); diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index dbb4c53..b2aa0c6 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -12,6 +12,7 @@ platform, presenceLoading, setupValues, + trackingEnabled, } from '@/global'; import { onMount } from 'svelte'; import OsuCursor from '@/components/ui/osu-cursor/OsuCursor.svelte'; @@ -103,6 +104,7 @@ const config_reduce_animations = $userSettings.value('reduce_animations'); const config_osu_installation_path = $userSettings.value('osu_installation_path'); const config_discord_presence = $userSettings.value('discord_presence'); + const config_tracking_enabled = $userSettings.value('tracking_consent'); patch.set(config_patching.get(true)); customCursor.set(config_custom_cursor.get(true)); @@ -110,6 +112,9 @@ reduceAnimations.set(config_reduce_animations.get(false)); osuInstallationPath.set(config_osu_installation_path.get('')); discordPresence.set(config_discord_presence.get(true)); + if (config_tracking_enabled.exists()) { + trackingEnabled.set(config_tracking_enabled.get(false)); + } patch.subscribe((val) => config_patching.set(val)); customCursor.subscribe((val) => config_custom_cursor.set(val)); diff --git a/src/screens/Launch.svelte b/src/screens/Launch.svelte index c23ea69..e7352ca 100644 --- a/src/screens/Launch.svelte +++ b/src/screens/Launch.svelte @@ -21,6 +21,7 @@ serverConnectionFails, serverPing, skins, + trackingEnabled, } from '@/global'; import { LoaderCircle, @@ -111,6 +112,7 @@ import { EZPPActionStatus } from '@/types'; import * as presence from '@/presence'; import { expoOut } from 'svelte/easing'; + import { onMount } from 'svelte'; const tabs = [ { name: 'Home', key: 'home', show: true }, @@ -129,6 +131,8 @@ let launchInfo = $state(''); let launchError = $state(undefined); + let askForTrackingPermission = $state(false); + let downloadingUpdate = $state(false); let selectedGamemode = $derived( @@ -535,6 +539,16 @@ umami.track('app_launch_fail', { error: err }); } }; + + onMount(() => { + const config = $userSettings; + const trackingConsent = config.value('tracking_consent'); + if (trackingConsent.exists()) { + trackingEnabled.set(trackingConsent.get(false)); + } else { + askForTrackingPermission = true; + } + }); @@ -639,6 +653,59 @@ + + +
+ logo + App Tracking Consent +
+ +
+

+ We value your privacy. To enhance your experience and improve our services, we would like to + collect anonymous usage data. This data helps us understand how the application is used and + identify areas for improvement. +

+

+ No personal information is collected, and all data is anonymized. You can choose to enable + or disable this tracking at any time in the application settings. +

+

+ Do you consent to the collection of anonymous usage data to help us improve the application? +

+
+
+ + +
+
+
+ + +
+ +
+ Allow anonymous usage data to be collected to help improve the application. +
+
+ { + trackingEnabled.set(e); + $userSettings.value('tracking_consent').set(e); + await $userSettings.save(); + }} + class="flex items-center justify-center w-5 h-5" + >