Build sample app through BUCK
Summary: This diff adds capabilty to build sample app through BUCK. Reviewed By: passy Differential Revision: D13697307 fbshipit-source-id: d7008bb4709b13384f65051631b365a0eceddfff
This commit is contained in:
committed by
Facebook Github Bot
parent
21dfe41fb4
commit
f47de92117
@@ -8,8 +8,8 @@
|
||||
#if FB_SONARKIT_ENABLED
|
||||
|
||||
#import "SKIOSNetworkAdapter.h"
|
||||
#import "FLEXNetworkObserver.h"
|
||||
#import "FLEXNetworkRecorder.h"
|
||||
#import "FLEXNetworkLib/FLEXNetworkObserver.h"
|
||||
#import "FLEXNetworkLib/FLEXNetworkRecorder.h"
|
||||
|
||||
@implementation SKIOSNetworkAdapter
|
||||
@synthesize delegate = _delegate;
|
||||
|
||||
@@ -41,21 +41,21 @@
|
||||
[[self sharedInstance] swizzleSelector:selector class:aClass block:block];
|
||||
}
|
||||
|
||||
- (void)swizzleSelector:(SEL)selector class:(Class)aClass block:(void (^)(NSInvocation * _Nonnull))block {
|
||||
- (void)swizzleSelector:(SEL)selector class:(Class)aClass block:(void (^)(NSInvocation * _Nonnull))blk {
|
||||
if (![self.swizzledClasses containsObject:aClass]) {
|
||||
SEL fwdSel = @selector(forwardInvocation:);
|
||||
Method m = class_getInstanceMethod(aClass, fwdSel);
|
||||
__block IMP orig;
|
||||
__weak typeof(self) weakSelf = self;
|
||||
IMP imp = imp_implementationWithBlock(^(id self, NSInvocation *invocation) {
|
||||
IMP imp = imp_implementationWithBlock(^(id this, NSInvocation *invocation) {
|
||||
NSString * selStr = NSStringFromSelector([invocation selector]);
|
||||
void (^block)(NSInvocation *) = weakSelf.swizzledBlocks[aClass][selStr];
|
||||
if (block != nil) {
|
||||
if (blk != nil) {
|
||||
NSString *originalStr = [@"comfacebookFlipperKit_" stringByAppendingString:selStr];
|
||||
[invocation setSelector:NSSelectorFromString(originalStr)];
|
||||
block(invocation);
|
||||
} else {
|
||||
((void (*)(id, SEL, NSInvocation *))orig)(self, fwdSel, invocation);
|
||||
((void (*)(id, SEL, NSInvocation *))orig)(this, fwdSel, invocation);
|
||||
}
|
||||
});
|
||||
orig = method_setImplementation(m, imp);
|
||||
@@ -66,7 +66,7 @@
|
||||
classDict = [NSMutableDictionary dictionary];
|
||||
self.swizzledBlocks[(id)aClass] = classDict;
|
||||
}
|
||||
classDict[NSStringFromSelector(selector)] = block;
|
||||
classDict[NSStringFromSelector(selector)] = blk;
|
||||
Method m = class_getInstanceMethod(aClass, selector);
|
||||
NSString *newSelStr = [@"comfacebookFlipperKit_" stringByAppendingString:NSStringFromSelector(selector)];
|
||||
SEL newSel = NSSelectorFromString(newSelStr);
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>Sample</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
|
||||
@@ -42,14 +42,14 @@
|
||||
[urlRequest setHTTPBody:postData];
|
||||
[urlRequest setHTTPMethod:@"POST"];
|
||||
__weak NetworkViewController *weakSelf = self;
|
||||
[[[NSURLSession sharedSession] dataTaskWithRequest:urlRequest completionHandler:^(NSData *_Nullable data, NSURLResponse *_Nullable response, NSError *_Nullable error) {
|
||||
[[[NSURLSession sharedSession] dataTaskWithRequest:urlRequest completionHandler:^(NSData *_Nullable data, NSURLResponse *_Nullable response, NSError *_Nullable dataTaskError) {
|
||||
|
||||
if (error || !data) {
|
||||
if (dataTaskError || !data) {
|
||||
UIAlertController *alertController = [weakSelf alertControllerForMessage:@"Received error in POST API response"];
|
||||
[weakSelf presentViewController:alertController animated:true completion:nil];
|
||||
return;
|
||||
}
|
||||
NSDictionary *dict = [NSJSONSerialization JSONObjectWithData:data options:0 error:&error];
|
||||
NSDictionary *dict = [NSJSONSerialization JSONObjectWithData:data options:0 error:&dataTaskError];
|
||||
NSLog(@"MSG-POST: %@", dict[@"msg"]);
|
||||
|
||||
UIAlertController *alertController = [weakSelf alertControllerForMessage:@"Received response from POST API"];
|
||||
|
||||
Reference in New Issue
Block a user