func()

in app.go [222:259]


func (b *App) CheckForUpdates() bool {
	updateAvailable, version, releaseNotes := update.CheckForUpdate(Version)
	if updateAvailable {
		log.Printf("Update to version %s available. ", version)
		message := "Version " + version + " is available\n\n Release notes:\n" + releaseNotes
		dialog, _ := wailsruntime.MessageDialog(b.ctx, wailsruntime.MessageDialogOptions{
			Type:          "QuestionDialog",
			Title:         "Update available",
			Message:       message,
			Buttons:       []string{"Update", "Cancel"},
			DefaultButton: "Update",
			CancelButton:  "Cancel",
		})
		if dialog == "Update" {
			var updated bool
			if runtime.GOOS == "darwin" {
				updated = update.DoSelfUpdateMac()
			} else {
				updated = update.DoSelfUpdate(Version)
			}
			if updated {
				wailsruntime.MessageDialog(b.ctx, wailsruntime.MessageDialogOptions{
					"InfoDialog",
					"Update installed",
					"Update " + version + " is installed. Please restart the program to apply changes.",
					[]string{"Ok", "Cancel"},
					"OK",
					"Cancel",
					nil,
				})
			}
		}
		return true
	} else {
		log.Printf("Version %s is the latest", Version)
		return false
	}
}