Extract file system interaction from SonarWebSocketImpl
Summary: SonarWebSocketImpl has got pretty bloated. So I'm extracting all the file interaction out of it into ConnectionContextStore. The purpose of this class is to provide all the context needed to establish a connection. This makes SonarWebSocketImpl more functional and therefore testable. Reviewed By: priteshrnandgaonkar Differential Revision: D9540089 fbshipit-source-id: 0cd1d69f2b11eaf9f569245a2da14f85cc140427
This commit is contained in:
committed by
Facebook Github Bot
parent
a5af72a169
commit
afea2f63ec
@@ -12,6 +12,7 @@
|
||||
#include "SonarState.h"
|
||||
#include "SonarStep.h"
|
||||
#include "SonarWebSocketImpl.h"
|
||||
#include "ConnectionContextStore.h"
|
||||
#include <vector>
|
||||
|
||||
#ifdef __ANDROID__
|
||||
@@ -33,8 +34,9 @@ using folly::dynamic;
|
||||
|
||||
void SonarClient::init(SonarInitConfig config) {
|
||||
auto state = std::make_shared<SonarState>();
|
||||
auto context = std::make_shared<ConnectionContextStore>(config.deviceData);
|
||||
kInstance =
|
||||
new SonarClient(std::make_unique<SonarWebSocketImpl>(std::move(config), state), state);
|
||||
new SonarClient(std::make_unique<SonarWebSocketImpl>(std::move(config), state, context), state);
|
||||
}
|
||||
|
||||
SonarClient* SonarClient::instance() {
|
||||
|
||||
Reference in New Issue
Block a user