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

@ -261,6 +261,9 @@ Item {
winMain.tlsBarState="notOK"
}
onOpenReleaseNotesExternally: {
Qt.openUrlExternally(go.updateReleaseNotesLink)
}
}
@ -304,12 +307,14 @@ Item {
}
function openReleaseNotes(){
if go.updateReleaseNotesLink == "" {
go.checkForUpdates()
if (go.updateReleaseNotesLink == "") {
go.checkAndOpenReleaseNotes()
return
}
Qt.openUrlExternally(go.updateReleaseNotesLink)
go.openReleaseNotesExternally()
}
// On start
Component.onCompleted : {
// set messages for translations

View File

@ -292,6 +292,12 @@ Item {
onUpdateFinished : {
winMain.dialogUpdate.finished(hasError)
}
onOpenReleaseNotesExternally: {
Qt.openUrlExternally(go.updateReleaseNotesLink)
}
}
function folderIcon(folderName, folderType) { // translations
@ -406,10 +412,11 @@ Item {
*/
function openReleaseNotes(){
if go.updateReleaseNotesLink == "" {
go.checkForUpdates()
if (go.updateReleaseNotesLink == "") {
go.checkAndOpenReleaseNotes()
return
}
Qt.openUrlExternally(go.updateReleaseNotesLink)
go.openReleaseNotesExternally()
}

View File

@ -202,28 +202,28 @@ Window {
testroot.newVersion = false
break;
case "NotifyManualUpdate(CanInstall)" :
go.notifyManualUpdate()
go.updateCanInstall = true
break;
go.notifyManualUpdate()
go.updateCanInstall = true
break;
case "NotifyManualUpdate(CantInstall)" :
go.notifyManualUpdate()
go.updateCanInstall = false
break;
go.notifyManualUpdate()
go.updateCanInstall = false
break;
case "NotifyManualUpdateRestart":
go.notifyManualUpdateRestartNeeded()
break;
go.notifyManualUpdateRestartNeeded()
break;
case "NotifyManualUpdateError":
go.notifyManualUpdateError()
break;
go.notifyManualUpdateError()
break;
case "ForceUpdate" :
go.notifyForceUpdate()
break;
go.notifyForceUpdate()
break;
case "NotifySilentUpdateRestartNeeded" :
go.notifySilentUpdateRestartNeeded()
break;
go.notifySilentUpdateRestartNeeded()
break;
case "NotifySilentUpdateError" :
go.notifySilentUpdateError()
break;
go.notifySilentUpdateError()
break;
case "SendAlertPopup" :
go.showOutgoingNoEncPopup("Alert sending unencrypted!")
break;
@ -299,7 +299,7 @@ Window {
property string updateVersion : "QA.1.0"
property bool updateCanInstall: true
property string updateLandingPage : "https://protonmail.com/bridge/download/"
property string updateReleaseNotesLink : "https://protonmail.com/download/bridge/release_notes.html"
property string updateReleaseNotesLink : "" // "https://protonmail.com/download/bridge/release_notes.html"
signal notifyManualUpdate()
signal notifyManualUpdateRestartNeeded()
signal notifyManualUpdateError()
@ -312,6 +312,11 @@ Window {
function startManualUpdate() {
console.log("startManualUpdate")
}
function checkAndOpenReleaseNotes() {
console.log("check for release notes")
go.updateReleaseNotesLink = "https://protonmail.com/download/bridge/release_notes.html"
go.openReleaseNotesExternally()
}
property string credits : "here;goes;list;;of;;used;packages;"
@ -349,6 +354,7 @@ Window {
signal notifyAddressChangedLogout(string accname)
signal failedAutostartCode(string code)
signal openReleaseNotesExternally()
signal showCertIssue()
signal updateFinished(bool hasError)

View File

@ -167,28 +167,28 @@ Window {
go.goos = "linux";
break;
case "NotifyManualUpdate(CanInstall)" :
go.notifyManualUpdate()
go.updateCanInstall = true
break;
go.notifyManualUpdate()
go.updateCanInstall = true
break;
case "NotifyManualUpdate(CantInstall)" :
go.notifyManualUpdate()
go.updateCanInstall = false
break;
go.notifyManualUpdate()
go.updateCanInstall = false
break;
case "NotifyManualUpdateRestart":
go.notifyManualUpdateRestartNeeded()
break;
go.notifyManualUpdateRestartNeeded()
break;
case "NotifyManualUpdateError":
go.notifyManualUpdateError()
break;
go.notifyManualUpdateError()
break;
case "ForceUpdate" :
go.notifyForceUpdate()
break;
go.notifyForceUpdate()
break;
case "NotifySilentUpdateRestartNeeded" :
go.notifySilentUpdateRestartNeeded()
break;
go.notifySilentUpdateRestartNeeded()
break;
case "NotifySilentUpdateError" :
go.notifySilentUpdateError()
break;
go.notifySilentUpdateError()
break;
case "ImportStructure" :
testgui.winMain.dialogImport.address = "cuto@pm.com"
testgui.winMain.dialogImport.show()
@ -872,6 +872,11 @@ Window {
function startManualUpdate() {
console.log("startManualUpdate")
}
function checkAndOpenReleaseNotes() {
console.log("check for release notes")
go.updateReleaseNotesLink = "https://protonmail.com/download/import-export/release_notes.html"
go.openReleaseNotesExternally()
}
property real progress: 0.0
property int progressFails: 0
@ -912,6 +917,8 @@ Window {
signal notifyUpdate()
signal updateFinished(bool hasError)
signal openReleaseNotesExternally()
signal notifyLogout(string accname)
signal notifyError(int errCode)

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()

View File

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

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.