feat: clientmanager has checkconnection

This commit is contained in:
James Houlahan
2020-04-16 16:05:05 +02:00
parent bfc4069df4
commit 4809d97cb1
11 changed files with 93 additions and 102 deletions

View File

@ -23,7 +23,6 @@ import (
"strings"
"github.com/ProtonMail/proton-bridge/internal/preferences"
"github.com/ProtonMail/proton-bridge/pkg/connection"
"github.com/ProtonMail/proton-bridge/pkg/ports"
"github.com/abiosoft/ishell"
)
@ -41,7 +40,7 @@ func (f *frontendCLI) restart(c *ishell.Context) {
}
func (f *frontendCLI) checkInternetConnection(c *ishell.Context) {
if connection.CheckInternetConnection() == nil {
if f.bridge.CheckConnection() == nil {
f.Println("Internet connection is available.")
} else {
f.Println("Can not contact server please check you internet connection.")

View File

@ -49,7 +49,7 @@ import (
//"github.com/ProtonMail/proton-bridge/pkg/keychain"
"github.com/ProtonMail/proton-bridge/pkg/listener"
pmapi "github.com/ProtonMail/proton-bridge/pkg/pmapi"
"github.com/ProtonMail/proton-bridge/pkg/pmapi"
"github.com/ProtonMail/proton-bridge/pkg/updates"
"github.com/kardianos/osext"
"github.com/skratchdot/open-golang/open"
@ -86,7 +86,7 @@ type FrontendQt struct {
programName string // Program name (shown in taskbar).
programVer string // Program version (shown in help).
authClient bridge.PMAPIProvider
authClient pmapi.Client
auth *pmapi.Auth
@ -569,7 +569,7 @@ func (s *FrontendQt) isSMTPSTARTTLS() bool {
}
func (s *FrontendQt) checkInternet() {
s.Qml.SetConnectionStatus(IsInternetAvailable())
s.Qml.SetConnectionStatus(s.bridge.CheckConnection() == nil)
}
func (s *FrontendQt) switchAddressModeUser(iAccount int) {

View File

@ -25,7 +25,6 @@ import (
"os/exec"
"time"
"github.com/ProtonMail/proton-bridge/pkg/connection"
"github.com/therecipe/qt/core"
)
@ -64,10 +63,6 @@ func PauseLong() {
time.Sleep(3 * time.Second)
}
func IsInternetAvailable() bool {
return connection.CheckInternetConnection() == nil
}
// FIXME: Not working in test...
func WaitForEnter() {
log.Print("Press 'Enter' to continue...")

View File

@ -54,6 +54,7 @@ type Bridger interface {
ClearData() error
AllowProxy()
DisallowProxy()
CheckConnection() error
}
// BridgeUser is an interface of user needed by frontend.