Run CLANGFORMAT on plugins
Summary: This diff runs CLANGFORMAT lint on plugins. 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/Plugins -type f" --verbose` Reviewed By: passy Differential Revision: D19942173 fbshipit-source-id: 8b975b0a344df073b02d69cd1f9ee5629af2799d
This commit is contained in:
committed by
Facebook Github Bot
parent
a19a430eee
commit
e8b20d5b15
@@ -5,19 +5,20 @@
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <FlipperKit/FlipperPlugin.h>
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@protocol FlipperKitExampleCommunicationResponderDelegate
|
||||
- (void)messageReceived:(NSString *)msg;
|
||||
- (void)messageReceived:(NSString*)msg;
|
||||
@end
|
||||
|
||||
@interface FlipperKitExamplePlugin : NSObject<FlipperPlugin>
|
||||
@property (weak, nonatomic) id<FlipperKitExampleCommunicationResponderDelegate> delegate;
|
||||
@property(weak, nonatomic) id<FlipperKitExampleCommunicationResponderDelegate>
|
||||
delegate;
|
||||
|
||||
- (instancetype)init NS_UNAVAILABLE;
|
||||
- (void)sendMessage:(NSString *)msg;
|
||||
- (void)sendMessage:(NSString*)msg;
|
||||
- (void)triggerNotification;
|
||||
+ (instancetype) sharedInstance;
|
||||
+ (instancetype)sharedInstance;
|
||||
|
||||
@end
|
||||
|
||||
@@ -11,60 +11,62 @@
|
||||
#import <FlipperKit/FlipperConnection.h>
|
||||
#import <FlipperKit/FlipperResponder.h>
|
||||
|
||||
@interface FlipperKitExamplePlugin()
|
||||
@property (strong, nonatomic) id<FlipperConnection> connection;
|
||||
@property (nonatomic) NSInteger triggerCount;
|
||||
@interface FlipperKitExamplePlugin ()
|
||||
@property(strong, nonatomic) id<FlipperConnection> connection;
|
||||
@property(nonatomic) NSInteger triggerCount;
|
||||
|
||||
@end
|
||||
|
||||
@implementation FlipperKitExamplePlugin
|
||||
|
||||
- (instancetype)init {
|
||||
if (self = [super init]) {
|
||||
_triggerCount = 0;
|
||||
}
|
||||
return self;
|
||||
if (self = [super init]) {
|
||||
_triggerCount = 0;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
+ (instancetype)sharedInstance {
|
||||
static FlipperKitExamplePlugin *sInstance = nil;
|
||||
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
sInstance = [FlipperKitExamplePlugin new];
|
||||
});
|
||||
|
||||
return sInstance;
|
||||
static FlipperKitExamplePlugin* sInstance = nil;
|
||||
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
sInstance = [FlipperKitExamplePlugin new];
|
||||
});
|
||||
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
- (void)didConnect:(id<FlipperConnection>)connection {
|
||||
__weak FlipperKitExamplePlugin *weakSelf = self;
|
||||
self.connection = connection;
|
||||
[connection receive:@"displayMessage" withBlock:^(NSDictionary *params, id<FlipperResponder> responder) {
|
||||
[weakSelf.delegate messageReceived:params[@"message"]];
|
||||
[responder success:@{@"greeting": @"Hello"}];
|
||||
}];
|
||||
__weak FlipperKitExamplePlugin* weakSelf = self;
|
||||
self.connection = connection;
|
||||
[connection receive:@"displayMessage"
|
||||
withBlock:^(NSDictionary* params, id<FlipperResponder> responder) {
|
||||
[weakSelf.delegate messageReceived:params[@"message"]];
|
||||
[responder success:@{@"greeting" : @"Hello"}];
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)didDisconnect {
|
||||
self.connection = nil;
|
||||
self.connection = nil;
|
||||
}
|
||||
|
||||
- (NSString *)identifier {
|
||||
return @"Example";
|
||||
- (NSString*)identifier {
|
||||
return @"Example";
|
||||
}
|
||||
|
||||
- (BOOL)runInBackground {
|
||||
return YES;
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)sendMessage:(NSString *)msg {
|
||||
[self.connection send:@"displayMessage" withParams:@{@"msg": msg}];
|
||||
- (void)sendMessage:(NSString*)msg {
|
||||
[self.connection send:@"displayMessage" withParams:@{@"msg" : msg}];
|
||||
}
|
||||
|
||||
- (void)triggerNotification {
|
||||
[self.connection send:@"triggerNotification" withParams:@{@"id": @(self.triggerCount)}];
|
||||
self.triggerCount++;
|
||||
[self.connection send:@"triggerNotification"
|
||||
withParams:@{@"id" : @(self.triggerCount)}];
|
||||
self.triggerCount++;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user