GODT-35: Finish all details and make tests pass

This commit is contained in:
Michal Horejsek
2021-03-11 14:37:15 +01:00
committed by Jakub
parent 2284e9ede1
commit 8109831c07
173 changed files with 4697 additions and 2897 deletions

View File

@ -21,6 +21,7 @@ import (
"net/http"
"sync"
"github.com/ProtonMail/proton-bridge/internal/constants"
"github.com/ProtonMail/proton-bridge/pkg/pmapi"
)
@ -36,19 +37,18 @@ type Controller struct {
noInternetConnection bool
}
func NewController() (*Controller, pmapi.Manager) {
func NewController(app string) (*Controller, pmapi.Manager) {
cm := pmapi.New(pmapi.NewConfig(getAppVersionName(app), constants.Version))
controller := &Controller{
lock: &sync.RWMutex{},
calls: []*fakeCall{},
pmapiByUsername: map[string]pmapi.Client{},
messageIDsByUsername: map[string][]string{},
clientManager: cm,
noInternetConnection: false,
}
// FIXME(conman): Set connect values here?
cm := pmapi.New(pmapi.DefaultConfig)
cm.SetTransport(&fakeTransport{
ctl: controller,
transport: http.DefaultTransport,
@ -56,3 +56,10 @@ func NewController() (*Controller, pmapi.Manager) {
return controller, cm
}
func getAppVersionName(app string) string {
if app == "ie" {
return "importExport"
}
return app
}