Files
flipper/xplat/Sonar/SonarStep.cpp
John Knox 91e94815b4 Add state tracking plumbing
Summary:
The plan is to get SonarState to take update events and aggregate them into an object, that can be displayed in the UI so you can see what sonar is currently trying to do, and what if anything is failing.
This is pretty rubbish right now, as it just uses a single string to represent state, this is just the initial version I'll iterate on.
I also need to pass the SonarState into the SonarWebSocketImpl, since that's where a lot of the heavy lifting is done, but as long as something is logging state updates here, it proves the concept.
SonarStateUpdateListener is the interface that will be implemented by android and iOS implementations. These implementations will notify an activity or screen that the state has changed and they should reflect that.

Reviewed By: danielbuechele

Differential Revision: D9150551

fbshipit-source-id: 8dd585ca503d32e684ff843d66a59a50a420b4c0
2018-08-07 09:59:26 -07:00

26 lines
484 B
C++

/*
* Copyright (c) 2018-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*
*/
#include "SonarStep.h"
#include "SonarState.h"
void SonarStep::complete() {
isCompleted = true;
state->success(name);
}
SonarStep::SonarStep(std::string step, SonarState* s) {
state = s;
name = step;
}
SonarStep::~SonarStep() {
if (!isCompleted) {
state->failed(name, "");
}
}