mirror of
https://github.com/AynaLivePlayer/AynaLivePlayer.git
synced 2025-12-13 21:48:30 +08:00
add updater
This commit is contained in:
31
gui/updater.go
Normal file
31
gui/updater.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package gui
|
||||
|
||||
import (
|
||||
"AynaLivePlayer/core/events"
|
||||
"AynaLivePlayer/global"
|
||||
"AynaLivePlayer/pkg/event"
|
||||
"AynaLivePlayer/pkg/i18n"
|
||||
"fyne.io/fyne/v2/dialog"
|
||||
"fyne.io/fyne/v2/widget"
|
||||
)
|
||||
|
||||
func checkUpdate() {
|
||||
global.EventManager.RegisterA(
|
||||
events.CheckUpdateResultUpdate, "gui.updater.check_update", func(event *event.Event) {
|
||||
data := event.Data.(events.CheckUpdateResultUpdateEvent)
|
||||
msg := data.Info.Version.String() + "\n\n\n" + data.Info.Info
|
||||
if data.HasUpdate {
|
||||
dialog.ShowCustom(
|
||||
i18n.T("gui.update.new_version"),
|
||||
"OK",
|
||||
widget.NewRichTextFromMarkdown(msg),
|
||||
MainWindow)
|
||||
} else {
|
||||
dialog.ShowCustom(
|
||||
i18n.T("gui.update.already_latest_version"),
|
||||
"OK",
|
||||
widget.NewRichTextFromMarkdown(""),
|
||||
MainWindow)
|
||||
}
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user