mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
35f982c00b |
@@ -66,7 +66,7 @@ void RCTMessageThread::runSync(std::function<void()> func)
|
||||
void RCTMessageThread::tryFunc(const std::function<void()> &func)
|
||||
{
|
||||
NSError *error = tryAndReturnError(func);
|
||||
if (error) {
|
||||
if (error != nullptr) {
|
||||
m_errorBlock(error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ class RCTObjcExecutor : public JSExecutor {
|
||||
: m_jse(jse), m_errorBlock(errorBlock), m_delegate(std::move(delegate)), m_jsThread(std::move(jsThread))
|
||||
{
|
||||
m_jsCallback = ^(id json, NSError *error) {
|
||||
if (error) {
|
||||
if (error != nullptr) {
|
||||
// Do not use "m_errorBlock" here as the bridge might be in the middle
|
||||
// of invalidation as a result of error handling and "this" can be
|
||||
// already deallocated.
|
||||
@@ -81,7 +81,7 @@ class RCTObjcExecutor : public JSExecutor {
|
||||
onComplete:^(NSError *error) {
|
||||
RCTProfileEndFlowEvent();
|
||||
|
||||
if (error) {
|
||||
if (error != nullptr) {
|
||||
m_errorBlock(error);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ using namespace facebook::react;
|
||||
|
||||
- (instancetype)initWithCxxMethod:(const CxxModule::Method &)method
|
||||
{
|
||||
if ((self = [super init])) {
|
||||
if ((self = [super init]) != nullptr) {
|
||||
_method = std::make_unique<CxxModule::Method>(method);
|
||||
}
|
||||
return self;
|
||||
|
||||
@@ -76,7 +76,7 @@ folly::dynamic RCTNativeModule::getConstants()
|
||||
void RCTNativeModule::invoke(unsigned int methodId, folly::dynamic &¶ms, int callId)
|
||||
{
|
||||
id<RCTBridgeMethod> method = m_moduleData.methods[methodId];
|
||||
if (method) {
|
||||
if (method != nullptr) {
|
||||
RCT_PROFILE_BEGIN_EVENT(
|
||||
RCTProfileTagAlways,
|
||||
@"[RCTNativeModule invoke]",
|
||||
@@ -119,13 +119,13 @@ void RCTNativeModule::invoke(unsigned int methodId, folly::dynamic &¶ms, int
|
||||
if (isSyncModule) {
|
||||
block();
|
||||
BridgeNativeModulePerfLogger::syncMethodCallReturnConversionEnd(moduleName, methodName);
|
||||
} else if (queue) {
|
||||
} else if (queue != nullptr) {
|
||||
BridgeNativeModulePerfLogger::asyncMethodCallDispatch(moduleName, methodName);
|
||||
dispatch_async(queue, block);
|
||||
}
|
||||
|
||||
#ifdef RCT_DEV
|
||||
if (!queue) {
|
||||
if (queue == nullptr) {
|
||||
RCTLog(
|
||||
@"Attempted to invoke `%u` (method ID) on `%@` (NativeModule name) without a method queue.",
|
||||
methodId,
|
||||
@@ -153,7 +153,7 @@ static MethodCallResult invokeInner(
|
||||
int callId,
|
||||
SchedulingContext context)
|
||||
{
|
||||
if (!bridge || !bridge.valid || !moduleData) {
|
||||
if ((bridge == nullptr) || !bridge.valid || (moduleData == nullptr)) {
|
||||
if (context == Sync) {
|
||||
/**
|
||||
* NOTE: moduleName and methodName are "". This shouldn't be an issue because there can only be one ongoing sync
|
||||
@@ -166,7 +166,7 @@ static MethodCallResult invokeInner(
|
||||
}
|
||||
|
||||
id<RCTBridgeMethod> method = moduleData.methods[methodId];
|
||||
if (RCT_DEBUG && !method) {
|
||||
if (RCT_DEBUG && (method == nullptr)) {
|
||||
RCTLogError(@"Unknown methodID: %ud for module: %@", methodId, moduleData.name);
|
||||
}
|
||||
|
||||
|
||||
@@ -24,14 +24,14 @@ static NSString *getServerHost(NSURL *bundleURL)
|
||||
{
|
||||
NSNumber *port = @8081;
|
||||
NSString *portStr = [[[NSProcessInfo processInfo] environment] objectForKey:@"RCT_METRO_PORT"];
|
||||
if (portStr && [portStr length] > 0) {
|
||||
if ((portStr != nullptr) && [portStr length] > 0) {
|
||||
port = [NSNumber numberWithInt:[portStr intValue]];
|
||||
}
|
||||
if ([bundleURL port]) {
|
||||
if ([bundleURL port] != nullptr) {
|
||||
port = [bundleURL port];
|
||||
}
|
||||
NSString *host = [bundleURL host];
|
||||
if (!host) {
|
||||
if (host == nullptr) {
|
||||
host = @"localhost";
|
||||
}
|
||||
|
||||
@@ -186,7 +186,7 @@ static void sendEventToAllConnections(NSString *event)
|
||||
|
||||
NSString *key = [inspectorURL absoluteString];
|
||||
id<RCTInspectorPackagerConnectionProtocol> connection = socketConnections[key];
|
||||
if (!connection || !connection.isConnected) {
|
||||
if ((connection == nullptr) || !connection.isConnected) {
|
||||
connection = [[RCTCxxInspectorPackagerConnection alloc] initWithURL:inspectorURL];
|
||||
|
||||
socketConnections[key] = connection;
|
||||
|
||||
@@ -21,7 +21,7 @@ using ListenerBlock = void (^)(RCTInspectorNetworkListener *);
|
||||
- (instancetype)init
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
if (self != nullptr) {
|
||||
NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration];
|
||||
self.session = [NSURLSession sessionWithConfiguration:configuration delegate:self delegateQueue:nil];
|
||||
self.executorsByTaskId = [NSMutableDictionary new];
|
||||
@@ -63,7 +63,7 @@ using ListenerBlock = void (^)(RCTInspectorNetworkListener *);
|
||||
- (void)withListenerForTask:(NSURLSessionTask *)task execute:(ListenerBlock)block
|
||||
{
|
||||
void (^executor)(ListenerBlock) = self.executorsByTaskId[@(task.taskIdentifier)];
|
||||
if (executor) {
|
||||
if (executor != nullptr) {
|
||||
executor(block);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@
|
||||
if (_alertWindow == nil) {
|
||||
_alertWindow = [[UIWindow alloc] initWithWindowScene:RCTKeyWindow().windowScene];
|
||||
|
||||
if (_alertWindow) {
|
||||
if (_alertWindow != nullptr) {
|
||||
_alertWindow.rootViewController = [UIViewController new];
|
||||
_alertWindow.windowLevel = UIWindowLevelAlert + 1;
|
||||
}
|
||||
|
||||
+2
-2
@@ -17,7 +17,7 @@
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
if (!(self = [super init])) {
|
||||
if ((self = [super init]) == nullptr) {
|
||||
return nil;
|
||||
}
|
||||
_touchHandler = [RCTSurfaceTouchHandler new];
|
||||
@@ -61,7 +61,7 @@
|
||||
{
|
||||
UIInterfaceOrientationMask appSupportedOrientationsMask =
|
||||
[RCTSharedApplication() supportedInterfaceOrientationsForWindow:RCTKeyWindow()];
|
||||
if (!(_supportedInterfaceOrientations & appSupportedOrientationsMask)) {
|
||||
if ((_supportedInterfaceOrientations & appSupportedOrientationsMask) == 0u) {
|
||||
RCTLogError(
|
||||
@"Modal was presented with 0x%x orientations mask but the application only supports 0x%x."
|
||||
@"Add more interface orientations to your app's Info.plist to fix this."
|
||||
|
||||
Reference in New Issue
Block a user