Notify about update right after the start

This commit is contained in:
Michal Horejsek
2021-02-01 13:22:26 +01:00
parent 6d9d5f35ca
commit bcef1c36ba
4 changed files with 15 additions and 12 deletions

View File

@ -49,7 +49,9 @@ const (
// SetupEvents specific to event type and data.
func SetupEvents(listener listener.Listener) {
listener.SetLimit(LogoutEvent, LogoutEventTimeout)
listener.SetBuffer(TLSCertIssue)
listener.SetBuffer(ErrorEvent)
listener.SetBuffer(CredentialsErrorEvent)
listener.SetBuffer(InternetOffEvent)
listener.SetBuffer(UpgradeApplicationEvent)
listener.SetBuffer(TLSCertIssue)
}

View File

@ -109,10 +109,6 @@ func New(
// Loop function for Import-Export interface. It runs QtExecute in main thread
// with no additional function.
func (f *FrontendQt) Loop() (err error) {
go func() {
defer f.panicHandler.HandlePanic()
f.watchEvents()
}()
err = f.QtExecute(func(f *FrontendQt) error { return nil })
return err
}
@ -247,6 +243,11 @@ func (f *FrontendQt) QtExecute(Procedure func(*FrontendQt) error) error {
f.Qml.SetIsAutoUpdate(false)
}
go func() {
defer f.panicHandler.HandlePanic()
f.watchEvents()
}()
// Loop
if ret := gui.QGuiApplication_Exec(); ret != 0 {
//err := errors.New(errors.ErrQApplication, "Event loop ended with return value: %v", string(ret))

View File

@ -154,10 +154,6 @@ func (s *FrontendQt) InstanceExistAlert() {
//
// It runs QtExecute in main thread with no additional function.
func (s *FrontendQt) Loop() (err error) {
go func() {
defer s.panicHandler.HandlePanic()
s.watchEvents()
}()
err = s.qtExecute(func(s *FrontendQt) error { return nil })
return err
}
@ -250,6 +246,7 @@ func (s *FrontendQt) watchEvents() {
func (s *FrontendQt) getEventChannel(event string) <-chan string {
ch := make(chan string)
s.eventListener.Add(event, ch)
s.eventListener.RetryEmit(event)
return ch
}
@ -366,9 +363,6 @@ func (s *FrontendQt) qtExecute(Procedure func(*FrontendQt) error) error {
s.Qml.SetIsEarlyAccess(false)
}
s.eventListener.RetryEmit(events.TLSCertIssue)
s.eventListener.RetryEmit(events.ErrorEvent)
// Set reporting of outgoing email without encryption.
s.Qml.SetIsReportingOutgoingNoEnc(s.settings.GetBool(settings.ReportOutgoingNoEncKey))
@ -395,6 +389,11 @@ func (s *FrontendQt) qtExecute(Procedure func(*FrontendQt) error) error {
return err
}
go func() {
defer s.panicHandler.HandlePanic()
s.watchEvents()
}()
// Loop
if ret := gui.QGuiApplication_Exec(); ret != 0 {
err := errors.New("Event loop ended with return value:" + string(ret))

View File

@ -16,3 +16,4 @@ Changelog [format](http://keepachangelog.com/en/1.0.0/)
### Fixed
* GODT-1011 Stable integration test deleting many messages using UID EXPUNGE.
* GODT-1015 Use lenient version parser to properly parse version provided by Mac.
* GODT-919 Notify about update right after the start.