GODT-1714: Add version check between bridge-GUI and bridge

GODT-1714: link the update check mecanism [skip-ci]

GODT-1714: bind update check notification [skip-ci]

GODT-1714: Send the CheckFinishEvent in defer to be sure it never loop for eternity

GODT-1714: simplify the BRIDGE_APP_VERSION configuration [skip-ci]

GODT-1714: Fix CheckUpdateAndNotify based on what already exists

GODT-1714: Restore LandingPage and ReleaseNotesPage links [skip-ci]

Other: Cactch case in CMake where BRIDGE_APP_VERSION is not filled [skip-ci]
This commit is contained in:
Romain LE JEUNE
2022-07-21 12:52:54 +02:00
committed by Jakub
parent 7447d9a55a
commit d3f9756bdb
17 changed files with 1333 additions and 757 deletions

View File

@ -25,6 +25,7 @@ import (
"github.com/Masterminds/semver/v3"
"github.com/ProtonMail/proton-bridge/v2/internal/bridge"
"github.com/ProtonMail/proton-bridge/v2/internal/config/settings"
"github.com/ProtonMail/proton-bridge/v2/internal/constants"
"github.com/ProtonMail/proton-bridge/v2/internal/frontend/theme"
"github.com/ProtonMail/proton-bridge/v2/internal/updater"
"github.com/ProtonMail/proton-bridge/v2/pkg/keychain"
@ -165,7 +166,7 @@ func (s *Service) TriggerReset(context.Context, *emptypb.Empty) (*emptypb.Empty,
func (s *Service) Version(context.Context, *emptypb.Empty) (*wrapperspb.StringValue, error) {
s.log.Info("Version")
return nil, ErrNotImplemented
return wrapperspb.String(constants.Version), nil
}
func (s *Service) LogsPath(context.Context, *emptypb.Empty) (*wrapperspb.StringValue, error) {
@ -187,6 +188,14 @@ func (s *Service) DependencyLicensesLink(context.Context, *emptypb.Empty) (*wrap
return wrapperspb.String(s.locations.GetDependencyLicensesLink()), nil
}
func (s *Service) ReleaseNotesPageLink(context.Context, *emptypb.Empty) (*wrapperspb.StringValue, error) {
return wrapperspb.String(s.newVersionInfo.ReleaseNotesPage), nil
}
func (s *Service) LandingPageLink(context.Context, *emptypb.Empty) (*wrapperspb.StringValue, error) {
return wrapperspb.String(s.newVersionInfo.LandingPage), nil
}
func (s *Service) SetColorSchemeName(_ context.Context, name *wrapperspb.StringValue) (*emptypb.Empty, error) {
s.log.WithField("ColorSchemeName", name.Value).Info("SetColorSchemeName")
@ -385,7 +394,11 @@ func (s *Service) LoginAbort(_ context.Context, loginAbort *LoginAbortRequest) (
func (s *Service) CheckUpdate(context.Context, *emptypb.Empty) (*emptypb.Empty, error) {
s.log.Info("CheckUpdate")
// TO-DO GODT-1670 Implement update check
go func() {
defer s.panicHandler.HandlePanic()
s.checkUpdateAndNotify(true)
}()
return &emptypb.Empty{}, nil
}
@ -404,7 +417,7 @@ func (s *Service) SetIsAutomaticUpdateOn(_ context.Context, isOn *wrapperspb.Boo
}
s.settings.SetBool(settings.AutoUpdateKey, isOn.Value)
s.checkUpdateAndNotify()
s.checkUpdateAndNotify(false)
return &emptypb.Empty{}, nil
}