show What's New dialog when launching updated version

This commit is contained in:
Drew Weymouth
2023-11-06 17:59:35 -08:00
parent 7e8f0328ff
commit b83387e29c
7 changed files with 121 additions and 15 deletions
+2 -2
View File
@@ -66,8 +66,8 @@ func (a *AboutDialog) buildMainTabContainer(version string) *fyne.Container {
ts := license.Segments[0].(*widget.TextSegment)
ts.Style.TextStyle.Bold = true
ts.Style.Alignment = fyne.TextAlignCenter
ghUrl, _ := url.Parse("https://github.com/dweymouth/supersonic")
kofiUrl, _ := url.Parse("https://ko-fi.com/dweymouth")
ghUrl, _ := url.Parse(res.GithubURL)
kofiUrl, _ := url.Parse(res.KofiURL)
githubKofi := container.NewCenter(
container.New(&layouts.HboxCustomPadding{DisableThemePad: true, ExtraPad: -10},
widget.NewHyperlink("Github page", ghUrl),
+51
View File
@@ -0,0 +1,51 @@
package dialogs
import (
"net/url"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/widget"
"github.com/dweymouth/supersonic/res"
"github.com/dweymouth/supersonic/ui/layouts"
)
type WhatsNewDialog struct {
widget.BaseWidget
}
func NewWhatsNewDialog() *WhatsNewDialog {
w := &WhatsNewDialog{}
w.ExtendBaseWidget(w)
return w
}
func (w *WhatsNewDialog) CreateRenderer() fyne.WidgetRenderer {
objects := container.NewVBox()
if res.WhatsAdded != "" {
added := widget.NewRichTextFromMarkdown(res.WhatsAdded)
added.Wrapping = fyne.TextWrapWord
objects.Add(added)
}
if res.WhatsFixed != "" {
fixed := widget.NewRichTextFromMarkdown(res.WhatsFixed)
fixed.Wrapping = fyne.TextWrapWord
objects.Add(fixed)
}
ghUrl, _ := url.Parse(res.GithubURL)
kofiUrl, _ := url.Parse(res.KofiURL)
githubKofi := container.NewCenter(
container.New(&layouts.HboxCustomPadding{DisableThemePad: true, ExtraPad: -10},
widget.NewHyperlink("Github page", ghUrl),
widget.NewLabel("·"),
widget.NewHyperlink("Support the project", kofiUrl)))
objects.Add(githubKofi)
c := container.NewVScroll(objects)
return widget.NewSimpleRenderer(c)
}
func (w *WhatsNewDialog) MinSize() fyne.Size {
return fyne.NewSize(400, 250)
}