Skip to content

Commit eb4173c

Browse files
committed
feat: log app version on startup
1 parent c5e3761 commit eb4173c

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/App.tsx

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { useEffect, useState } from "react";
2+
import * as app from "@tauri-apps/api/app";
23
import * as log from "@tauri-apps/plugin-log";
34
import * as path from "@tauri-apps/api/path";
45
import { arch, platform } from "@tauri-apps/plugin-os";
@@ -42,6 +43,7 @@ function App() {
4243
const [networkId, setNetworkId] = useState("");
4344
const [dlProgress, setDlProgress] = useState(0);
4445
const [clientPid, setClientPid] = useState(0);
46+
const [appVersion, setAppVersion] = useState("");
4547
const [platformArch, setPlatformArch] = useState("");
4648
const [platformSupported, setPlatformSupported] = useState(false);
4749
const [networks, setNetworks] = useState<string[]>([]);
@@ -50,11 +52,14 @@ function App() {
5052
// run once on startup (twice in dev mode)
5153
useEffect(() => {
5254
try {
53-
log.info(`Platform: ${platform()}-${arch()}`);
54-
setPlatformArch(getPlatformArch());
55-
setPlatformSupported(true);
56-
5755
(async () => {
56+
const name = await app.getName();
57+
const v = "v" + (await app.getVersion());
58+
log.info(`Starting ${name} ${v} on ${platform()}-${arch()}`);
59+
60+
setAppVersion(v);
61+
setPlatformArch(getPlatformArch());
62+
setPlatformSupported(true);
5863
setNetworks(await getNetworks());
5964
})();
6065
} catch (error: any) {

0 commit comments

Comments
 (0)