@@ -2,6 +2,7 @@ package ui
22
33import (
44 "net/url"
5+ "runtime/debug"
56
67 "fyne.io/fyne/v2"
78 "fyne.io/fyne/v2/container"
@@ -13,16 +14,20 @@ import (
1314)
1415
1516func newAboutTab (app fyne.App ) * container.TabItem {
16- const version = "v3.9.2"
17-
1817 repoURL := util .URLToGitHubProject ("" )
1918 icon := newClickableIcon (app .Icon (), repoURL , app )
2019
2120 nameLabel := newBoldLabel ("Rymdport" )
2221 spacerLabel := newBoldLabel ("-" )
2322
24- releaseURL := util .URLToGitHubProject ("/releases/tag/" + version )
25- hyperlink := & widget.Hyperlink {Text : version , URL : releaseURL , TextStyle : fyne.TextStyle {Bold : true }}
23+ var hyperlink fyne.CanvasObject
24+ version := getVersion (app )
25+ if version [0 ] == 'v' {
26+ releaseURL := util .URLToGitHubProject ("/releases/tag/" + version )
27+ hyperlink = & widget.Hyperlink {Text : version , URL : releaseURL , TextStyle : fyne.TextStyle {Bold : true }}
28+ } else {
29+ hyperlink = & widget.Label {Text : version , TextStyle : fyne.TextStyle {Bold : true }}
30+ }
2631
2732 spacer := & layout.Spacer {}
2833 content := container .NewVBox (
@@ -69,3 +74,11 @@ func (c *clickableIcon) MinSize() fyne.Size {
6974func newClickableIcon (res fyne.Resource , url * url.URL , app fyne.App ) * clickableIcon {
7075 return & clickableIcon {Icon : widget.Icon {Resource : res }, app : app , url : url }
7176}
77+
78+ func getVersion (app fyne.App ) string {
79+ info , ok := debug .ReadBuildInfo ()
80+ if ! ok {
81+ return app .Metadata ().Version
82+ }
83+ return info .Main .Version
84+ }
0 commit comments