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

View File

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

View File

@ -202,28 +202,28 @@ Window {
testroot.newVersion = false testroot.newVersion = false
break; break;
case "NotifyManualUpdate(CanInstall)" : case "NotifyManualUpdate(CanInstall)" :
go.notifyManualUpdate() go.notifyManualUpdate()
go.updateCanInstall = true go.updateCanInstall = true
break; break;
case "NotifyManualUpdate(CantInstall)" : case "NotifyManualUpdate(CantInstall)" :
go.notifyManualUpdate() go.notifyManualUpdate()
go.updateCanInstall = false go.updateCanInstall = false
break; break;
case "NotifyManualUpdateRestart": case "NotifyManualUpdateRestart":
go.notifyManualUpdateRestartNeeded() go.notifyManualUpdateRestartNeeded()
break; break;
case "NotifyManualUpdateError": case "NotifyManualUpdateError":
go.notifyManualUpdateError() go.notifyManualUpdateError()
break; break;
case "ForceUpdate" : case "ForceUpdate" :
go.notifyForceUpdate() go.notifyForceUpdate()
break; break;
case "NotifySilentUpdateRestartNeeded" : case "NotifySilentUpdateRestartNeeded" :
go.notifySilentUpdateRestartNeeded() go.notifySilentUpdateRestartNeeded()
break; break;
case "NotifySilentUpdateError" : case "NotifySilentUpdateError" :
go.notifySilentUpdateError() go.notifySilentUpdateError()
break; break;
case "SendAlertPopup" : case "SendAlertPopup" :
go.showOutgoingNoEncPopup("Alert sending unencrypted!") go.showOutgoingNoEncPopup("Alert sending unencrypted!")
break; break;
@ -295,11 +295,11 @@ Window {
property string programTitle : "ProtonMail Bridge" property string programTitle : "ProtonMail Bridge"
property string fullversion : "QA.1.0 (d9f8sdf9) 2020-02-19T10:57:23+01:00" property string fullversion : "QA.1.0 (d9f8sdf9) 2020-02-19T10:57:23+01:00"
property string downloadLink: "https://protonmail.com/download/beta/protonmail-bridge-1.1.5-1.x86_64.rpm;https://www.protonmail.com/downloads/beta/Desktop-Bridge-link1.exe;https://www.protonmail.com/downloads/beta/Desktop-Bridge-link1.exe;https://www.protonmail.com/downloads/beta/Desktop-Bridge-link1.exe;" property string downloadLink: "https://protonmail.com/download/beta/protonmail-bridge-1.1.5-1.x86_64.rpm;https://www.protonmail.com/downloads/beta/Desktop-Bridge-link1.exe;https://www.protonmail.com/downloads/beta/Desktop-Bridge-link1.exe;https://www.protonmail.com/downloads/beta/Desktop-Bridge-link1.exe;"
property string updateVersion : "QA.1.0" property string updateVersion : "QA.1.0"
property bool updateCanInstall: true property bool updateCanInstall: true
property string updateLandingPage : "https://protonmail.com/bridge/download/" 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 notifyManualUpdate()
signal notifyManualUpdateRestartNeeded() signal notifyManualUpdateRestartNeeded()
signal notifyManualUpdateError() signal notifyManualUpdateError()
@ -312,6 +312,11 @@ Window {
function startManualUpdate() { function startManualUpdate() {
console.log("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;" property string credits : "here;goes;list;;of;;used;packages;"
@ -342,13 +347,14 @@ Window {
signal notifyBubble(int tabIndex, string message) signal notifyBubble(int tabIndex, string message)
signal silentBubble(int tabIndex, string message) signal silentBubble(int tabIndex, string message)
signal setAddAccountWarning(string message) signal setAddAccountWarning(string message)
signal notifyFirewall() signal notifyFirewall()
signal notifyLogout(string accname) signal notifyLogout(string accname)
signal notifyAddressChanged(string accname) signal notifyAddressChanged(string accname)
signal notifyAddressChangedLogout(string accname) signal notifyAddressChangedLogout(string accname)
signal failedAutostartCode(string code) signal failedAutostartCode(string code)
signal openReleaseNotesExternally()
signal showCertIssue() signal showCertIssue()
signal updateFinished(bool hasError) signal updateFinished(bool hasError)

View File

@ -167,28 +167,28 @@ Window {
go.goos = "linux"; go.goos = "linux";
break; break;
case "NotifyManualUpdate(CanInstall)" : case "NotifyManualUpdate(CanInstall)" :
go.notifyManualUpdate() go.notifyManualUpdate()
go.updateCanInstall = true go.updateCanInstall = true
break; break;
case "NotifyManualUpdate(CantInstall)" : case "NotifyManualUpdate(CantInstall)" :
go.notifyManualUpdate() go.notifyManualUpdate()
go.updateCanInstall = false go.updateCanInstall = false
break; break;
case "NotifyManualUpdateRestart": case "NotifyManualUpdateRestart":
go.notifyManualUpdateRestartNeeded() go.notifyManualUpdateRestartNeeded()
break; break;
case "NotifyManualUpdateError": case "NotifyManualUpdateError":
go.notifyManualUpdateError() go.notifyManualUpdateError()
break; break;
case "ForceUpdate" : case "ForceUpdate" :
go.notifyForceUpdate() go.notifyForceUpdate()
break; break;
case "NotifySilentUpdateRestartNeeded" : case "NotifySilentUpdateRestartNeeded" :
go.notifySilentUpdateRestartNeeded() go.notifySilentUpdateRestartNeeded()
break; break;
case "NotifySilentUpdateError" : case "NotifySilentUpdateError" :
go.notifySilentUpdateError() go.notifySilentUpdateError()
break; break;
case "ImportStructure" : case "ImportStructure" :
testgui.winMain.dialogImport.address = "cuto@pm.com" testgui.winMain.dialogImport.address = "cuto@pm.com"
testgui.winMain.dialogImport.show() testgui.winMain.dialogImport.show()
@ -855,7 +855,7 @@ Window {
property string programTitle : "ProtonMail Import-Export app" property string programTitle : "ProtonMail Import-Export app"
property string fullversion : "QA.1.0 (d9f8sdf9) 2020-02-19T10:57:23+01:00" property string fullversion : "QA.1.0 (d9f8sdf9) 2020-02-19T10:57:23+01:00"
property string downloadLink: "https://protonmail.com/download/beta/protonmail-bridge-1.1.5-1.x86_64.rpm;https://www.protonmail.com/downloads/beta/Desktop-Bridge-link1.exe;https://www.protonmail.com/downloads/beta/Desktop-Bridge-link1.exe;https://www.protonmail.com/downloads/beta/Desktop-Bridge-link1.exe;" property string downloadLink: "https://protonmail.com/download/beta/protonmail-bridge-1.1.5-1.x86_64.rpm;https://www.protonmail.com/downloads/beta/Desktop-Bridge-link1.exe;https://www.protonmail.com/downloads/beta/Desktop-Bridge-link1.exe;https://www.protonmail.com/downloads/beta/Desktop-Bridge-link1.exe;"
property string updateVersion : "q0.1.0" property string updateVersion : "q0.1.0"
property bool updateCanInstall: true property bool updateCanInstall: true
property string updateLandingPage : "https://protonmail.com/import-export/download/" property string updateLandingPage : "https://protonmail.com/import-export/download/"
@ -872,6 +872,11 @@ Window {
function startManualUpdate() { function startManualUpdate() {
console.log("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 real progress: 0.0
property int progressFails: 0 property int progressFails: 0
@ -912,6 +917,8 @@ Window {
signal notifyUpdate() signal notifyUpdate()
signal updateFinished(bool hasError) signal updateFinished(bool hasError)
signal openReleaseNotesExternally()
signal notifyLogout(string accname) signal notifyLogout(string accname)
signal notifyError(int errCode) 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() { go func() {
version, err := f.updater.Check() s.checkForUpdatesAndWait()
s.Qml.OpenReleaseNotesExternally()
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) checkForUpdates() {
go s.checkForUpdatesAndWait()
}
func (f *FrontendQt) resetSource() { func (f *FrontendQt) resetSource() {
if f.transfer != nil { if f.transfer != nil {
f.transfer.ResetRules() f.transfer.ResetRules()

View File

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

View File

@ -414,35 +414,44 @@ func (s *FrontendQt) openLogs() {
go open.Run(logsPath) 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() { go func() {
version, err := s.updater.Check() s.checkForUpdatesAndWait()
s.Qml.OpenReleaseNotesExternally()
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) checkForUpdates() {
go s.checkForUpdatesAndWait()
}
func (s *FrontendQt) openLicenseFile() { func (s *FrontendQt) openLicenseFile() {
go open.Run(s.locations.GetLicenseFilePath()) go open.Run(s.locations.GetLicenseFilePath())
} }

View File

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