GODT-919 GODT-1022 GODT-947 Logs and signals

+ Added startup logs
+ Added wait group for update notifications
+ Changed hooks in debug and trace level
This commit is contained in:
Jakub
2021-02-08 14:47:40 +01:00
committed by Michal Horejsek
parent bcef1c36ba
commit c6107dbd4b
21 changed files with 93 additions and 37 deletions

View File

@ -22,6 +22,7 @@ package qtie
import (
"errors"
"os"
"sync"
"github.com/ProtonMail/proton-bridge/internal/config/settings"
"github.com/ProtonMail/proton-bridge/internal/events"
@ -76,6 +77,9 @@ type FrontendQt struct {
// saving most up-to-date update info to install it manually
updateInfo updater.VersionInfo
initializing sync.WaitGroup
initializationDone sync.Once
}
// New is constructor for Import-Export Qt-Go interface
@ -102,6 +106,10 @@ func New(
restarter: restarter,
}
// Initializing.Done is only called sync.Once. Please keep the increment
// set to 1
f.initializing.Add(1)
log.Debugf("New Qt frontend: %p", f)
return f
}
@ -541,3 +549,14 @@ func (f *FrontendQt) createLabelOrFolder(email, name, color string, isLabel bool
}
return true
}
func (f *FrontendQt) WaitUntilFrontendIsReady() {
f.initializing.Wait()
}
// setGUIIsReady unlocks the WaitUntilFrontendIsReady.
func (f *FrontendQt) setGUIIsReady() {
f.initializationDone.Do(func() {
f.initializing.Done()
})
}