Run CLANGFORMAT on sample

Summary: This diff runs CLANGFORMAT lint on sample. 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.

Reviewed By: passy

Differential Revision: D19942174

fbshipit-source-id: bef3e67bf31f13bb52417c81c4c330d6c258872d
This commit is contained in:
Pritesh Nandgaonkar
2020-02-17 10:46:43 -08:00
committed by Facebook Github Bot
parent e8b20d5b15
commit 0e4250b4af
9 changed files with 236 additions and 181 deletions

View File

@@ -8,49 +8,54 @@
#import "CommunicationDemoViewController.h"
#import <FlipperKitExamplePlugin/FlipperKitExamplePlugin.h>
@interface CommunicationDemoViewController()<FlipperKitExampleCommunicationResponderDelegate>
@property (strong, nonatomic) NSMutableArray<NSString *> *messagesToDisplay;
@property (weak, nonatomic) IBOutlet UITextField *messageTextField;
@property (weak, nonatomic) IBOutlet UITableView *tableView;
@interface CommunicationDemoViewController ()<
FlipperKitExampleCommunicationResponderDelegate>
@property(strong, nonatomic) NSMutableArray<NSString*>* messagesToDisplay;
@property(weak, nonatomic) IBOutlet UITextField* messageTextField;
@property(weak, nonatomic) IBOutlet UITableView* tableView;
@end
@implementation CommunicationDemoViewController
- (void)viewDidLoad {
[super viewDidLoad];
[FlipperKitExamplePlugin sharedInstance].delegate = self;
[super viewDidLoad];
[FlipperKitExamplePlugin sharedInstance].delegate = self;
}
- (IBAction)tappedTriggerNotification:(UIButton *)sender {
[[FlipperKitExamplePlugin sharedInstance] triggerNotification];
- (IBAction)tappedTriggerNotification:(UIButton*)sender {
[[FlipperKitExamplePlugin sharedInstance] triggerNotification];
}
- (IBAction)tappedSendMessage:(UIButton *)sender {
if (self.messageTextField.text.length > 0) {
[[FlipperKitExamplePlugin sharedInstance] sendMessage:self.messageTextField.text];
}
}
- (nonnull UITableViewCell *)tableView:(nonnull UITableView *)tableView cellForRowAtIndexPath:(nonnull NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"reusableCell"];
cell.textLabel.text = self.messagesToDisplay[indexPath.row];
return cell;
}
- (NSInteger)tableView:(nonnull UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return self.messagesToDisplay.count;
}
- (void)messageReceived:(NSString *)msg {
if (msg) {
if (!self.messagesToDisplay) {
self.messagesToDisplay = @[].mutableCopy;
}
[self.messagesToDisplay addObject:msg];
dispatch_async(dispatch_get_main_queue(), ^{
[self.tableView reloadData];
});
- (IBAction)tappedSendMessage:(UIButton*)sender {
if (self.messageTextField.text.length > 0) {
[[FlipperKitExamplePlugin sharedInstance]
sendMessage:self.messageTextField.text];
}
}
- (nonnull UITableViewCell*)tableView:(nonnull UITableView*)tableView
cellForRowAtIndexPath:(nonnull NSIndexPath*)indexPath {
UITableViewCell* cell =
[tableView dequeueReusableCellWithIdentifier:@"reusableCell"];
cell.textLabel.text = self.messagesToDisplay[indexPath.row];
return cell;
}
- (NSInteger)tableView:(nonnull UITableView*)tableView
numberOfRowsInSection:(NSInteger)section {
return self.messagesToDisplay.count;
}
- (void)messageReceived:(NSString*)msg {
if (msg) {
if (!self.messagesToDisplay) {
self.messagesToDisplay = @[].mutableCopy;
}
[self.messagesToDisplay addObject:msg];
dispatch_async(dispatch_get_main_queue(), ^{
[self.tableView reloadData];
});
}
}
@end