mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-19 00:27:06 +00:00
GODT-35: Finish all details and make tests pass
This commit is contained in:
@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user