Skip to content

Commit

Permalink
Fix Warnings in Xcode (facebook#23184)
Browse files Browse the repository at this point in the history
Summary:
His PR is related to facebook#22609

Changelog:
----------

[IOS][Changed] - Fix warning in RCTImage
[IOS][Changed] - Fix warning in RCTNetwork
Pull Request resolved: facebook#23184

Differential Revision: D13838680

Pulled By: cpojer

fbshipit-source-id: 698303e44bb85a4819abff7d71e0b75936c09dc8
  • Loading branch information
rafaellincoln authored and facebook-github-bot committed Jan 28, 2019
1 parent 272b16f commit a1b1263
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions RCTNetInfo.m
Original file line number Diff line number Diff line change
Expand Up @@ -52,20 +52,25 @@ static void RCTReachabilityCallback(__unused SCNetworkReachabilityRef target, SC
{
RCTNetInfo *self = (__bridge id)info;
BOOL didSetReachabilityFlags = [self setReachabilityStatus:flags];

NSString *connectionType = self->_connectionType ?: RCTConnectionTypeUnknown;
NSString *effectiveConnectionType = self->_effectiveConnectionType ?: RCTEffectiveConnectionTypeUnknown;
NSString *networkInfo = self->_statusDeprecated ?: RCTReachabilityStateUnknown;

if (self->_firstTimeReachability && self->_resolve) {
SCNetworkReachabilityUnscheduleFromRunLoop(self->_firstTimeReachability, CFRunLoopGetMain(), kCFRunLoopCommonModes);
CFRelease(self->_firstTimeReachability);
self->_resolve(@{@"connectionType": self->_connectionType ?: RCTConnectionTypeUnknown,
@"effectiveConnectionType": self->_effectiveConnectionType ?: RCTEffectiveConnectionTypeUnknown,
@"network_info": self->_statusDeprecated ?: RCTReachabilityStateUnknown});
self->_resolve(@{@"connectionType": connectionType,
@"effectiveConnectionType": effectiveConnectionType,
@"network_info": networkInfo});
self->_firstTimeReachability = nil;
self->_resolve = nil;
}

if (didSetReachabilityFlags && self->_isObserving) {
[self sendEventWithName:@"networkStatusDidChange" body:@{@"connectionType": self->_connectionType,
@"effectiveConnectionType": self->_effectiveConnectionType,
@"network_info": self->_statusDeprecated}];
[self sendEventWithName:@"networkStatusDidChange" body:@{@"connectionType": connectionType,
@"effectiveConnectionType": effectiveConnectionType,
@"network_info": networkInfo}];
}
}

Expand Down

0 comments on commit a1b1263

Please sign in to comment.