mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-22 01:56:44 +00:00
GODT-976 Exclude updates from clearing cache and clear cache, including updates, while switching early access off
This commit is contained in:
@ -294,7 +294,7 @@ Dialog {
|
||||
}
|
||||
},
|
||||
State {
|
||||
name: "toggleEarlyAccess"
|
||||
name: "toggleEarlyAccessOn"
|
||||
PropertyChanges {
|
||||
target: root
|
||||
currentIndex : 0
|
||||
@ -304,6 +304,17 @@ Dialog {
|
||||
answer : qsTr("Enabling early access...")
|
||||
}
|
||||
},
|
||||
State {
|
||||
name: "toggleEarlyAccessOff"
|
||||
PropertyChanges {
|
||||
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.")
|
||||
title : qsTr("Disable early access")
|
||||
answer : qsTr("Disabling early access...")
|
||||
}
|
||||
},
|
||||
State {
|
||||
name: "noKeychain"
|
||||
PropertyChanges {
|
||||
@ -375,7 +386,8 @@ Dialog {
|
||||
if ( state == "logout" ) { go.logoutAccount (input) }
|
||||
if ( state == "toggleAutoStart" ) { go.toggleAutoStart () }
|
||||
if ( state == "toggleAllowProxy" ) { go.toggleAllowProxy () }
|
||||
if ( state == "toggleEarlyAccess" ) { go.toggleEarlyAccess () }
|
||||
if ( state == "toggleEarlyAccessOn" ) { go.toggleEarlyAccess () }
|
||||
if ( state == "toggleEarlyAccessOff" ) { go.toggleEarlyAccess () }
|
||||
if ( state == "quit" ) { Qt.quit () }
|
||||
if ( state == "instance exists" ) { Qt.quit () }
|
||||
if ( state == "noKeychain" ) { Qt.quit () }
|
||||
|
||||
@ -150,9 +150,10 @@ Item {
|
||||
) + " " + text
|
||||
onClicked: {
|
||||
if (go.isEarlyAccess == true) {
|
||||
go.toggleEarlyAccess()
|
||||
dialogGlobal.state="toggleEarlyAccessOff"
|
||||
dialogGlobal.show()
|
||||
} else {
|
||||
dialogGlobal.state="toggleEarlyAccess"
|
||||
dialogGlobal.state="toggleEarlyAccessOn"
|
||||
dialogGlobal.show()
|
||||
}
|
||||
}
|
||||
|
||||
@ -26,6 +26,7 @@ import (
|
||||
"github.com/ProtonMail/proton-bridge/internal/bridge"
|
||||
"github.com/ProtonMail/proton-bridge/internal/config/settings"
|
||||
"github.com/ProtonMail/proton-bridge/internal/events"
|
||||
"github.com/ProtonMail/proton-bridge/internal/updater"
|
||||
"github.com/ProtonMail/proton-bridge/pkg/keychain"
|
||||
pmapi "github.com/ProtonMail/proton-bridge/pkg/pmapi"
|
||||
)
|
||||
@ -80,6 +81,15 @@ func (s *FrontendQt) loadAccounts() {
|
||||
|
||||
func (s *FrontendQt) clearCache() {
|
||||
defer s.Qml.ProcessFinished()
|
||||
|
||||
channel := s.bridge.GetUpdateChannel()
|
||||
if channel == updater.EarlyChannel {
|
||||
if err := s.bridge.SetUpdateChannel(updater.StableChannel); err != nil {
|
||||
s.Qml.NotifyManualUpdateError()
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if err := s.bridge.ClearData(); err != nil {
|
||||
log.Error("While clearing cache: ", err)
|
||||
}
|
||||
|
||||
@ -578,13 +578,21 @@ func (s *FrontendQt) toggleAutoUpdate() {
|
||||
func (s *FrontendQt) toggleEarlyAccess() {
|
||||
defer s.Qml.ProcessFinished()
|
||||
|
||||
if updater.UpdateChannel(s.settings.Get(settings.UpdateChannelKey)) == updater.EarlyChannel {
|
||||
s.settings.Set(settings.UpdateChannelKey, string(updater.StableChannel))
|
||||
s.Qml.SetIsEarlyAccess(false)
|
||||
channel := s.bridge.GetUpdateChannel()
|
||||
if channel == updater.EarlyChannel {
|
||||
channel = updater.StableChannel
|
||||
} else {
|
||||
s.settings.Set(settings.UpdateChannelKey, string(updater.EarlyChannel))
|
||||
s.Qml.SetIsEarlyAccess(true)
|
||||
channel = updater.EarlyChannel
|
||||
}
|
||||
|
||||
err := s.bridge.SetUpdateChannel(channel)
|
||||
s.Qml.SetIsEarlyAccess(channel == updater.EarlyChannel)
|
||||
if err != nil {
|
||||
s.Qml.NotifyManualUpdateError()
|
||||
return
|
||||
}
|
||||
s.restarter.SetToRestart()
|
||||
s.App.Quit()
|
||||
}
|
||||
|
||||
func (s *FrontendQt) toggleAllowProxy() {
|
||||
|
||||
@ -80,6 +80,8 @@ type Bridger interface {
|
||||
ReportBug(osType, osVersion, description, accountName, address, emailClient string) error
|
||||
AllowProxy()
|
||||
DisallowProxy()
|
||||
GetUpdateChannel() updater.UpdateChannel
|
||||
SetUpdateChannel(updater.UpdateChannel) error
|
||||
}
|
||||
|
||||
type bridgeWrap struct {
|
||||
|
||||
Reference in New Issue
Block a user