GODT-1058 Install after chaning channel right away only in case of downgrade

This commit is contained in:
Michal Horejsek
2021-02-23 08:50:18 +01:00
committed by Jakub Cuth
parent 0e5a45671f
commit feeb7179f5
6 changed files with 35 additions and 21 deletions

View File

@ -81,9 +81,13 @@ func (f *frontendCLI) selectEarlyChannel(c *ishell.Context) {
f.Println("Bridge is currently on the stable update channel.")
if f.yesNoQuestion("Are you sure you want to switch to the early-access update channel") {
if err := f.bridge.SetUpdateChannel(updater.EarlyChannel); err != nil {
needRestart, err := f.bridge.SetUpdateChannel(updater.EarlyChannel)
if err != nil {
f.Println("There was a problem switching update channel.")
}
if needRestart {
f.restarter.SetToRestart()
}
}
}
@ -97,9 +101,12 @@ func (f *frontendCLI) selectStableChannel(c *ishell.Context) {
f.Println("Switching to the stable channel may reset all data!")
if f.yesNoQuestion("Are you sure you want to switch to the stable update channel") {
if err := f.bridge.SetUpdateChannel(updater.StableChannel); err != nil {
needRestart, err := f.bridge.SetUpdateChannel(updater.StableChannel)
if err != nil {
f.Println("There was a problem switching update channel.")
}
f.restarter.SetToRestart()
if needRestart {
f.restarter.SetToRestart()
}
}
}

View File

@ -229,7 +229,7 @@ Dialog {
currentIndex : 0
title : qsTr("Clear cache", "title of page that displays during cache clearing")
question : qsTr("Are you sure you want to clear your local cache?", "displays during cache clearing")
note : qsTr("This will delete all of your stored preferences as well as cached email data for all accounts, temporarily slowing down the email download process significantly.", "displays during cache clearing")
note : qsTr("This will delete all of your stored preferences as well as cached email data for all accounts, and requires you to reconfigure your client.", "displays during cache clearing")
answer : qsTr("Clearing the cache ...", "displays during cache clearing")
}
},
@ -310,7 +310,7 @@ Dialog {
target: root
currentIndex : 0
question : qsTr("Are you sure you want to leave early access? Please keep in mind this operation clears the cache and restarts Bridge.")
note : qsTr("This will delete all of your stored preferences as well as cached email data for all accounts, temporarily slowing down the email download process significantly.")
note : qsTr("This will delete all of your stored preferences as well as cached email data for all accounts, and requires you to reconfigure your client.")
title : qsTr("Disable early access")
answer : qsTr("Disabling early access...")
}

View File

@ -84,7 +84,7 @@ func (s *FrontendQt) clearCache() {
channel := s.bridge.GetUpdateChannel()
if channel == updater.EarlyChannel {
if err := s.bridge.SetUpdateChannel(updater.StableChannel); err != nil {
if _, err := s.bridge.SetUpdateChannel(updater.StableChannel); err != nil {
s.Qml.NotifyManualUpdateError()
return
}

View File

@ -605,14 +605,16 @@ func (s *FrontendQt) toggleEarlyAccess() {
channel = updater.EarlyChannel
}
err := s.bridge.SetUpdateChannel(channel)
needRestart, err := s.bridge.SetUpdateChannel(channel)
s.Qml.SetIsEarlyAccess(channel == updater.EarlyChannel)
if err != nil {
s.Qml.NotifyManualUpdateError()
return
}
s.restarter.SetToRestart()
s.App.Quit()
if needRestart {
s.restarter.SetToRestart()
s.App.Quit()
}
}
func (s *FrontendQt) toggleAllowProxy() {

View File

@ -79,7 +79,7 @@ type Bridger interface {
AllowProxy()
DisallowProxy()
GetUpdateChannel() updater.UpdateChannel
SetUpdateChannel(updater.UpdateChannel) error
SetUpdateChannel(updater.UpdateChannel) (needRestart bool, err error)
GetKeychainApp() string
SetKeychainApp(keychain string)
}