mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-14 22:46:44 +00:00
GODT-1670: restore update [skip-ci]
GODT-1670: Log the gRPC call
This commit is contained in:
@ -305,7 +305,7 @@ void QMLBackend::toggleAutomaticUpdate(bool active)
|
|||||||
//****************************************************************************************************************************************************
|
//****************************************************************************************************************************************************
|
||||||
void QMLBackend::checkUpdates()
|
void QMLBackend::checkUpdates()
|
||||||
{
|
{
|
||||||
app().grpc().checkUpdate();
|
logGRPCCallStatus(app().grpc().checkUpdate(), "checkUpdate");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -314,7 +314,7 @@ void QMLBackend::checkUpdates()
|
|||||||
//****************************************************************************************************************************************************
|
//****************************************************************************************************************************************************
|
||||||
void QMLBackend::installUpdate()
|
void QMLBackend::installUpdate()
|
||||||
{
|
{
|
||||||
app().log().error(QString("%1() is not implemented.").arg(__FUNCTION__));
|
logGRPCCallStatus(app().grpc().installUpdate(), "installUpdate");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -33,7 +33,6 @@ void initQtApplication()
|
|||||||
if ((!qsgInfo.isEmpty()) && (qsgInfo != "0"))
|
if ((!qsgInfo.isEmpty()) && (qsgInfo != "0"))
|
||||||
QLoggingCategory::setFilterRules("qt.scenegraph.general=true");
|
QLoggingCategory::setFilterRules("qt.scenegraph.general=true");
|
||||||
|
|
||||||
/// \todo GODT-1670 Get version from go backend.
|
|
||||||
QGuiApplication::setApplicationName("Proton Mail Bridge");
|
QGuiApplication::setApplicationName("Proton Mail Bridge");
|
||||||
QGuiApplication::setApplicationVersion(PROJECT_VER);
|
QGuiApplication::setApplicationVersion(PROJECT_VER);
|
||||||
QGuiApplication::setOrganizationName("Proton AG");
|
QGuiApplication::setOrganizationName("Proton AG");
|
||||||
|
|||||||
@ -38,6 +38,7 @@ import (
|
|||||||
"github.com/ProtonMail/proton-bridge/v2/pkg/keychain"
|
"github.com/ProtonMail/proton-bridge/v2/pkg/keychain"
|
||||||
"github.com/ProtonMail/proton-bridge/v2/pkg/listener"
|
"github.com/ProtonMail/proton-bridge/v2/pkg/listener"
|
||||||
"github.com/ProtonMail/proton-bridge/v2/pkg/pmapi"
|
"github.com/ProtonMail/proton-bridge/v2/pkg/pmapi"
|
||||||
|
"github.com/pkg/errors"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
"google.golang.org/grpc/credentials"
|
"google.golang.org/grpc/credentials"
|
||||||
@ -179,8 +180,16 @@ func (s *Service) NotifyManualUpdate(version updater.VersionInfo, canInstall boo
|
|||||||
func (s *Service) SetVersion(update updater.VersionInfo) {
|
func (s *Service) SetVersion(update updater.VersionInfo) {
|
||||||
s.newVersionInfo = update
|
s.newVersionInfo = update
|
||||||
}
|
}
|
||||||
func (s *Service) NotifySilentUpdateInstalled() {}
|
|
||||||
func (s *Service) NotifySilentUpdateError(error) {}
|
func (s *Service) NotifySilentUpdateInstalled() {
|
||||||
|
_ = s.SendEvent(NewUpdateSilentRestartNeededEvent())
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Service) NotifySilentUpdateError(err error) {
|
||||||
|
s.log.WithError(err).Error("In app update failed, asking for manual.")
|
||||||
|
_ = s.SendEvent(NewUpdateErrorEvent(UpdateErrorType_UPDATE_SILENT_ERROR))
|
||||||
|
}
|
||||||
|
|
||||||
func (s *Service) WaitUntilFrontendIsReady() {}
|
func (s *Service) WaitUntilFrontendIsReady() {}
|
||||||
|
|
||||||
func (s *Service) watchEvents() { // nolint:funlen
|
func (s *Service) watchEvents() { // nolint:funlen
|
||||||
@ -336,7 +345,10 @@ func (s *Service) checkUpdate() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *Service) updateForce() {
|
func (s *Service) updateForce() {
|
||||||
s.log.Error("updateForce is not implemented") // TO-DO GODT-1670 implement update.
|
checkingUpdates.Lock()
|
||||||
|
defer checkingUpdates.Unlock()
|
||||||
|
s.checkUpdate()
|
||||||
|
_ = s.SendEvent(NewUpdateForceEvent(s.newVersionInfo.Version.String()))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Service) checkUpdateAndNotify(isReqFromUser bool) {
|
func (s *Service) checkUpdateAndNotify(isReqFromUser bool) {
|
||||||
@ -363,3 +375,26 @@ func (s *Service) checkUpdateAndNotify(isReqFromUser bool) {
|
|||||||
s.NotifyManualUpdate(s.newVersionInfo, s.updater.CanInstall(s.newVersionInfo))
|
s.NotifyManualUpdate(s.newVersionInfo, s.updater.CanInstall(s.newVersionInfo))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *Service) installUpdate() {
|
||||||
|
checkingUpdates.Lock()
|
||||||
|
defer checkingUpdates.Unlock()
|
||||||
|
|
||||||
|
if !s.updater.CanInstall(s.newVersionInfo) {
|
||||||
|
s.log.Warning("Skipping update installation, current version too old")
|
||||||
|
_ = s.SendEvent(NewUpdateErrorEvent(UpdateErrorType_UPDATE_MANUAL_ERROR))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := s.updater.InstallUpdate(s.newVersionInfo); err != nil {
|
||||||
|
if errors.Cause(err) == updater.ErrDownloadVerify {
|
||||||
|
s.log.WithError(err).Warning("Skipping update installation due to temporary error")
|
||||||
|
} else {
|
||||||
|
s.log.WithError(err).Error("The update couldn't be installed")
|
||||||
|
_ = s.SendEvent(NewUpdateErrorEvent(UpdateErrorType_UPDATE_MANUAL_ERROR))
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
_ = s.SendEvent(NewUpdateSilentRestartNeededEvent())
|
||||||
|
}
|
||||||
|
|||||||
@ -404,7 +404,12 @@ func (s *Service) CheckUpdate(context.Context, *emptypb.Empty) (*emptypb.Empty,
|
|||||||
|
|
||||||
func (s *Service) InstallUpdate(context.Context, *emptypb.Empty) (*emptypb.Empty, error) {
|
func (s *Service) InstallUpdate(context.Context, *emptypb.Empty) (*emptypb.Empty, error) {
|
||||||
s.log.Info("InstallUpdate")
|
s.log.Info("InstallUpdate")
|
||||||
// TO-DO GODT-1670 Implement update install
|
go func() {
|
||||||
|
defer s.panicHandler.HandlePanic()
|
||||||
|
|
||||||
|
s.installUpdate()
|
||||||
|
}()
|
||||||
|
|
||||||
return &emptypb.Empty{}, nil
|
return &emptypb.Empty{}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user