mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-17 23:56:56 +00:00
GODT-1425: Factory reset enables launch on startup
This commit is contained in:
@ -25,7 +25,6 @@ import (
|
||||
"fmt"
|
||||
"sync"
|
||||
|
||||
"github.com/ProtonMail/go-autostart"
|
||||
"github.com/ProtonMail/proton-bridge/internal/config/settings"
|
||||
"github.com/ProtonMail/proton-bridge/internal/config/useragent"
|
||||
"github.com/ProtonMail/proton-bridge/internal/frontend/types"
|
||||
@ -50,7 +49,6 @@ type FrontendQt struct {
|
||||
userAgent *useragent.UserAgent
|
||||
bridge types.Bridger
|
||||
noEncConfirmator types.NoEncConfirmator
|
||||
autostart *autostart.App
|
||||
restarter types.Restarter
|
||||
showOnStartup bool
|
||||
|
||||
@ -82,7 +80,6 @@ func New(
|
||||
userAgent *useragent.UserAgent,
|
||||
bridge types.Bridger,
|
||||
_ types.NoEncConfirmator,
|
||||
autostart *autostart.App,
|
||||
restarter types.Restarter,
|
||||
) *FrontendQt {
|
||||
userAgent.SetPlatform(core.QSysInfo_PrettyProductName())
|
||||
@ -99,7 +96,6 @@ func New(
|
||||
updater: updater,
|
||||
userAgent: userAgent,
|
||||
bridge: bridge,
|
||||
autostart: autostart,
|
||||
restarter: restarter,
|
||||
showOnStartup: showWindowOnStart,
|
||||
}
|
||||
@ -122,6 +118,12 @@ func (f *FrontendQt) Loop() error {
|
||||
f.watchEvents()
|
||||
}()
|
||||
|
||||
// Set whether this is the first time GUI starts.
|
||||
f.qml.SetIsFirstGUIStart(f.settings.GetBool(settings.FirstStartGUIKey))
|
||||
defer func() {
|
||||
f.settings.SetBool(settings.FirstStartGUIKey, false)
|
||||
}()
|
||||
|
||||
if ret := f.app.Exec(); ret != 0 {
|
||||
err := fmt.Errorf("Event loop ended with return value: %v", ret)
|
||||
f.log.Warn("App exec", err)
|
||||
|
||||
@ -23,7 +23,6 @@ import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"github.com/ProtonMail/go-autostart"
|
||||
"github.com/ProtonMail/proton-bridge/internal/config/settings"
|
||||
"github.com/ProtonMail/proton-bridge/internal/config/useragent"
|
||||
"github.com/ProtonMail/proton-bridge/internal/frontend/types"
|
||||
@ -50,7 +49,6 @@ func New(
|
||||
userAgent *useragent.UserAgent,
|
||||
bridge types.Bridger,
|
||||
noEncConfirmator types.NoEncConfirmator,
|
||||
autostart *autostart.App,
|
||||
restarter types.Restarter,
|
||||
) *FrontendHeadless {
|
||||
return &FrontendHeadless{}
|
||||
|
||||
@ -75,21 +75,21 @@ func (f *FrontendQt) changeLocalCache(enableDiskCache bool, diskCachePath *core.
|
||||
}
|
||||
|
||||
func (f *FrontendQt) setIsAutostartOn() {
|
||||
f.qml.SetIsAutostartOn(f.autostart.IsEnabled())
|
||||
f.qml.SetIsAutostartOn(f.bridge.IsAutostartEnabled())
|
||||
}
|
||||
|
||||
func (f *FrontendQt) toggleAutostart(makeItEnabled bool) {
|
||||
defer f.qml.ToggleAutostartFinished()
|
||||
if makeItEnabled == f.autostart.IsEnabled() {
|
||||
if makeItEnabled == f.bridge.IsAutostartEnabled() {
|
||||
f.setIsAutostartOn()
|
||||
return
|
||||
}
|
||||
|
||||
var err error
|
||||
if makeItEnabled {
|
||||
err = f.autostart.Enable()
|
||||
err = f.bridge.EnableAutostart()
|
||||
} else {
|
||||
err = f.autostart.Disable()
|
||||
err = f.bridge.DisableAutostart()
|
||||
}
|
||||
f.setIsAutostartOn()
|
||||
|
||||
|
||||
@ -90,6 +90,8 @@ type QMLBackend struct {
|
||||
_ func(enableDiskCache bool, diskCachePath core.QUrl) `slot:"changeLocalCache"`
|
||||
_ func() `signal:"changeLocalCacheFinished"`
|
||||
|
||||
_ bool `property:"isFirstGUIStart"`
|
||||
|
||||
_ bool `property:"isAutomaticUpdateOn"`
|
||||
_ func(makeItActive bool) `slot:"toggleAutomaticUpdate"`
|
||||
|
||||
|
||||
Reference in New Issue
Block a user