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
@@ -6,14 +6,14 @@
|
||||
*/
|
||||
|
||||
#if FB_SONARKIT_ENABLED
|
||||
#import <vector>
|
||||
#import "FlipperKitNetworkPlugin.h"
|
||||
#import <iostream>
|
||||
#import <memory>
|
||||
#import "FlipperKitNetworkPlugin.h"
|
||||
#import "SKNetworkReporter.h"
|
||||
#import "SonarKitNetworkPlugin+CPPInitialization.h"
|
||||
#import <vector>
|
||||
#import "SKBufferingPlugin+CPPInitialization.h"
|
||||
#import "SKDispatchQueue.h"
|
||||
#import "SKNetworkReporter.h"
|
||||
#import "SonarKitNetworkPlugin+CPPInitialization.h"
|
||||
|
||||
@interface FlipperKitNetworkPlugin ()
|
||||
|
||||
@@ -27,20 +27,26 @@
|
||||
}
|
||||
|
||||
- (instancetype)init {
|
||||
if (self = [super initWithQueue:dispatch_queue_create("com.sonarkit.network.buffer", DISPATCH_QUEUE_SERIAL)]) {
|
||||
if (self = [super initWithQueue:dispatch_queue_create(
|
||||
"com.sonarkit.network.buffer",
|
||||
DISPATCH_QUEUE_SERIAL)]) {
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (instancetype)initWithNetworkAdapter:(id<SKNetworkAdapterDelegate>)adapter {
|
||||
if (self = [super initWithQueue:dispatch_queue_create("com.sonarkit.network.buffer", DISPATCH_QUEUE_SERIAL)]) {
|
||||
if (self = [super initWithQueue:dispatch_queue_create(
|
||||
"com.sonarkit.network.buffer",
|
||||
DISPATCH_QUEUE_SERIAL)]) {
|
||||
adapter.delegate = self;
|
||||
_adapter = adapter;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (instancetype)initWithNetworkAdapter:(id<SKNetworkAdapterDelegate>)adapter queue:(dispatch_queue_t)queue; {
|
||||
- (instancetype)initWithNetworkAdapter:(id<SKNetworkAdapterDelegate>)adapter
|
||||
queue:(dispatch_queue_t)queue;
|
||||
{
|
||||
if (self = [super initWithQueue:queue]) {
|
||||
adapter.delegate = self;
|
||||
_adapter = adapter;
|
||||
@@ -50,68 +56,65 @@
|
||||
|
||||
#pragma mark - SKNetworkReporterDelegate
|
||||
|
||||
|
||||
- (void)didObserveRequest:(SKRequestInfo *)request
|
||||
{
|
||||
NSMutableArray<NSDictionary<NSString *, id> *> *headers = [NSMutableArray new];
|
||||
for (NSString *key in [request.request.allHTTPHeaderFields allKeys]) {
|
||||
NSDictionary<NSString *, id> *header = @{
|
||||
@"key": key,
|
||||
@"value": request.request.allHTTPHeaderFields[key]
|
||||
};
|
||||
[headers addObject: header];
|
||||
- (void)didObserveRequest:(SKRequestInfo*)request {
|
||||
NSMutableArray<NSDictionary<NSString*, id>*>* headers = [NSMutableArray new];
|
||||
for (NSString* key in [request.request.allHTTPHeaderFields allKeys]) {
|
||||
NSDictionary<NSString*, id>* header =
|
||||
@{@"key" : key, @"value" : request.request.allHTTPHeaderFields[key]};
|
||||
[headers addObject:header];
|
||||
}
|
||||
|
||||
NSString *body = request.body;
|
||||
NSString* body = request.body;
|
||||
|
||||
[self send:@"newRequest"
|
||||
sonarObject:@{
|
||||
@"id": @(request.identifier),
|
||||
@"timestamp": @(request.timestamp),
|
||||
@"method": request.request.HTTPMethod ?: [NSNull null],
|
||||
@"url": [request.request.URL absoluteString] ?: [NSNull null],
|
||||
@"headers": headers,
|
||||
@"data": body ? body : [NSNull null]
|
||||
}];
|
||||
sonarObject:@{
|
||||
@"id" : @(request.identifier),
|
||||
@"timestamp" : @(request.timestamp),
|
||||
@"method" : request.request.HTTPMethod ?: [NSNull null],
|
||||
@"url" : [request.request.URL absoluteString] ?: [NSNull null],
|
||||
@"headers" : headers,
|
||||
@"data" : body ? body : [NSNull null]
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)didObserveResponse:(SKResponseInfo *)response
|
||||
{
|
||||
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse*)response.response;
|
||||
- (void)didObserveResponse:(SKResponseInfo*)response {
|
||||
NSHTTPURLResponse* httpResponse = (NSHTTPURLResponse*)response.response;
|
||||
|
||||
NSMutableArray<NSDictionary<NSString *, id> *> *headers = [NSMutableArray new];
|
||||
for (NSString *key in [httpResponse.allHeaderFields allKeys]) {
|
||||
NSDictionary<NSString *, id> *header = @{
|
||||
@"key": key,
|
||||
@"value": httpResponse.allHeaderFields[key]
|
||||
};
|
||||
[headers addObject: header];
|
||||
NSMutableArray<NSDictionary<NSString*, id>*>* headers = [NSMutableArray new];
|
||||
for (NSString* key in [httpResponse.allHeaderFields allKeys]) {
|
||||
NSDictionary<NSString*, id>* header =
|
||||
@{@"key" : key, @"value" : httpResponse.allHeaderFields[key]};
|
||||
[headers addObject:header];
|
||||
}
|
||||
|
||||
NSString *body = response.body;
|
||||
NSString* body = response.body;
|
||||
|
||||
[self send:@"newResponse"
|
||||
sonarObject:@{
|
||||
@"id": @(response.identifier),
|
||||
@"timestamp": @(response.timestamp),
|
||||
@"status": @(httpResponse.statusCode),
|
||||
@"reason": [NSHTTPURLResponse localizedStringForStatusCode: httpResponse.statusCode] ?: [NSNull null],
|
||||
@"headers": headers,
|
||||
@"data": body ? body : [NSNull null]
|
||||
}];
|
||||
|
||||
sonarObject:@{
|
||||
@"id" : @(response.identifier),
|
||||
@"timestamp" : @(response.timestamp),
|
||||
@"status" : @(httpResponse.statusCode),
|
||||
@"reason" : [NSHTTPURLResponse
|
||||
localizedStringForStatusCode:httpResponse.statusCode]
|
||||
?: [NSNull null],
|
||||
@"headers" : headers,
|
||||
@"data" : body ? body : [NSNull null]
|
||||
}];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation FlipperKitNetworkPlugin (CPPInitialization)
|
||||
|
||||
- (instancetype)initWithNetworkAdapter:(id<SKNetworkAdapterDelegate>)adapter dispatchQueue:(std::shared_ptr<facebook::flipper::DispatchQueue>)queue {
|
||||
if (self = [super initWithDispatchQueue:queue]) {
|
||||
adapter.delegate = self;
|
||||
_adapter = adapter;
|
||||
}
|
||||
return self;
|
||||
- (instancetype)initWithNetworkAdapter:(id<SKNetworkAdapterDelegate>)adapter
|
||||
dispatchQueue:
|
||||
(std::shared_ptr<facebook::flipper::DispatchQueue>)
|
||||
queue {
|
||||
if (self = [super initWithDispatchQueue:queue]) {
|
||||
adapter.delegate = self;
|
||||
_adapter = adapter;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user