1
1
import { useEffect , useState } from "react" ;
2
+ import * as app from "@tauri-apps/api/app" ;
2
3
import * as log from "@tauri-apps/plugin-log" ;
3
4
import * as path from "@tauri-apps/api/path" ;
4
5
import { arch , platform } from "@tauri-apps/plugin-os" ;
@@ -42,6 +43,7 @@ function App() {
42
43
const [ networkId , setNetworkId ] = useState ( "" ) ;
43
44
const [ dlProgress , setDlProgress ] = useState ( 0 ) ;
44
45
const [ clientPid , setClientPid ] = useState ( 0 ) ;
46
+ const [ appVersion , setAppVersion ] = useState ( "" ) ;
45
47
const [ platformArch , setPlatformArch ] = useState ( "" ) ;
46
48
const [ platformSupported , setPlatformSupported ] = useState ( false ) ;
47
49
const [ networks , setNetworks ] = useState < string [ ] > ( [ ] ) ;
@@ -50,11 +52,14 @@ function App() {
50
52
// run once on startup (twice in dev mode)
51
53
useEffect ( ( ) => {
52
54
try {
53
- log . info ( `Platform: ${ platform ( ) } -${ arch ( ) } ` ) ;
54
- setPlatformArch ( getPlatformArch ( ) ) ;
55
- setPlatformSupported ( true ) ;
56
-
57
55
( 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 ) ;
58
63
setNetworks ( await getNetworks ( ) ) ;
59
64
} ) ( ) ;
60
65
} catch ( error : any ) {
0 commit comments