From 4bbda8763435c411e1cdbb425feed0af7ef5f9dd Mon Sep 17 00:00:00 2001 From: Drew Weymouth Date: Tue, 7 Nov 2023 07:44:02 -0800 Subject: [PATCH] move donation link to top of whats new dialog --- res/metadata.go | 4 ++-- ui/dialogs/whatsnewdialog.go | 23 ++++++++++------------- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/res/metadata.go b/res/metadata.go index 2391d40..59468b5 100644 --- a/res/metadata.go +++ b/res/metadata.go @@ -25,7 +25,7 @@ func shortcutKey() string { var ( WhatsAdded = fmt.Sprintf(` -### Added +## Added * New "Quick search" feature to search entire library from anywhere (%s+G shortcut) * Support for loading WEBP images * UI Refresh from migrating to Fyne 2.4 @@ -33,7 +33,7 @@ var ( * Added playback setting to force-disable server transcoding`, shortcutKey()) WhatsFixed = ` -### Fixed +## Fixed * UI hang when playback slow to begin after clicking on grid view play buttons * Crash when removing from the currently playing track to end of play queue` ) diff --git a/ui/dialogs/whatsnewdialog.go b/ui/dialogs/whatsnewdialog.go index da53c63..76bf46e 100644 --- a/ui/dialogs/whatsnewdialog.go +++ b/ui/dialogs/whatsnewdialog.go @@ -1,13 +1,12 @@ package dialogs import ( - "net/url" + "fmt" "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 { @@ -20,8 +19,15 @@ func NewWhatsNewDialog() *WhatsNewDialog { return w } +const donationTextTemplate = `Thank you for using Supersonic! +If you're enjoying the app and want to [show your support](%s), +donations are always appreciated and help motivate me to continue +delivering new features and improvements!` + func (w *WhatsNewDialog) CreateRenderer() fyne.WidgetRenderer { - objects := container.NewVBox() + donationPrompt := widget.NewRichTextFromMarkdown(fmt.Sprintf(donationTextTemplate, res.KofiURL)) + donationPrompt.Wrapping = fyne.TextWrapWord + objects := container.NewVBox(donationPrompt) if res.WhatsAdded != "" { added := widget.NewRichTextFromMarkdown(res.WhatsAdded) added.Wrapping = fyne.TextWrapWord @@ -33,19 +39,10 @@ func (w *WhatsNewDialog) CreateRenderer() fyne.WidgetRenderer { 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) + return fyne.NewSize(425, 275) }