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

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