wait for release notes check and then open externally

This commit is contained in:
Jakub
2021-01-19 16:30:50 +01:00
committed by Jakub Cuth
parent a72f52a5ed
commit a5b9f4c3f1
8 changed files with 139 additions and 92 deletions

View File

@ -414,35 +414,44 @@ func (s *FrontendQt) openLogs() {
go open.Run(logsPath)
}
func (s *FrontendQt) checkForUpdates() {
func (s *FrontendQt) checkForUpdatesAndWait() {
version, err := s.updater.Check()
if err != nil {
logrus.WithError(err).Error("An error occurred while checking updates manually")
s.Qml.NotifyManualUpdateError()
return
}
s.SetVersion(version)
if !s.updater.IsUpdateApplicable(version) {
logrus.Debug("No need to update")
return
}
logrus.WithField("version", version.Version).Info("An update is available")
if !s.updater.CanInstall(version) {
logrus.Debug("A manual update is required")
s.NotifyManualUpdate(version, false)
return
}
s.NotifyManualUpdate(version, true)
}
func (s *FrontendQt) checkAndOpenReleaseNotes() {
go func() {
version, err := s.updater.Check()
if err != nil {
logrus.WithError(err).Error("An error occurred while checking updates manually")
s.Qml.NotifyManualUpdateError()
return
}
s.SetVersion(version)
if !s.updater.IsUpdateApplicable(version) {
logrus.Debug("No need to update")
return
}
logrus.WithField("version", version.Version).Info("An update is available")
if !s.updater.CanInstall(version) {
logrus.Debug("A manual update is required")
s.NotifyManualUpdate(version, false)
return
}
s.NotifyManualUpdate(version, true)
s.checkForUpdatesAndWait()
s.Qml.OpenReleaseNotesExternally()
}()
}
func (s *FrontendQt) checkForUpdates() {
go s.checkForUpdatesAndWait()
}
func (s *FrontendQt) openLicenseFile() {
go open.Run(s.locations.GetLicenseFilePath())
}

View File

@ -61,6 +61,8 @@ type GoQMLInterface struct {
_ func() `signal:"notifySilentUpdateRestartNeeded"`
_ func() `signal:"notifySilentUpdateError"`
_ func() `slot:"checkForUpdates"`
_ func() `slot:"checkAndOpenReleaseNotes"`
_ func() `signal:"openReleaseNotesExternally"`
_ func() `slot:"startManualUpdate"`
// Translations.