GODT-1815: Start without internet, load users later

This commit is contained in:
James Houlahan
2022-09-27 12:02:28 +02:00
parent 1da1188351
commit 612fb7ad7b
16 changed files with 243 additions and 175 deletions

View File

@ -25,7 +25,6 @@ import (
"github.com/ProtonMail/proton-bridge/v2/internal/constants"
"github.com/ProtonMail/proton-bridge/v2/internal/events"
"github.com/ProtonMail/proton-bridge/v2/internal/vault"
"gitlab.protontech.ch/go/liteapi"
"github.com/abiosoft/ishell"
"github.com/sirupsen/logrus"
@ -283,14 +282,11 @@ func (f *frontendCLI) watchEvents() {
for event := range eventCh {
switch event := event.(type) {
case events.ConnStatus:
switch event.Status {
case liteapi.StatusUp:
f.notifyInternetOn()
case events.ConnStatusUp:
f.notifyInternetOn()
case liteapi.StatusDown:
f.notifyInternetOff()
}
case events.ConnStatusDown:
f.notifyInternetOff()
case events.UserDeauth:
user, err := f.bridge.GetUserInfo(event.UserID)

View File

@ -38,7 +38,6 @@ import (
"github.com/ProtonMail/proton-bridge/v2/pkg/restarter"
"github.com/google/uuid"
"github.com/sirupsen/logrus"
"gitlab.protontech.ch/go/liteapi"
"google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
"google.golang.org/grpc/credentials"
@ -219,8 +218,11 @@ func (s *Service) watchEvents() {
for event := range eventCh {
switch event := event.(type) {
case events.ConnStatus:
_ = s.SendEvent(NewInternetStatusEvent(event.Status == liteapi.StatusUp))
case events.ConnStatusUp:
_ = s.SendEvent(NewInternetStatusEvent(true))
case events.ConnStatusDown:
_ = s.SendEvent(NewInternetStatusEvent(false))
case events.Raise:
_ = s.SendEvent(NewShowMainWindowEvent())