feat: early access

This commit is contained in:
James Houlahan
2020-12-03 15:36:02 +01:00
parent eccad4bbfd
commit d2066173f0
22 changed files with 235 additions and 72 deletions

View File

@ -370,6 +370,12 @@ func (s *FrontendQt) qtExecute(Procedure func(*FrontendQt) error) error {
s.Qml.SetIsProxyAllowed(false)
}
if updater.UpdateChannel(s.settings.Get(settings.UpdateChannelKey)) == updater.BetaChannel {
s.Qml.SetIsEarlyAccess(true)
} else {
s.Qml.SetIsEarlyAccess(false)
}
s.eventListener.RetryEmit(events.TLSCertIssue)
s.eventListener.RetryEmit(events.ErrorEvent)
@ -548,6 +554,18 @@ func (s *FrontendQt) toggleAutoUpdate() {
}
}
func (s *FrontendQt) toggleEarlyAccess() {
defer s.Qml.ProcessFinished()
if updater.UpdateChannel(s.settings.Get(settings.UpdateChannelKey)) == updater.BetaChannel {
s.settings.Set(settings.UpdateChannelKey, string(updater.LiveChannel))
s.Qml.SetIsEarlyAccess(false)
} else {
s.settings.Set(settings.UpdateChannelKey, string(updater.BetaChannel))
s.Qml.SetIsEarlyAccess(true)
}
}
func (s *FrontendQt) toggleAllowProxy() {
defer s.Qml.ProcessFinished()

View File

@ -35,6 +35,7 @@ type GoQMLInterface struct {
_ bool `property:"isAutoStart"`
_ bool `property:"isAutoUpdate"`
_ bool `property:"isEarlyAccess"`
_ bool `property:"isProxyAllowed"`
_ string `property:"currentAddress"`
_ string `property:"goos"`
@ -94,6 +95,7 @@ type GoQMLInterface struct {
_ func() `slot:"toggleAutoStart"`
_ func() `slot:"toggleAutoUpdate"`
_ func() `slot:"toggleEarlyAccess"`
_ func() `slot:"toggleAllowProxy"`
_ func() `slot:"loadAccounts"`
_ func() `slot:"openLogs"`
@ -157,6 +159,7 @@ func (s *GoQMLInterface) init() {}
// SetFrontend connects all slots and signals from Go to QML.
func (s *GoQMLInterface) SetFrontend(f *FrontendQt) {
s.ConnectToggleAutoStart(f.toggleAutoStart)
s.ConnectToggleEarlyAccess(f.toggleEarlyAccess)
s.ConnectToggleAutoUpdate(f.toggleAutoUpdate)
s.ConnectToggleAllowProxy(f.toggleAllowProxy)
s.ConnectLoadAccounts(f.loadAccounts)