mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-11 05:06:51 +00:00
GODT-1978: Auto-updates
This commit is contained in:
@ -23,18 +23,37 @@ import (
|
||||
"github.com/ProtonMail/proton-bridge/v2/internal/updater"
|
||||
)
|
||||
|
||||
// UpdateLatest is published when the latest version of bridge is known.
|
||||
type UpdateLatest struct {
|
||||
eventBase
|
||||
|
||||
Version updater.VersionInfo
|
||||
}
|
||||
|
||||
func (event UpdateLatest) String() string {
|
||||
return fmt.Sprintf("UpdateLatest: Version: %s", event.Version.Version)
|
||||
}
|
||||
|
||||
// UpdateAvailable is published when an update is available.
|
||||
// If the update is compatible (can be installed automatically), Compatible is true.
|
||||
// If the update will be installed silently (without user interaction), Silent is true.
|
||||
type UpdateAvailable struct {
|
||||
eventBase
|
||||
|
||||
Version updater.VersionInfo
|
||||
|
||||
CanInstall bool
|
||||
// Compatible is true if the update can be installed automatically.
|
||||
Compatible bool
|
||||
|
||||
// Silent is true if the update will be installed silently.
|
||||
Silent bool
|
||||
}
|
||||
|
||||
func (event UpdateAvailable) String() string {
|
||||
return fmt.Sprintf("UpdateAvailable: Version %s, CanInstall %t", event.Version.Version, event.CanInstall)
|
||||
return fmt.Sprintf("UpdateAvailable: Version %s, Compatible: %t, Silent: %t", event.Version.Version, event.Compatible, event.Silent)
|
||||
}
|
||||
|
||||
// UpdateNotAvailable is published when no update is available.
|
||||
type UpdateNotAvailable struct {
|
||||
eventBase
|
||||
}
|
||||
@ -43,20 +62,54 @@ func (event UpdateNotAvailable) String() string {
|
||||
return "UpdateNotAvailable"
|
||||
}
|
||||
|
||||
// UpdateInstalling is published when bridge begins installing an update.
|
||||
type UpdateInstalling struct {
|
||||
eventBase
|
||||
|
||||
Version updater.VersionInfo
|
||||
|
||||
Silent bool
|
||||
}
|
||||
|
||||
func (event UpdateInstalling) String() string {
|
||||
return fmt.Sprintf("UpdateInstalling: Version %s, Silent: %t", event.Version.Version, event.Silent)
|
||||
}
|
||||
|
||||
// UpdateInstalled is published when an update has been installed.
|
||||
type UpdateInstalled struct {
|
||||
eventBase
|
||||
|
||||
Version updater.VersionInfo
|
||||
|
||||
Silent bool
|
||||
}
|
||||
|
||||
func (event UpdateInstalled) String() string {
|
||||
return fmt.Sprintf("UpdateInstalled: Version %s, Silent: %t", event.Version.Version, event.Silent)
|
||||
}
|
||||
|
||||
// UpdateFailed is published when an update fails to be installed.
|
||||
type UpdateFailed struct {
|
||||
eventBase
|
||||
|
||||
Version updater.VersionInfo
|
||||
|
||||
Silent bool
|
||||
|
||||
Error error
|
||||
}
|
||||
|
||||
func (event UpdateFailed) String() string {
|
||||
return fmt.Sprintf("UpdateFailed: Version %s, Silent: %t, Error: %s", event.Version.Version, event.Silent, event.Error)
|
||||
}
|
||||
|
||||
// UpdateForced is published when the bridge version is too old and must be updated.
|
||||
type UpdateForced struct {
|
||||
eventBase
|
||||
|
||||
Version updater.VersionInfo
|
||||
}
|
||||
|
||||
func (event UpdateInstalled) String() string {
|
||||
return fmt.Sprintf("UpdateInstalled: Version %s", event.Version.Version)
|
||||
}
|
||||
|
||||
type UpdateForced struct {
|
||||
eventBase
|
||||
}
|
||||
|
||||
func (event UpdateForced) String() string {
|
||||
return "UpdateForced"
|
||||
return fmt.Sprintf("UpdateForced: Version %s", event.Version.Version)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user