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

@ -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

@ -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,8 +422,7 @@ func (f *FrontendQt) startManualUpdate() {
}()
}
func (f *FrontendQt) checkForUpdates() {
go func() {
func (f *FrontendQt) checkForUpdatesAndWait() {
version, err := f.updater.Check()
if err != nil {
@ -448,9 +447,19 @@ func (f *FrontendQt) checkForUpdates() {
}
f.NotifyManualUpdate(version, true)
}
func (s *FrontendQt) checkAndOpenReleaseNotes() {
go func() {
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,8 +414,7 @@ func (s *FrontendQt) openLogs() {
go open.Run(logsPath)
}
func (s *FrontendQt) checkForUpdates() {
go func() {
func (s *FrontendQt) checkForUpdatesAndWait() {
version, err := s.updater.Check()
if err != nil {
@ -440,9 +439,19 @@ func (s *FrontendQt) checkForUpdates() {
}
s.NotifyManualUpdate(version, true)
}
func (s *FrontendQt) checkAndOpenReleaseNotes() {
go func() {
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.