GODT-1425: Factory reset enables launch on startup

This commit is contained in:
Jakub
2021-12-01 13:23:01 +01:00
committed by Jakub Cuth
parent a0dc764bb9
commit f2d568d92f
11 changed files with 105 additions and 34 deletions

View File

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