fyneselfupdate

package module
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 13, 2024 License: BSD-3-Clause Imports: 10 Imported by: 2

README

Fyne Selfupdate

godoc reference Coverage Status

An extension of the selfupdate repository that handles certain Fyne integrations.

Simple setup for Fyne application

If you want to add self update support to your Fyne application, you can just just add the following code

	// Used `selfupdatectl create-keys` followed by `selfupdatectl print-key`
	publicKey := ed25519.PublicKey{178, 103, 83, 57, 61, 138, 18, 249, 244, 80, 163, 162, 24, 251, 190, 241, 11, 168, 179, 41, 245, 27, 166, 70, 220, 254, 118, 169, 101, 26, 199, 129}

	// The public key above match the signature of the below file served by our CDN
	httpSource := selfupdate.NewHTTPSource(nil, "http://localhost/myprogram-{{.OS}}-{{.Arch}}{{.Ext}}")

	config := fyneselfupdate.NewConfigWithTimeout(a, w, time.Duration(1)*time.Minute,
		httpSource,
		selfupdate.Schedule{FetchOnStart: true, Interval: time.Hour * time.Duration(12)},
		publicKey)

	_, err := selfupdate.Manage(config)
	if err != nil {
		log.Println("Error while setting up update manager: ", err)
		return
	}

For a better understanding of how to use selfupdatectl to help you manage your self updating Fyne application deployment you can read the documentation here

Callbacks

You can also use following callbacks and directly create your custom selfupdate.Config structure to adapt presented graphical element to your exact need in your Fyne app.

func NewUpgradeConfirmCallback(fyne.Window)

func NewUpgradeConfirmCallbackWithTimeout(fyne.Window, time.Duration)

func NewRestartConfirmCallback(win fyne.Window)

func NewRestartConfirmCallbackWithTimeout(win fyne.Window, timeout time.Duration)

func NewProgressCallback(win fyne.Window)

func NewExitCallback(app fyne.App, win fyne.Window)

API Compatibility Promises

The main branch of fyneselfupdate is not guaranteed to have a stable API over time. Still we will try hard to not break its API unecessarily and will follow a proper versioning of our release. We will also keep it in sync and up to date with fynelabs/selfupate.

The fyneselfupdate package makes the following promises about API compatibility:

  1. A list of all API-breaking changes will be documented in this README.
  2. fyneselfupdate will strive for as few API-breaking changes as possible.

License

BSD 3-Clause

Sponsors

This project is kindly sponsored by the following companies:

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewConfig

func NewConfig(app fyne.App, win fyne.Window, source selfupdate.Source, schedule selfupdate.Schedule, publicKey ed25519.PublicKey) *selfupdate.Config

NewConfig create a selfupdate.Config structure that provide Fyne UI dialog to progress the update

func NewConfigWithTimeout

func NewConfigWithTimeout(app fyne.App, win fyne.Window, timeout time.Duration, source selfupdate.Source, schedule selfupdate.Schedule, publicKey ed25519.PublicKey) *selfupdate.Config

NewConfigWithTimeout create a selfupdate.Config structure that provide Fyne UI dialog to progress the update and provide a "default to yes" behavior if the user doesn't interact within timeout time to provide unattended update.

func NewExitCallback

func NewExitCallback(app fyne.App, win fyne.Window) func(err error)

NewExitCallback properly exit a Fyne App. If a window is specified, it will report error using dialog.ShowError if the upgrade failed to Restart. If no window is specified, it will display error on the command line.

func NewProgressCallback

func NewProgressCallback(win fyne.Window) func(float64, error)

NewProgressCallback returns a callback that can be used to present download information during update.

func NewRestartConfirmCallback

func NewRestartConfirmCallback(win fyne.Window) func() bool

NewRestartConfirmCallback create a GUI based confirmation to approve restarting the application after being updated

func NewRestartConfirmCallbackWithTimeout

func NewRestartConfirmCallbackWithTimeout(win fyne.Window, timeout time.Duration) func() bool

NewRestartConfirmCallbackWithTimeout creates a GUI based restarting confirmation callback with a timeout, after which time the question will be confirmed to yes. This can assist in a "default to yes" update where computer may be unattended.

func NewUpgradeConfirmCallback

func NewUpgradeConfirmCallback(win fyne.Window) func(string) bool

NewUpgradeConfirmCallback creates a GUI based confirmation to use as selfupdate callback

func NewUpgradeConfirmCallbackWithTimeout

func NewUpgradeConfirmCallbackWithTimeout(win fyne.Window, timeout time.Duration) func(string) bool

NewUpgradeConfirmCallbackWithTimeout creates a GUI based confirmation callback with a timeout, after which time the question will be confirmed. This can assist in a "default to yes" update where computer may be unattended.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL