Update RCTNetworking, RCTNetInfo and RCTLocationManager to use new events system

Summary: Updated networking and geolocation to use the new events system.

Reviewed By: bestander

Differential Revision: D3346129

fbshipit-source-id: 957716e54d7af8c4a6783f684098e92e92f19654
This commit is contained in:
Nick Lockwood
2016-05-25 04:17:35 -07:00
committed by Facebook Github Bot 1
parent 62f53ffaa7
commit b71db11554
27 changed files with 240 additions and 345 deletions

View File

@@ -113,8 +113,6 @@ static NSDictionary<NSString *, id> *RCTPositionError(RCTPositionErrorCode code,
RCT_EXPORT_MODULE()
@synthesize bridge = _bridge;
#pragma mark - Lifecycle
- (void)dealloc
@@ -128,8 +126,12 @@ RCT_EXPORT_MODULE()
return dispatch_get_main_queue();
}
#pragma mark - Private API
- (NSArray<NSString *> *)supportedEvents
{
return @[@"geolocationDidChange", @"geolocationError"];
}
#pragma mark - Private API
- (void)beginLocationUpdatesWithDesiredAccuracy:(CLLocationAccuracy)desiredAccuracy distanceFilter:(CLLocationDistance)distanceFilter
{
@@ -279,11 +281,7 @@ RCT_EXPORT_METHOD(getCurrentPosition:(RCTLocationOptions)options
// Send event
if (_observingLocation) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
[_bridge.eventDispatcher sendDeviceEventWithName:@"geolocationDidChange"
body:_lastLocationEvent];
#pragma clang diagnostic pop
[self sendEventWithName:@"geolocationDidChange" body:_lastLocationEvent];
}
// Fire all queued callbacks
@@ -324,11 +322,7 @@ RCT_EXPORT_METHOD(getCurrentPosition:(RCTLocationOptions)options
// Send event
if (_observingLocation) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
[_bridge.eventDispatcher sendDeviceEventWithName:@"geolocationError"
body:jsError];
#pragma clang diagnostic pop
[self sendEventWithName:@"geolocationError" body:jsError];
}
// Fire all queued error callbacks