Run CLANGFORMAT on FlipperKit folder
Summary: This diff runs CLANGFORMAT lint on FlipperKit. I have added CLANGFORMAT as the lint engined for objc files in xplat/sonar. Right now the iOS folder is not formatted according to CLANGFORMAT. Ran `arc lint -a --paths-cmd "find ./iOS/FlipperKit -type f" --verbose` Reviewed By: passy Differential Revision: D19942170 fbshipit-source-id: af677323af4edb761f61f8f7e289cab743aa31f2
This commit is contained in:
committed by
Facebook Github Bot
parent
127eec5fa1
commit
ca513cf370
@@ -12,10 +12,11 @@
|
||||
|
||||
#define STATE_VIEW_HEIGHT 300
|
||||
|
||||
static NSString *const kSKCellIdentifier = @"FlipperDiagnosticStateTableStableCellIdentifier";
|
||||
static NSString* const kSKCellIdentifier =
|
||||
@"FlipperDiagnosticStateTableStableCellIdentifier";
|
||||
|
||||
@implementation StateTableDataSource
|
||||
- (instancetype)initWithElements:(NSArray<NSDictionary *> *)elements {
|
||||
- (instancetype)initWithElements:(NSArray<NSDictionary*>*)elements {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_elements = elements;
|
||||
@@ -23,16 +24,21 @@ static NSString *const kSKCellIdentifier = @"FlipperDiagnosticStateTableStableCe
|
||||
return self;
|
||||
}
|
||||
|
||||
- (nonnull UITableViewCell *)tableView:(nonnull UITableView *)tableView cellForRowAtIndexPath:(nonnull NSIndexPath *)indexPath {
|
||||
- (nonnull UITableViewCell*)tableView:(nonnull UITableView*)tableView
|
||||
cellForRowAtIndexPath:(nonnull NSIndexPath*)indexPath {
|
||||
NSInteger row = indexPath.row;
|
||||
|
||||
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kSKCellIdentifier forIndexPath:indexPath];
|
||||
UITableViewCell* cell =
|
||||
[tableView dequeueReusableCellWithIdentifier:kSKCellIdentifier
|
||||
forIndexPath:indexPath];
|
||||
cell.textLabel.font = [UIFont fontWithName:@"Arial" size:10];
|
||||
cell.textLabel.text = [self.elements[row][@"state"] stringByAppendingString:self.elements[row][@"name"]];
|
||||
cell.textLabel.text = [self.elements[row][@"state"]
|
||||
stringByAppendingString:self.elements[row][@"name"]];
|
||||
return cell;
|
||||
}
|
||||
|
||||
- (NSInteger)tableView:(nonnull UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
||||
- (NSInteger)tableView:(nonnull UITableView*)tableView
|
||||
numberOfRowsInSection:(NSInteger)section {
|
||||
return [self.elements count];
|
||||
}
|
||||
|
||||
@@ -43,16 +49,30 @@ static NSString *const kSKCellIdentifier = @"FlipperDiagnosticStateTableStableCe
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
|
||||
self.scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, STATE_VIEW_HEIGHT, self.view.frame.size.width, self.view.frame.size.height - 100 - STATE_VIEW_HEIGHT)];
|
||||
self.logLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.scrollView.frame.size.height)];
|
||||
self.scrollView = [[UIScrollView alloc]
|
||||
initWithFrame:CGRectMake(
|
||||
0,
|
||||
STATE_VIEW_HEIGHT,
|
||||
self.view.frame.size.width,
|
||||
self.view.frame.size.height - 100 - STATE_VIEW_HEIGHT)];
|
||||
self.logLabel =
|
||||
[[UILabel alloc] initWithFrame:CGRectMake(
|
||||
0,
|
||||
0,
|
||||
self.view.frame.size.width,
|
||||
self.scrollView.frame.size.height)];
|
||||
self.logLabel.numberOfLines = 0;
|
||||
self.logLabel.font = [UIFont fontWithName:@"Arial" size:10];
|
||||
[self.scrollView addSubview:self.logLabel];
|
||||
|
||||
self.stateTable = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, STATE_VIEW_HEIGHT)];
|
||||
[self.stateTable registerClass:[UITableViewCell class] forCellReuseIdentifier:kSKCellIdentifier];
|
||||
self.stateTable = [[UITableView alloc]
|
||||
initWithFrame:CGRectMake(
|
||||
0, 0, self.view.bounds.size.width, STATE_VIEW_HEIGHT)];
|
||||
[self.stateTable registerClass:[UITableViewCell class]
|
||||
forCellReuseIdentifier:kSKCellIdentifier];
|
||||
self.stateTable.rowHeight = 14;
|
||||
self.tableDataSource = [[StateTableDataSource alloc] initWithElements:[[FlipperClient sharedClient] getStateElements]];
|
||||
self.tableDataSource = [[StateTableDataSource alloc]
|
||||
initWithElements:[[FlipperClient sharedClient] getStateElements]];
|
||||
self.stateTable.dataSource = self.tableDataSource;
|
||||
|
||||
[self updateLogView];
|
||||
@@ -63,7 +83,7 @@ static NSString *const kSKCellIdentifier = @"FlipperDiagnosticStateTableStableCe
|
||||
}
|
||||
|
||||
- (void)onUpdate {
|
||||
FlipperDiagnosticsViewController __weak *weakSelf = self;
|
||||
FlipperDiagnosticsViewController __weak* weakSelf = self;
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
[weakSelf updateStateTable];
|
||||
[weakSelf updateLogView];
|
||||
@@ -71,18 +91,21 @@ static NSString *const kSKCellIdentifier = @"FlipperDiagnosticStateTableStableCe
|
||||
}
|
||||
|
||||
- (void)updateStateTable {
|
||||
self.tableDataSource.elements = [[FlipperClient sharedClient] getStateElements];
|
||||
self.tableDataSource.elements =
|
||||
[[FlipperClient sharedClient] getStateElements];
|
||||
[self.stateTable reloadData];
|
||||
}
|
||||
|
||||
- (void)updateLogView {
|
||||
NSString *state = [[FlipperClient sharedClient] getState];
|
||||
NSString* state = [[FlipperClient sharedClient] getState];
|
||||
self.logLabel.text = state;
|
||||
[self.logLabel sizeToFit];
|
||||
self.scrollView.contentSize = self.logLabel.frame.size;
|
||||
|
||||
// Scroll to bottom
|
||||
CGPoint bottomOffset = CGPointMake(0, self.scrollView.contentSize.height - self.scrollView.bounds.size.height);
|
||||
CGPoint bottomOffset = CGPointMake(
|
||||
0,
|
||||
self.scrollView.contentSize.height - self.scrollView.bounds.size.height);
|
||||
[self.scrollView setContentOffset:bottomOffset animated:YES];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user