Skip to content

Commit 6afc0cc

Browse files
bealqiuclaude
andcommitted
fix(feedback): use dynamic app version and platform detection
The feedback form had hardcoded platform "macos" and version "1.2.1". Now uses getVersion() from Tauri API and detects platform from navigator.userAgent. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 202fe82 commit 6afc0cc

1 file changed

Lines changed: 20 additions & 10 deletions

File tree

packages/app/src/components/settings/FeedbackSettings.tsx

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import {
3636
import type { LucideIcon } from "lucide-react";
3737
import { useCallback, useEffect, useMemo, useState } from "react";
3838
import { useTranslation } from "react-i18next";
39+
import { getVersion } from "@tauri-apps/api/app";
3940

4041
const FEEDBACK_TYPES: {
4142
key: FeedbackType;
@@ -65,16 +66,25 @@ export function FeedbackSettings() {
6566
);
6667
const remaining = getRemainingSubmissions();
6768

68-
const deviceInfo: DeviceInfo = useMemo(
69-
() =>
70-
collectDeviceInfo({
71-
platform: "macos",
72-
osVersion: navigator.userAgent,
73-
appVersion: "1.2.1",
74-
locale: navigator.language,
75-
}),
76-
[],
77-
);
69+
const [appVersion, setAppVersion] = useState("...");
70+
useEffect(() => {
71+
getVersion().then(setAppVersion).catch(() => setAppVersion("unknown"));
72+
}, []);
73+
74+
const deviceInfo: DeviceInfo = useMemo(() => {
75+
const ua = navigator.userAgent.toLowerCase();
76+
const platform: DeviceInfo["platform"] = ua.includes("win")
77+
? "windows"
78+
: ua.includes("linux")
79+
? "linux"
80+
: "macos";
81+
return collectDeviceInfo({
82+
platform,
83+
osVersion: navigator.userAgent,
84+
appVersion,
85+
locale: navigator.language,
86+
});
87+
}, [appVersion]);
7888

7989
const loadRecords = useCallback(async (refreshStatus = false) => {
8090
const history = await getFeedbackHistory();

0 commit comments

Comments
 (0)