Compare commits

...
1 Commits
Author SHA1 Message Date
CodemodService Bot c74f7e31d4 Fix CQS signal readability-implicit-bool-conversion in xplat/js/react-native-github/packages
Reviewed By: rshest

Differential Revision: D81574342
2025-09-04 02:00:58 -07:00
10 changed files with 37 additions and 37 deletions
@@ -16,7 +16,7 @@
- (instancetype)initWithTag:(NSNumber *)tag config:(NSDictionary<NSString *, id> *)config
{
if ((self = [super init])) {
if ((self = [super init]) != nullptr) {
_nodeTag = tag;
_config = [config copy];
}
@@ -37,10 +37,10 @@ RCT_NOT_IMPLEMENTED(-(instancetype)init)
- (void)addChild:(RCTAnimatedNode *)child
{
if (!_childNodes) {
if (_childNodes == nullptr) {
_childNodes = [NSMapTable strongToWeakObjectsMapTable];
}
if (child) {
if (child != nullptr) {
[_childNodes setObject:child forKey:child.nodeTag];
[child onAttachedToNode:self];
}
@@ -48,10 +48,10 @@ RCT_NOT_IMPLEMENTED(-(instancetype)init)
- (void)removeChild:(RCTAnimatedNode *)child
{
if (!_childNodes) {
if (_childNodes == nullptr) {
return;
}
if (child) {
if (child != nullptr) {
[_childNodes removeObjectForKey:child.nodeTag];
[child onDetachedFromNode:self];
}
@@ -59,20 +59,20 @@ RCT_NOT_IMPLEMENTED(-(instancetype)init)
- (void)onAttachedToNode:(RCTAnimatedNode *)parent
{
if (!_parentNodes) {
if (_parentNodes == nullptr) {
_parentNodes = [NSMapTable strongToWeakObjectsMapTable];
}
if (parent) {
if (parent != nullptr) {
[_parentNodes setObject:parent forKey:parent.nodeTag];
}
}
- (void)onDetachedFromNode:(RCTAnimatedNode *)parent
{
if (!_parentNodes) {
if (_parentNodes == nullptr) {
return;
}
if (parent) {
if (parent != nullptr) {
[_parentNodes removeObjectForKey:parent.nodeTag];
}
}
@@ -86,7 +86,7 @@ NSString *RCTInterpolateString(
- (instancetype)initWithTag:(NSNumber *)tag config:(NSDictionary<NSString *, id> *)config
{
if ((self = [super initWithTag:tag config:config])) {
if ((self = [super initWithTag:tag config:config]) != nullptr) {
_inputRange = config[@"inputRange"];
NSArray *outputRangeConfig = config[@"outputRange"];
@@ -104,7 +104,7 @@ NSString *RCTInterpolateString(
switch (_outputType) {
case RCTInterpolationOutputColor: {
UIColor *color = [RCTConvert UIColor:value];
[outputRange addObject:color ? color : [UIColor whiteColor]];
[outputRange addObject:(color != nullptr) ? color : [UIColor whiteColor]];
break;
}
case RCTInterpolationOutputString:
@@ -141,7 +141,7 @@ NSString *RCTInterpolateString(
- (void)performUpdate
{
[super performUpdate];
if (!_parentNode) {
if (_parentNode == nullptr) {
return;
}
@@ -48,7 +48,7 @@ NSString *const NODE_TAG_KEY = @"nodeTag";
if ([value isKindOfClass:[NSDictionary class]]) {
NSDictionary<NSString *, id> *dict = (NSDictionary *)value;
id nodeTag = [dict objectForKey:NODE_TAG_KEY];
if (nodeTag && [nodeTag isKindOfClass:[NSNumber class]]) {
if ((nodeTag != nullptr) && [nodeTag isKindOfClass:[NSNumber class]]) {
RCTAnimatedNode *node = [self.parentNodes objectForKey:(NSNumber *)nodeTag];
if ([node isKindOfClass:[RCTValueAnimatedNode class]]) {
RCTValueAnimatedNode *valueNode = (RCTValueAnimatedNode *)node;
@@ -18,7 +18,7 @@
- (instancetype)initWithTag:(NSNumber *)tag config:(NSDictionary<NSString *, id> *)config
{
if ((self = [super initWithTag:tag config:config])) {
if ((self = [super initWithTag:tag config:config]) != nullptr) {
_propsDictionary = [NSMutableDictionary new];
}
return self;
@@ -36,11 +36,11 @@
NSDictionary<NSString *, NSNumber *> *style = self.config[@"style"];
[style enumerateKeysAndObjectsUsingBlock:^(NSString *property, NSNumber *nodeTag, __unused BOOL *stop) {
RCTAnimatedNode *node = [self.parentNodes objectForKey:nodeTag];
if (node) {
if (node != nullptr) {
if ([node isKindOfClass:[RCTValueAnimatedNode class]]) {
RCTValueAnimatedNode *valueAnimatedNode = (RCTValueAnimatedNode *)node;
id animatedObject = valueAnimatedNode.animatedObject;
if (animatedObject) {
if (animatedObject != nullptr) {
_propsDictionary[property] = animatedObject;
} else {
_propsDictionary[property] = @(valueAnimatedNode.value);
@@ -18,7 +18,7 @@
- (instancetype)initWithTag:(NSNumber *)tag config:(NSDictionary<NSString *, id> *)config
{
if ((self = [super initWithTag:tag config:config])) {
if ((self = [super initWithTag:tag config:config]) != nullptr) {
_animationId = config[@"animationId"];
_toValueNodeTag = config[@"toValue"];
_valueNodeTag = config[@"value"];
@@ -14,7 +14,7 @@
- (instancetype)initWithTag:(NSNumber *)tag config:(NSDictionary<NSString *, id> *)config
{
if ((self = [super initWithTag:tag config:config])) {
if ((self = [super initWithTag:tag config:config]) != nullptr) {
_propsDictionary = [NSMutableDictionary new];
}
return self;
@@ -59,7 +59,7 @@ static NSString *RCTNormalizeAnimatedEventName(NSString *eventName)
- (instancetype)initWithBridge:(nullable RCTBridge *)bridge
surfacePresenter:(id<RCTSurfacePresenterStub>)surfacePresenter
{
if ((self = [super init])) {
if ((self = [super init]) != nullptr) {
_bridge = bridge;
_surfacePresenter = surfacePresenter;
_animationNodes = [NSMutableDictionary new];
@@ -72,7 +72,7 @@ static NSString *RCTNormalizeAnimatedEventName(NSString *eventName)
- (BOOL)isNodeManagedByFabric:(NSNumber *)tag
{
RCTAnimatedNode *node = _animationNodes[tag];
if (node) {
if (node != nullptr) {
return [node isManagedByFabric];
}
return false;
@@ -106,7 +106,7 @@ static NSString *RCTNormalizeAnimatedEventName(NSString *eventName)
NSString *nodeType = [RCTConvert NSString:config[@"type"]];
Class nodeClass = map[nodeType];
if (!nodeClass) {
if (nodeClass == nullptr) {
RCTLogError(@"Animated node type %@ not supported natively", nodeType);
return;
}
@@ -187,7 +187,7 @@ static NSString *RCTNormalizeAnimatedEventName(NSString *eventName)
- (void)dropAnimatedNode:(NSNumber *)tag
{
RCTAnimatedNode *node = _animationNodes[tag];
if (node) {
if (node != nullptr) {
[node detachNode];
[_animationNodes removeObjectForKey:tag];
}
@@ -345,7 +345,7 @@ static NSString *RCTNormalizeAnimatedEventName(NSString *eventName)
NSNumber *nodeTag = [RCTConvert NSNumber:eventMapping[@"animatedValueTag"]];
RCTAnimatedNode *node = _animationNodes[nodeTag];
if (!node) {
if (node == nullptr) {
RCTLogError(@"Animated node with tag %@ does not exist", nodeTag);
return;
}
@@ -407,7 +407,7 @@ static NSString *RCTNormalizeAnimatedEventName(NSString *eventName)
NSString *key = [NSString stringWithFormat:@"%@%@", event.viewTag, RCTNormalizeAnimatedEventName(event.eventName)];
NSMutableArray<RCTEventAnimation *> *driversForKey = _eventDrivers[key];
if (driversForKey) {
if (driversForKey != nullptr) {
for (RCTEventAnimation *driver in driversForKey) {
[self stopAnimationsForNode:driver.valueNode];
[driver updateWithEvent:event];
@@ -439,7 +439,7 @@ static NSString *RCTNormalizeAnimatedEventName(NSString *eventName)
- (void)startAnimationLoopIfNeeded
{
if (!_displayLink && _activeAnimations.count > 0) {
if ((_displayLink == nullptr) && _activeAnimations.count > 0) {
_displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(stepAnimations:)];
[_displayLink addToRunLoop:[NSRunLoop mainRunLoop] forMode:NSRunLoopCommonModes];
}
@@ -454,7 +454,7 @@ static NSString *RCTNormalizeAnimatedEventName(NSString *eventName)
- (void)stopAnimationLoop
{
if (_displayLink) {
if (_displayLink != nullptr) {
[_displayLink invalidate];
_displayLink = nil;
}
@@ -486,7 +486,7 @@ static NSString *RCTNormalizeAnimatedEventName(NSString *eventName)
NSArray<RCTEventAnimation *> *eventAnimations = _eventDrivers[key];
for (RCTEventAnimation *animation in eventAnimations) {
NSNumber *nodeTag = [animation.valueNode nodeTag];
if (nodeTag) {
if (nodeTag != nullptr) {
[tags addObject:nodeTag];
}
for (NSNumber *childNodeKey in [animation.valueNode childNodes]) {
@@ -25,7 +25,7 @@ RCT_EXPORT_MODULE()
- (void)invalidate
{
std::lock_guard<std::mutex> lock(_operationHandlerMutexLock);
if (_queue) {
if (_queue != nullptr) {
for (NSOperation *operation in _queue.operations) {
if (!operation.isCancelled && !operation.isFinished) {
[operation cancel];
@@ -44,7 +44,7 @@ RCT_EXPORT_MODULE()
{
std::lock_guard<std::mutex> lock(_operationHandlerMutexLock);
// Lazy setup
if (!_queue) {
if (_queue == nullptr) {
_queue = [NSOperationQueue new];
_queue.maxConcurrentOperationCount = 2;
}
@@ -59,7 +59,7 @@ RCT_EXPORT_MODULE()
// Get mime type
NSRange firstSemicolon = [request.URL.resourceSpecifier rangeOfString:@";"];
NSString *mimeType =
firstSemicolon.length ? [request.URL.resourceSpecifier substringToIndex:firstSemicolon.location] : nil;
(firstSemicolon.length != 0u) ? [request.URL.resourceSpecifier substringToIndex:firstSemicolon.location] : nil;
// Send response
NSURLResponse *response = [[NSURLResponse alloc] initWithURL:request.URL
@@ -72,7 +72,7 @@ RCT_EXPORT_MODULE()
// Load data
NSError *error;
NSData *data = [NSData dataWithContentsOfURL:request.URL options:NSDataReadingMappedIfSafe error:&error];
if (data) {
if (data != nullptr) {
[delegate URLRequest:strongOp didReceiveData:data];
}
[delegate URLRequest:strongOp didCompleteWithError:error];
@@ -46,7 +46,7 @@ RCT_EXPORT_MODULE()
- (BOOL)isValid
{
// if session == nil and delegates != nil, we've been invalidated
return _session || !_delegates;
return (_session != nullptr) || (_delegates == nullptr);
}
#pragma mark - NSURLRequestHandler
@@ -67,7 +67,7 @@ RCT_EXPORT_MODULE()
{
std::lock_guard<std::mutex> lock(_mutex);
// Lazy setup
if (!_session && [self isValid]) {
if ((_session == nullptr) && [self isValid]) {
// You can override default NSURLSession instance property allowsCellularAccess (default value YES)
// by providing the following key to your RN project (edit ios/project/Info.plist file in Xcode):
// <key>ReactNetworkForceWifiOnly</key> <true/>
@@ -80,12 +80,12 @@ RCT_EXPORT_MODULE()
callbackQueue.maxConcurrentOperationCount = 1;
callbackQueue.underlyingQueue = [[_moduleRegistry moduleForName:"Networking"] methodQueue];
NSURLSessionConfiguration *configuration;
if (urlSessionConfigurationProvider) {
if (urlSessionConfigurationProvider != nullptr) {
configuration = urlSessionConfigurationProvider();
} else {
configuration = [NSURLSessionConfiguration defaultSessionConfiguration];
// Set allowsCellularAccess to NO ONLY if key ReactNetworkForceWifiOnly exists AND its value is YES
if (useWifiOnly) {
if (useWifiOnly != nullptr) {
configuration.allowsCellularAccess = ![useWifiOnly boolValue];
}
[configuration setHTTPShouldSetCookies:YES];
@@ -39,7 +39,7 @@ RCT_EXPORT_MODULE()
- (instancetype)initWithUserDefaults:(NSUserDefaults *)defaults
{
if ((self = [super init])) {
if ((self = [super init]) != nullptr) {
_defaults = defaults;
[[NSNotificationCenter defaultCenter] addObserver:self
@@ -84,7 +84,7 @@ RCT_EXPORT_METHOD(setValues : (NSDictionary *)values)
_ignoringUpdates = YES;
[values enumerateKeysAndObjectsUsingBlock:^(NSString *key, id json, BOOL *stop) {
id plist = [RCTConvert NSPropertyList:json];
if (plist) {
if (plist != nullptr) {
[self->_defaults setObject:plist forKey:key];
} else {
[self->_defaults removeObjectForKey:key];