Rename SonarKitLayoutPlugin to FlipperKitLayoutPlugin

Summary: Renames SonarKitLayoutPlugin to FlipperKitLayoutPlugin

Reviewed By: passy

Differential Revision: D9949785

fbshipit-source-id: 8cfde4dfad3e34038d2f66f0ce4393db9d83ef60
This commit is contained in:
Pritesh Nandgaonkar
2018-09-20 04:27:10 -07:00
committed by Facebook Github Bot
parent 04efc06f6a
commit ba7b43a547
73 changed files with 65 additions and 65 deletions

View File

@@ -0,0 +1,11 @@
/*
* Copyright (c) 2018-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*
*/
#import <UIKit/UIKit.h>
@interface SKHiddenWindow : UIWindow
@end

View File

@@ -0,0 +1,16 @@
/*
* Copyright (c) 2018-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*
*/
#if FB_SONARKIT_ENABLED
#import "SKHiddenWindow.h"
@implementation SKHiddenWindow
@end
#endif

View File

@@ -0,0 +1,19 @@
/*
* Copyright (c) 2018-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*
*/
#import <Foundation/Foundation.h>
/*
A hash function is needed in order to use NSObject classes
as keys in C++ STL
*/
class SKObjectHash {
public:
size_t operator()(const NSObject *x) const {
return (size_t)[x hash];
}
};

View File

@@ -0,0 +1,10 @@
/*
* Copyright (c) 2018-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*
*/
#import <Foundation/Foundation.h>
void swizzleMethods(Class cls, SEL original, SEL swissled);

View File

@@ -0,0 +1,32 @@
/*
* Copyright (c) 2018-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*
*/
#if FB_SONARKIT_ENABLED
#import "SKSwizzle.h"
#import <Foundation/Foundation.h>
#import <objc/runtime.h>
void swizzleMethods(Class cls, SEL original, SEL swissled) {
Method originalMethod = class_getInstanceMethod(cls, original);
Method swissledMethod = class_getInstanceMethod(cls, swissled);
BOOL didAddMethod = class_addMethod(cls, original,
method_getImplementation(swissledMethod),
method_getTypeEncoding(swissledMethod));
if (didAddMethod) {
class_replaceMethod(cls, swissled,
method_getImplementation(originalMethod),
method_getTypeEncoding(originalMethod));
} else {
method_exchangeImplementations(originalMethod, swissledMethod);
}
}
#endif

View File

@@ -0,0 +1,31 @@
/*
* Copyright (c) 2018-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the LICENSE
* file in the root directory of this source tree.
*
*/
#import <Foundation/Foundation.h>
#define APPLY_ENUM_TO_YOGA_PROPERTY(varName, enumName) \
^(NSString *newValue) { \
NSNumber *varName = [[enumName##EnumMap allKeysForObject:newValue] lastObject]; \
if (varName == nil) { return; } \
node.yoga.varName = (enumName)[varName unsignedIntegerValue]; \
}
#define APPLY_VALUE_TO_YGVALUE(varName) \
^(NSNumber *value) { \
YGValue newValue = node.yoga.varName; \
newValue.value = [value floatValue]; \
node.yoga.varName = newValue; \
}
#define APPLY_UNIT_TO_YGVALUE(varName, enumName) \
^(NSString *value) { \
NSNumber *varName = [[enumName##EnumMap allKeysForObject:value] lastObject]; \
if (varName == nil) { return; } \
YGValue newValue = node.yoga.varName; \
newValue.unit = (enumName)[varName unsignedIntegerValue]; \
node.yoga.varName = newValue; \
}