Added versions numbers and display on titlebar
This commit is contained in:
		
							
								
								
									
										8
									
								
								app.go
									
									
									
									
									
								
							
							
						
						
									
										8
									
								
								app.go
									
									
									
									
									
								
							@@ -2,11 +2,17 @@ package main
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"context"
 | 
			
		||||
	_ "embed"
 | 
			
		||||
	"github.com/wailsapp/wails/v2/pkg/options"
 | 
			
		||||
	"github.com/wailsapp/wails/v2/pkg/runtime"
 | 
			
		||||
	"strings"
 | 
			
		||||
 | 
			
		||||
	"github.com/tidwall/gjson"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
//go:embed wails.json
 | 
			
		||||
var wailsJSON string
 | 
			
		||||
 | 
			
		||||
var wailsContext *context.Context
 | 
			
		||||
 | 
			
		||||
// App struct
 | 
			
		||||
@@ -22,7 +28,9 @@ func NewApp() *App {
 | 
			
		||||
// startup is called when the app starts. The context is saved
 | 
			
		||||
// so we can call the runtime methods
 | 
			
		||||
func (a *App) startup(ctx context.Context) {
 | 
			
		||||
	version := gjson.Get(wailsJSON, "info.productVersion")
 | 
			
		||||
	wailsContext = &ctx
 | 
			
		||||
	runtime.WindowSetTitle(ctx, "AniTrack "+version.String())
 | 
			
		||||
	//runtime.WindowMaximise(ctx)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										5
									
								
								go.mod
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								go.mod
									
									
									
									
									
								
							@@ -6,6 +6,7 @@ toolchain go1.21.11
 | 
			
		||||
 | 
			
		||||
require (
 | 
			
		||||
	github.com/99designs/keyring v1.2.2
 | 
			
		||||
	github.com/tidwall/gjson v1.17.3
 | 
			
		||||
	github.com/wailsapp/wails/v2 v2.9.1
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
@@ -33,10 +34,12 @@ require (
 | 
			
		||||
	github.com/pkg/errors v0.9.1 // indirect
 | 
			
		||||
	github.com/rivo/uniseg v0.4.7 // indirect
 | 
			
		||||
	github.com/samber/lo v1.47.0 // indirect
 | 
			
		||||
	github.com/tidwall/match v1.1.1 // indirect
 | 
			
		||||
	github.com/tidwall/pretty v1.2.0 // indirect
 | 
			
		||||
	github.com/tkrajina/go-reflector v0.5.6 // indirect
 | 
			
		||||
	github.com/valyala/bytebufferpool v1.0.0 // indirect
 | 
			
		||||
	github.com/valyala/fasttemplate v1.2.2 // indirect
 | 
			
		||||
	github.com/wailsapp/go-webview2 v1.0.13 // indirect
 | 
			
		||||
	github.com/wailsapp/go-webview2 v1.0.16 // indirect
 | 
			
		||||
	github.com/wailsapp/mimetype v1.4.1 // indirect
 | 
			
		||||
	golang.org/x/crypto v0.26.0 // indirect
 | 
			
		||||
	golang.org/x/net v0.28.0 // indirect
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										10
									
								
								go.sum
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								go.sum
									
									
									
									
									
								
							@@ -66,14 +66,20 @@ github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY=
 | 
			
		||||
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
 | 
			
		||||
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
 | 
			
		||||
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
 | 
			
		||||
github.com/tidwall/gjson v1.17.3 h1:bwWLZU7icoKRG+C+0PNwIKC6FCJO/Q3p2pZvuP0jN94=
 | 
			
		||||
github.com/tidwall/gjson v1.17.3/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
 | 
			
		||||
github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA=
 | 
			
		||||
github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
 | 
			
		||||
github.com/tidwall/pretty v1.2.0 h1:RWIZEg2iJ8/g6fDDYzMpobmaoGh5OLl4AXtGUGPcqCs=
 | 
			
		||||
github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
 | 
			
		||||
github.com/tkrajina/go-reflector v0.5.6 h1:hKQ0gyocG7vgMD2M3dRlYN6WBBOmdoOzJ6njQSepKdE=
 | 
			
		||||
github.com/tkrajina/go-reflector v0.5.6/go.mod h1:ECbqLgccecY5kPmPmXg1MrHW585yMcDkVl6IvJe64T4=
 | 
			
		||||
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
 | 
			
		||||
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
 | 
			
		||||
github.com/valyala/fasttemplate v1.2.2 h1:lxLXG0uE3Qnshl9QyaK6XJxMXlQZELvChBOCmQD0Loo=
 | 
			
		||||
github.com/valyala/fasttemplate v1.2.2/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
 | 
			
		||||
github.com/wailsapp/go-webview2 v1.0.13 h1:I17/44xQ5/SujBaAUS4KMkWJYIoWCp35YxCEFWsMLKA=
 | 
			
		||||
github.com/wailsapp/go-webview2 v1.0.13/go.mod h1:Uk2BePfCRzttBBjFrBmqKGJd41P6QIHeV9kTgIeOZNo=
 | 
			
		||||
github.com/wailsapp/go-webview2 v1.0.16 h1:wffnvnkkLvhRex/aOrA3R7FP7rkvOqL/bir1br7BekU=
 | 
			
		||||
github.com/wailsapp/go-webview2 v1.0.16/go.mod h1:Uk2BePfCRzttBBjFrBmqKGJd41P6QIHeV9kTgIeOZNo=
 | 
			
		||||
github.com/wailsapp/mimetype v1.4.1 h1:pQN9ycO7uo4vsUUuPeHEYoUkLVkaRntMnHJxVwYhwHs=
 | 
			
		||||
github.com/wailsapp/mimetype v1.4.1/go.mod h1:9aV5k31bBOv5z6u+QP8TltzvNGJPmNJD4XlAL3U+j3o=
 | 
			
		||||
github.com/wailsapp/wails/v2 v2.9.1 h1:irsXnoQrCpeKzKTYZ2SUVlRRyeMR6I0vCO9Q1cvlEdc=
 | 
			
		||||
 
 | 
			
		||||
@@ -9,5 +9,9 @@
 | 
			
		||||
  "author": {
 | 
			
		||||
    "name": "John O'Keefe",
 | 
			
		||||
    "email": "jokeefe@fastmail.com"
 | 
			
		||||
  },
 | 
			
		||||
  "info": {
 | 
			
		||||
    "productName": "AniTrack",
 | 
			
		||||
    "productVersion": "0.1.0"
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user