mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-15 22:56:48 +00:00
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:
@ -97,6 +97,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 returns a new Qt frontend for the bridge.
|
||||
@ -132,6 +135,10 @@ func New(
|
||||
restarter: restarter,
|
||||
}
|
||||
|
||||
// Initializing.Done is only called sync.Once. Please keep the increment
|
||||
// set to 1
|
||||
tmp.initializing.Add(1)
|
||||
|
||||
// Nicer string for OS.
|
||||
currentOS := core.QSysInfo_PrettyProductName()
|
||||
bridge.SetCurrentOS(currentOS)
|
||||
@ -180,6 +187,8 @@ func (s *FrontendQt) NotifySilentUpdateError(err error) {
|
||||
}
|
||||
|
||||
func (s *FrontendQt) watchEvents() {
|
||||
s.WaitUntilFrontendIsReady()
|
||||
|
||||
errorCh := s.getEventChannel(events.ErrorEvent)
|
||||
credentialsErrorCh := s.getEventChannel(events.CredentialsErrorEvent)
|
||||
outgoingNoEncCh := s.getEventChannel(events.OutgoingNoEncEvent)
|
||||
@ -683,3 +692,14 @@ func (s *FrontendQt) startManualUpdate() {
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
func (s *FrontendQt) WaitUntilFrontendIsReady() {
|
||||
s.initializing.Wait()
|
||||
}
|
||||
|
||||
// setGUIIsReady unlocks the WaitFrontendIsReady.
|
||||
func (s *FrontendQt) setGUIIsReady() {
|
||||
s.initializationDone.Do(func() {
|
||||
s.initializing.Done()
|
||||
})
|
||||
}
|
||||
|
||||
@ -48,6 +48,9 @@ func (s *FrontendHeadless) NotifyManualUpdate(update updater.VersionInfo, canIns
|
||||
// NOTE: Save the update somewhere so that it can be installed when user chooses "install now".
|
||||
}
|
||||
|
||||
func (s *FrontendHeadless) WaitUntilFrontendIsReady() {
|
||||
}
|
||||
|
||||
func (s *FrontendHeadless) SetVersion(update updater.VersionInfo) {
|
||||
}
|
||||
|
||||
|
||||
@ -25,7 +25,7 @@ import (
|
||||
"github.com/therecipe/qt/core"
|
||||
)
|
||||
|
||||
// Interface between go and qml.
|
||||
// GoQMLInterface between go and qml.
|
||||
//
|
||||
// Here we implement all the signals / methods.
|
||||
type GoQMLInterface struct {
|
||||
@ -64,6 +64,7 @@ type GoQMLInterface struct {
|
||||
_ func() `slot:"checkAndOpenReleaseNotes"`
|
||||
_ func() `signal:"openReleaseNotesExternally"`
|
||||
_ func() `slot:"startManualUpdate"`
|
||||
_ func() `slot:"guiIsReady"`
|
||||
|
||||
// Translations.
|
||||
_ string `property:"wrongCredentials"`
|
||||
@ -170,6 +171,7 @@ func (s *GoQMLInterface) SetFrontend(f *FrontendQt) {
|
||||
s.ConnectClearKeychain(f.clearKeychain)
|
||||
s.ConnectOpenLicenseFile(f.openLicenseFile)
|
||||
s.ConnectStartManualUpdate(f.startManualUpdate)
|
||||
s.ConnectGuiIsReady(f.setGUIIsReady)
|
||||
s.ConnectGetLocalVersionInfo(f.getLocalVersionInfo)
|
||||
s.ConnectCheckForUpdates(f.checkForUpdates)
|
||||
s.ConnectGetIMAPPort(f.getIMAPPort)
|
||||
|
||||
Reference in New Issue
Block a user