diff --git a/app/app.go b/app/app.go index 1e12b88..df1f893 100644 --- a/app/app.go +++ b/app/app.go @@ -51,7 +51,7 @@ func (app *application) IsFeatureEnabled(experiment string) bool { type Application interface { LoadProfiles(password string) CreateProfile(name string, password string, autostart bool) - + InstallEngineHooks(engineHooks connections.EngineHooks) ImportProfile(exportedCwtchFile string, password string) (peer.CwtchPeer, error) EnhancedImportProfile(exportedCwtchFile string, password string) string DeleteProfile(onion string, currentPassword string) @@ -95,11 +95,11 @@ func LoadAppSettings(appDirectory string) *settings.GlobalSettingsFile { } // NewApp creates a new app with some environment awareness and initializes a Tor Manager -func NewApp(acn connectivity.ACN, appDirectory string, settings *settings.GlobalSettingsFile, engineHooks connections.EngineHooks) Application { +func NewApp(acn connectivity.ACN, appDirectory string, settings *settings.GlobalSettingsFile) Application { app := &application{engines: make(map[string]connections.Engine), eventBuses: make(map[string]event.Manager), directory: appDirectory, appBus: event.NewEventManager(), settings: settings} app.peers = make(map[string]peer.CwtchPeer) - app.engineHooks = engineHooks + app.engineHooks = DefaultEngineHooks{} app.acn = acn statusHandler := app.getACNStatusHandler() acn.SetStatusCallback(statusHandler) @@ -110,6 +110,10 @@ func NewApp(acn connectivity.ACN, appDirectory string, settings *settings.Global return app } +func (app *application) InstallEngineHooks(engineHooks connections.EngineHooks) { + app.engineHooks = engineHooks +} + func (app *application) ReadSettings() settings.GlobalSettings { app.appmutex.Lock() defer app.appmutex.Unlock() diff --git a/testing/autodownload/file_sharing_integration_test.go b/testing/autodownload/file_sharing_integration_test.go index 1212202..bbed71a 100644 --- a/testing/autodownload/file_sharing_integration_test.go +++ b/testing/autodownload/file_sharing_integration_test.go @@ -97,7 +97,7 @@ func TestFileSharing(t *testing.T) { acn.WaitTillBootstrapped() defer acn.Close() - app := app2.NewApp(acn, "./storage", app2.LoadAppSettings("./storage"), app2.DefaultEngineHooks{}) + app := app2.NewApp(acn, "./storage", app2.LoadAppSettings("./storage")) usr, _ := user.Current() cwtchDir := path.Join(usr.HomeDir, ".cwtch") diff --git a/testing/cwtch_peer_server_integration_test.go b/testing/cwtch_peer_server_integration_test.go index 24707a8..93d0a56 100644 --- a/testing/cwtch_peer_server_integration_test.go +++ b/testing/cwtch_peer_server_integration_test.go @@ -139,7 +139,7 @@ func TestCwtchPeerIntegration(t *testing.T) { const ServerAddr = "nfhxzvzxinripgdh4t2m4xcy3crf6p4cbhectgckuj3idsjsaotgowad" serverKeyBundle, _ := base64.StdEncoding.DecodeString(ServerKeyBundleBase64) - app := app2.NewApp(acn, "./storage", app2.LoadAppSettings("./storage"), app2.DefaultEngineHooks{}) + app := app2.NewApp(acn, "./storage", app2.LoadAppSettings("./storage")) usr, _ := user.Current() cwtchDir := path.Join(usr.HomeDir, ".cwtch") diff --git a/testing/encryptedstorage/encrypted_storage_integration_test.go b/testing/encryptedstorage/encrypted_storage_integration_test.go index 0c81f23..78b4f2d 100644 --- a/testing/encryptedstorage/encrypted_storage_integration_test.go +++ b/testing/encryptedstorage/encrypted_storage_integration_test.go @@ -59,7 +59,7 @@ func TestEncryptedStorage(t *testing.T) { defer acn.Close() acn.WaitTillBootstrapped() - app := app2.NewApp(acn, cwtchDir, app2.LoadAppSettings(cwtchDir), app2.DefaultEngineHooks{}) + app := app2.NewApp(acn, cwtchDir, app2.LoadAppSettings(cwtchDir)) app.CreateProfile("alice", "password", true) app.CreateProfile("bob", "password", true) diff --git a/testing/filesharing/file_sharing_integration_test.go b/testing/filesharing/file_sharing_integration_test.go index 8dc9b08..5287acb 100644 --- a/testing/filesharing/file_sharing_integration_test.go +++ b/testing/filesharing/file_sharing_integration_test.go @@ -97,7 +97,7 @@ func TestFileSharing(t *testing.T) { acn.WaitTillBootstrapped() defer acn.Close() - app := app2.NewApp(acn, "./storage", app2.LoadAppSettings("./storage"), app2.DefaultEngineHooks{}) + app := app2.NewApp(acn, "./storage", app2.LoadAppSettings("./storage")) usr, _ := user.Current() cwtchDir := path.Join(usr.HomeDir, ".cwtch")