Summarise state in iOS diagnostics
Summary: V1 ios diagnostics complete. This change adds a new section to the ios diagnostics screen that shows the current state of each step required to get sonar working. The logs (transitions between states) are displayed below it. SonarClient.mm is technically involved in the UI, by converting enums to emojis, I don't like this but didn't get obj-C working with C enums so have left it like this for now. Reviewed By: priteshrnandgaonkar Differential Revision: D9378212 fbshipit-source-id: 091ce00e898a8038c680555123640b90d753fc09
This commit is contained in:
committed by
Facebook Github Bot
parent
364883f661
commit
f99ef6996e
@@ -127,6 +127,37 @@ using WrapperPlugin = facebook::sonar::SonarCppWrapperPlugin;
|
||||
return @(_cppClient->getState().c_str());
|
||||
}
|
||||
|
||||
- (NSArray *)getStateElements {
|
||||
NSMutableArray<NSDictionary<NSString *, NSString *>*> *const array = [NSMutableArray array];
|
||||
|
||||
for (facebook::sonar::StateElement element: _cppClient->getStateElements()) {
|
||||
facebook::sonar::State state = element.state_;
|
||||
NSString *stateString;
|
||||
switch (state) {
|
||||
case facebook::sonar::in_progress:
|
||||
stateString = @"⏳ ";
|
||||
break;
|
||||
|
||||
case facebook::sonar::success:
|
||||
stateString = @"✅ ";
|
||||
break;
|
||||
|
||||
case facebook::sonar::failed:
|
||||
stateString = @"❌ ";
|
||||
break;
|
||||
|
||||
default:
|
||||
stateString = @"❓ ";
|
||||
break;
|
||||
}
|
||||
[array addObject:@{
|
||||
@"name": [NSString stringWithUTF8String:element.name_.c_str()],
|
||||
@"state": stateString
|
||||
}];
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
- (void)subscribeForUpdates:(id<FlipperStateUpdateListener>)controller {
|
||||
auto stateListener = std::make_shared<SKStateUpdateCPPWrapper>(controller);
|
||||
_cppClient->setStateListener(stateListener);
|
||||
|
||||
Reference in New Issue
Block a user