From ccc525c5ca8c895a31d760c79e07ee91112468a0 Mon Sep 17 00:00:00 2001 From: Lukas Piatkowski Date: Thu, 23 Feb 2017 09:54:37 -0800 Subject: [PATCH] Refactor iOS packager webSocket handling to resemble Android's packagerconnection Reviewed By: javache Differential Revision: D4572607 fbshipit-source-id: b588d6216f7b84aef5a63454d2d8978783412c7b --- .../WebSocket/RCTReconnectingWebSocket.h | 31 ++++++ .../WebSocket/RCTReconnectingWebSocket.m | 83 ++++++++++++++ .../RCTWebSocket.xcodeproj/project.pbxproj | 8 ++ Libraries/WebSocket/RCTWebSocketObserver.m | 44 ++------ React/DevSupport/RCTPackagerClient.h | 31 ++++++ React/DevSupport/RCTPackagerClient.m | 103 ++++++++++++++++++ React/DevSupport/RCTPackagerClientResponder.h | 26 +++++ React/DevSupport/RCTPackagerClientResponder.m | 67 ++++++++++++ React/DevSupport/RCTReloadPackagerMethod.h | 21 ++++ React/DevSupport/RCTReloadPackagerMethod.m | 43 ++++++++ React/Modules/RCTDevMenu.mm | 60 +++------- React/React.xcodeproj/project.pbxproj | 68 ++++++++++++ 12 files changed, 507 insertions(+), 78 deletions(-) create mode 100644 Libraries/WebSocket/RCTReconnectingWebSocket.h create mode 100644 Libraries/WebSocket/RCTReconnectingWebSocket.m create mode 100644 React/DevSupport/RCTPackagerClient.h create mode 100644 React/DevSupport/RCTPackagerClient.m create mode 100644 React/DevSupport/RCTPackagerClientResponder.h create mode 100644 React/DevSupport/RCTPackagerClientResponder.m create mode 100644 React/DevSupport/RCTReloadPackagerMethod.h create mode 100644 React/DevSupport/RCTReloadPackagerMethod.m diff --git a/Libraries/WebSocket/RCTReconnectingWebSocket.h b/Libraries/WebSocket/RCTReconnectingWebSocket.h new file mode 100644 index 000000000..69d4143c2 --- /dev/null +++ b/Libraries/WebSocket/RCTReconnectingWebSocket.h @@ -0,0 +1,31 @@ +/** + * Copyright (c) 2015-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +#import + +#if RCT_DEV // Only supported in dev mode + +@class RCTSRWebSocket; + +@protocol RCTWebSocketProtocolDelegate + +- (void)webSocket:(RCTSRWebSocket *)webSocket didReceiveMessage:(id)message; + +@end + +@interface RCTReconnectingWebSocket : NSObject + +- (instancetype)initWithURL:(NSURL *)url; +@property (nonatomic, weak) id delegate; +- (void)start; +- (void)stop; + +@end + +#endif diff --git a/Libraries/WebSocket/RCTReconnectingWebSocket.m b/Libraries/WebSocket/RCTReconnectingWebSocket.m new file mode 100644 index 000000000..a2f20c64f --- /dev/null +++ b/Libraries/WebSocket/RCTReconnectingWebSocket.m @@ -0,0 +1,83 @@ +/** + * Copyright (c) 2015-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +#import "RCTReconnectingWebSocket.h" + +#import +#import + +#import "RCTSRWebSocket.h" + +#if RCT_DEV // Only supported in dev mode + +@interface RCTReconnectingWebSocket () +@end + +@implementation RCTReconnectingWebSocket { + NSURL *_url; + RCTSRWebSocket *_socket; +} + +@synthesize delegate = _delegate; + +- (instancetype)initWithURL:(NSURL *)url +{ + if (self = [super init]) { + _url = url; + } + return self; +} + +- (void)start +{ + [self stop]; + _socket = [[RCTSRWebSocket alloc] initWithURL:_url]; + _socket.delegate = self; + + [_socket open]; +} + +- (void)stop +{ + _socket.delegate = nil; + [_socket closeWithCode:1000 reason:@"Invalidated"]; + _socket = nil; +} + +- (void)webSocket:(RCTSRWebSocket *)webSocket didReceiveMessage:(id)message +{ + if (_delegate) { + [_delegate webSocket:webSocket didReceiveMessage:message]; + } +} + +- (void)reconnect +{ + __weak RCTSRWebSocket *socket = _socket; + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + // Only reconnect if the observer wasn't stoppped while we were waiting + if (socket) { + [self start]; + } + }); +} + +- (void)webSocket:(RCTSRWebSocket *)webSocket didFailWithError:(NSError *)error +{ + [self reconnect]; +} + +- (void)webSocket:(RCTSRWebSocket *)webSocket didCloseWithCode:(NSInteger)code reason:(NSString *)reason wasClean:(BOOL)wasClean +{ + [self reconnect]; +} + +@end + +#endif diff --git a/Libraries/WebSocket/RCTWebSocket.xcodeproj/project.pbxproj b/Libraries/WebSocket/RCTWebSocket.xcodeproj/project.pbxproj index 3a800cd5f..dd43b03eb 100644 --- a/Libraries/WebSocket/RCTWebSocket.xcodeproj/project.pbxproj +++ b/Libraries/WebSocket/RCTWebSocket.xcodeproj/project.pbxproj @@ -15,6 +15,8 @@ 2D3B5F401D9B165B00451313 /* RCTWebSocketModule.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C86DF7B1ADF695F0047B81A /* RCTWebSocketModule.m */; }; 3C86DF7C1ADF695F0047B81A /* RCTWebSocketModule.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C86DF7B1ADF695F0047B81A /* RCTWebSocketModule.m */; }; 3DB9106F1C74B1ED00838BBE /* RCTWebSocketObserver.m in Sources */ = {isa = PBXBuildFile; fileRef = 3DB9106E1C74B1ED00838BBE /* RCTWebSocketObserver.m */; }; + A12E9E2E1E5DEC4E0029001B /* RCTReconnectingWebSocket.m in Sources */ = {isa = PBXBuildFile; fileRef = A12E9E2D1E5DEC4E0029001B /* RCTReconnectingWebSocket.m */; }; + A12E9E2F1E5DEC550029001B /* RCTReconnectingWebSocket.m in Sources */ = {isa = PBXBuildFile; fileRef = A12E9E2D1E5DEC4E0029001B /* RCTReconnectingWebSocket.m */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -28,12 +30,16 @@ 3C86DF7B1ADF695F0047B81A /* RCTWebSocketModule.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.c.objc; path = RCTWebSocketModule.m; sourceTree = ""; tabWidth = 2; }; 3DB9106D1C74B1ED00838BBE /* RCTWebSocketObserver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTWebSocketObserver.h; sourceTree = ""; }; 3DB9106E1C74B1ED00838BBE /* RCTWebSocketObserver.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTWebSocketObserver.m; sourceTree = ""; }; + A12E9E2C1E5DEC4E0029001B /* RCTReconnectingWebSocket.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTReconnectingWebSocket.h; sourceTree = ""; }; + A12E9E2D1E5DEC4E0029001B /* RCTReconnectingWebSocket.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTReconnectingWebSocket.m; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXGroup section */ 3C86DF3D1ADF2C930047B81A = { isa = PBXGroup; children = ( + A12E9E2C1E5DEC4E0029001B /* RCTReconnectingWebSocket.h */, + A12E9E2D1E5DEC4E0029001B /* RCTReconnectingWebSocket.m */, 1338BBDC1B04ACC80064A9C9 /* RCTSRWebSocket.h */, 1338BBDD1B04ACC80064A9C9 /* RCTSRWebSocket.m */, 1338BBDE1B04ACC80064A9C9 /* RCTWebSocketExecutor.h */, @@ -133,6 +139,7 @@ files = ( 2D3B5F3E1D9B165B00451313 /* RCTWebSocketExecutor.m in Sources */, 2D3B5F401D9B165B00451313 /* RCTWebSocketModule.m in Sources */, + A12E9E2F1E5DEC550029001B /* RCTReconnectingWebSocket.m in Sources */, 2D3B5F3D1D9B165B00451313 /* RCTSRWebSocket.m in Sources */, 2D3B5F3F1D9B165B00451313 /* RCTWebSocketObserver.m in Sources */, ); @@ -144,6 +151,7 @@ files = ( 1338BBE01B04ACC80064A9C9 /* RCTSRWebSocket.m in Sources */, 3C86DF7C1ADF695F0047B81A /* RCTWebSocketModule.m in Sources */, + A12E9E2E1E5DEC4E0029001B /* RCTReconnectingWebSocket.m in Sources */, 1338BBE11B04ACC80064A9C9 /* RCTWebSocketExecutor.m in Sources */, 3DB9106F1C74B1ED00838BBE /* RCTWebSocketObserver.m in Sources */, ); diff --git a/Libraries/WebSocket/RCTWebSocketObserver.m b/Libraries/WebSocket/RCTWebSocketObserver.m index 42605fc91..04bc7e70c 100644 --- a/Libraries/WebSocket/RCTWebSocketObserver.m +++ b/Libraries/WebSocket/RCTWebSocketObserver.m @@ -14,42 +14,37 @@ #import #import -#import "RCTSRWebSocket.h" +#import "RCTReconnectingWebSocket.h" #if RCT_DEV // Only supported in dev mode -@interface RCTWebSocketObserver () +@interface RCTWebSocketObserver () @end @implementation RCTWebSocketObserver { - NSURL *_url; - RCTSRWebSocket *_socket; + RCTReconnectingWebSocket *_socket; } @synthesize delegate = _delegate; - (instancetype)initWithURL:(NSURL *)url { - if ((self = [self init])) { - _url = url; -} + if (self = [super init]) { + _socket = [[RCTReconnectingWebSocket alloc] initWithURL:url]; + _socket.delegate = self; + } return self; } - (void)start { - [self stop]; - _socket = [[RCTSRWebSocket alloc] initWithURL:_url]; _socket.delegate = self; - - [_socket open]; + [_socket start]; } - (void)stop { - _socket.delegate = nil; - [_socket closeWithCode:1000 reason:@"Invalidated"]; - _socket = nil; + [_socket stop]; } - (void)webSocket:(RCTSRWebSocket *)webSocket didReceiveMessage:(id)message @@ -66,27 +61,6 @@ } } -- (void)reconnect -{ - __weak RCTSRWebSocket *socket = _socket; - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ - // Only reconnect if the observer wasn't stoppped while we were waiting - if (socket) { - [self start]; - } - }); -} - -- (void)webSocket:(RCTSRWebSocket *)webSocket didFailWithError:(NSError *)error -{ - [self reconnect]; -} - -- (void)webSocket:(RCTSRWebSocket *)webSocket didCloseWithCode:(NSInteger)code reason:(NSString *)reason wasClean:(BOOL)wasClean -{ - [self reconnect]; -} - @end #endif diff --git a/React/DevSupport/RCTPackagerClient.h b/React/DevSupport/RCTPackagerClient.h new file mode 100644 index 000000000..6795fb3be --- /dev/null +++ b/React/DevSupport/RCTPackagerClient.h @@ -0,0 +1,31 @@ +/** + * Copyright (c) 2015-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +#import +#import + +#if RCT_DEV // Only supported in dev mode + +@protocol RCTPackagerClientMethod + +- (void)handleRequest:(id)params withResponder:(RCTPackagerClientResponder *)responder; +- (void)handleNotification:(id)params; + +@end + +@interface RCTPackagerClient : NSObject + +- (instancetype)initWithURL:(NSURL *)url; +- (void)addHandler:(id)handler forMethod:(NSString *)name; +- (void)start; +- (void)stop; + +@end + +#endif diff --git a/React/DevSupport/RCTPackagerClient.m b/React/DevSupport/RCTPackagerClient.m new file mode 100644 index 000000000..6117ce6e2 --- /dev/null +++ b/React/DevSupport/RCTPackagerClient.m @@ -0,0 +1,103 @@ +/** + * Copyright (c) 2015-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +#import "RCTPackagerClient.h" + +#import +#import +#import +#import +#import +#import + +#import "RCTPackagerClientResponder.h" + +#if RCT_DEV // Only supported in dev mode + +@interface RCTPackagerClient () +@end + +@implementation RCTPackagerClient { + RCTReconnectingWebSocket *_socket; + NSMutableDictionary> *_handlers; +} + +- (instancetype)initWithURL:(NSURL *)url +{ + if (self = [super init]) { + _socket = [[RCTReconnectingWebSocket alloc] initWithURL:url]; + _socket.delegate = self; + _handlers = [NSMutableDictionary new]; + } + return self; +} + +- (void)addHandler:(id)handler forMethod:(NSString *)name +{ + _handlers[name] = handler; +} + +- (void)start +{ + _socket.delegate = self; + [_socket start]; +} + +- (void)stop +{ + [_socket stop]; +} + +- (BOOL)isSupportedVersion:(NSNumber *)version +{ + NSArray *const kSupportedVersions = @[ @(RCT_PACKAGER_CLIENT_PROTOCOL_VERSION) ]; + return [kSupportedVersions containsObject:version]; +} + +- (void)webSocket:(RCTSRWebSocket *)webSocket didReceiveMessage:(id)message +{ + if (!_handlers) { + return; + } + + NSError *error = nil; + NSDictionary *msg = RCTJSONParse(message, &error); + + if (error) { + RCTLogError(@"%@ failed to parse message with error %@\n\n%@\n", [self class], error, msg); + return; + } + + if (![self isSupportedVersion:msg[@"version"]]) { + RCTLogError(@"%@ received message with not supported version %@", [self class], msg[@"version"]); + return; + } + + id methodHandler = _handlers[msg[@"method"]]; + if (!methodHandler) { + if (msg[@"id"]) { + NSString *errorMsg = [NSString stringWithFormat:@"%@ no handler found for method %@", [self class], msg[@"method"]]; + RCTLogError(errorMsg, msg[@"method"]); + [[[RCTPackagerClientResponder alloc] initWithId:msg[@"id"] + socket:webSocket] respondWithError:errorMsg]; + } + return; // If it was a broadcast then we ignore it gracefully + } + + if (msg[@"id"]) { + [methodHandler handleRequest:msg[@"params"] + withResponder:[[RCTPackagerClientResponder alloc] initWithId:msg[@"id"] + socket:webSocket]]; + } else { + [methodHandler handleNotification:msg[@"params"]]; + } +} +@end + +#endif diff --git a/React/DevSupport/RCTPackagerClientResponder.h b/React/DevSupport/RCTPackagerClientResponder.h new file mode 100644 index 000000000..0d15ac1cf --- /dev/null +++ b/React/DevSupport/RCTPackagerClientResponder.h @@ -0,0 +1,26 @@ +/** + * Copyright (c) 2015-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +#import + +#if RCT_DEV // Only supported in dev mode + +extern const int RCT_PACKAGER_CLIENT_PROTOCOL_VERSION; + +@class RCTSRWebSocket; + +@interface RCTPackagerClientResponder : NSObject + +- (instancetype)initWithId:(id)msgId socket:(RCTSRWebSocket *)socket; +- (void)respondWithResult:(id)result; +- (void)respondWithError:(id)error; + +@end + +#endif diff --git a/React/DevSupport/RCTPackagerClientResponder.m b/React/DevSupport/RCTPackagerClientResponder.m new file mode 100644 index 000000000..896b009e5 --- /dev/null +++ b/React/DevSupport/RCTPackagerClientResponder.m @@ -0,0 +1,67 @@ +/** + * Copyright (c) 2015-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +#import "RCTPackagerClientResponder.h" + +#import +#import +#import + +#if RCT_DEV // Only supported in dev mode + +const int RCT_PACKAGER_CLIENT_PROTOCOL_VERSION = 2; + +@implementation RCTPackagerClientResponder { + id _msgId; + __weak RCTSRWebSocket *_socket; +} + +- (instancetype)initWithId:(id)msgId socket:(RCTSRWebSocket *)socket +{ + if (self = [super init]) { + _msgId = msgId; + _socket = socket; + } + return self; +} + +- (void)respondWithResult:(id)result +{ + NSDictionary *msg = @{ + @"version": @(RCT_PACKAGER_CLIENT_PROTOCOL_VERSION), + @"id": _msgId, + @"result": result, + }; + NSError *jsError = nil; + NSString *message = RCTJSONStringify(msg, &jsError); + if (jsError) { + RCTLogError(@"%@ failed to stringify message with error %@", [self class], jsError); + } else { + [_socket send:message]; + } +} + +- (void)respondWithError:(id)error +{ + NSDictionary *msg = @{ + @"version": @(RCT_PACKAGER_CLIENT_PROTOCOL_VERSION), + @"id": _msgId, + @"error": error, + }; + NSError *jsError = nil; + NSString *message = RCTJSONStringify(msg, &jsError); + if (jsError) { + RCTLogError(@"%@ failed to stringify message with error %@", [self class], jsError); + } else { + [_socket send:message]; + } +} +@end + +#endif diff --git a/React/DevSupport/RCTReloadPackagerMethod.h b/React/DevSupport/RCTReloadPackagerMethod.h new file mode 100644 index 000000000..a357f808a --- /dev/null +++ b/React/DevSupport/RCTReloadPackagerMethod.h @@ -0,0 +1,21 @@ +/** + * Copyright (c) 2015-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +#import +#import + +#if RCT_DEV // Only supported in dev mode + +@interface RCTReloadPackagerMethod : NSObject + +- (instancetype)initWithBridge:(RCTBridge *)bridge; + +@end + +#endif diff --git a/React/DevSupport/RCTReloadPackagerMethod.m b/React/DevSupport/RCTReloadPackagerMethod.m new file mode 100644 index 000000000..6ac1f947a --- /dev/null +++ b/React/DevSupport/RCTReloadPackagerMethod.m @@ -0,0 +1,43 @@ +/** + * Copyright (c) 2015-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +#import "RCTReloadPackagerMethod.h" + +#import + +#if RCT_DEV // Only supported in dev mode + +@implementation RCTReloadPackagerMethod { + __weak RCTBridge *_bridge; +} + +- (instancetype)initWithBridge:(RCTBridge *)bridge +{ + if (self = [super init]) { + _bridge = bridge; + } + return self; +} + +- (void)handleRequest:(id)params withResponder:(RCTPackagerClientResponder *)responder +{ + [responder respondWithError:[NSString stringWithFormat: @"%@ does not support onRequest", [self class]]]; +} + +- (void)handleNotification:(id)params +{ + if (![params isEqual:[NSNull null]] && [params[@"debug"] boolValue]) { + _bridge.executorClass = objc_lookUpClass("RCTWebSocketExecutor"); + } + [_bridge reload]; +} + +@end + +#endif diff --git a/React/Modules/RCTDevMenu.mm b/React/Modules/RCTDevMenu.mm index bb73f2a47..cf0cb559f 100644 --- a/React/Modules/RCTDevMenu.mm +++ b/React/Modules/RCTDevMenu.mm @@ -22,10 +22,11 @@ #import "RCTEventDispatcher.h" #import "RCTKeyCommands.h" #import "RCTLog.h" +#import "RCTPackagerClient.h" #import "RCTProfile.h" +#import "RCTReloadPackagerMethod.h" #import "RCTRootView.h" #import "RCTUtils.h" -#import "RCTWebSocketObserverProtocol.h" #if RCT_DEV @@ -136,7 +137,7 @@ RCT_NOT_IMPLEMENTED(- (instancetype)init) typedef void(^RCTDevMenuAlertActionHandler)(UIAlertAction *action); -@interface RCTDevMenu () +@interface RCTDevMenu () @property (nonatomic, strong) Class executorClass; @@ -282,53 +283,26 @@ RCT_EXPORT_MODULE() return; } - Class webSocketObserverClass = objc_lookUpClass("RCTWebSocketObserver"); - if (webSocketObserverClass == Nil) { - return; - } - - // If multiple RCTDevMenus are created, the most recently connected one steals the RCTWebSocketObserver. - // (Why this behavior exists is beyond me, as of this writing.) - static NSMutableDictionary> *observers = nil; - if (observers == nil) { - observers = [NSMutableDictionary new]; + // The jsPackagerClient is a static map that holds different packager clients per the packagerURL + // In case many instances of DevMenu are created, the latest instance that use the same URL as + // previous instances will override given packager client's method handlers + static NSMutableDictionary *jsPackagerClients = nil; + if (jsPackagerClients == nil) { + jsPackagerClients = [NSMutableDictionary new]; } NSString *key = [url absoluteString]; - id existingObserver = observers[key]; - if (existingObserver) { - existingObserver.delegate = self; + RCTPackagerClient *packagerClient = jsPackagerClients[key]; + if (!packagerClient) { + packagerClient = [[RCTPackagerClient alloc] initWithURL:url]; + jsPackagerClients[key] = packagerClient; } else { - id newObserver = [(id)[webSocketObserverClass alloc] initWithURL:url]; - newObserver.delegate = self; - [newObserver start]; - observers[key] = newObserver; + [packagerClient stop]; } -} - - -- (BOOL)isSupportedVersion:(NSNumber *)version -{ - NSArray *const kSupportedVersions = @[ @2 ]; - return [kSupportedVersions containsObject:version]; -} - -- (void)didReceiveWebSocketMessage:(NSDictionary *)message -{ - if ([self isSupportedVersion:message[@"version"]]) { - [self processMethod:message[@"method"] params:message[@"params"]]; - } -} - -- (void)processMethod:(NSString *)method params:(NSDictionary *)params -{ - if ([method isEqualToString:@"reload"]) { - if (![params isEqual:[NSNull null]] && [params[@"debug"] boolValue]) { - _bridge.executorClass = objc_lookUpClass("RCTWebSocketExecutor"); - } - [_bridge reload]; - } + [packagerClient addHandler:[[RCTReloadPackagerMethod alloc] initWithBridge:_bridge] + forMethod:@"reload"]; + [packagerClient start]; } - (dispatch_queue_t)methodQueue diff --git a/React/React.xcodeproj/project.pbxproj b/React/React.xcodeproj/project.pbxproj index a92fd10fd..90384aac8 100644 --- a/React/React.xcodeproj/project.pbxproj +++ b/React/React.xcodeproj/project.pbxproj @@ -731,6 +731,24 @@ 83CBBACC1A6023D300E9B192 /* RCTConvert.m in Sources */ = {isa = PBXBuildFile; fileRef = 83CBBACB1A6023D300E9B192 /* RCTConvert.m */; }; 945929C41DD62ADD00653A7D /* RCTConvert+Transform.m in Sources */ = {isa = PBXBuildFile; fileRef = 945929C31DD62ADD00653A7D /* RCTConvert+Transform.m */; }; 945929C51DD62ADD00653A7D /* RCTConvert+Transform.m in Sources */ = {isa = PBXBuildFile; fileRef = 945929C31DD62ADD00653A7D /* RCTConvert+Transform.m */; }; + A12E9E1B1E5DEA350029001B /* RCTPackagerClient.h in Headers */ = {isa = PBXBuildFile; fileRef = A12E9E171E5DEA350029001B /* RCTPackagerClient.h */; }; + A12E9E1C1E5DEA350029001B /* RCTPackagerClient.m in Sources */ = {isa = PBXBuildFile; fileRef = A12E9E181E5DEA350029001B /* RCTPackagerClient.m */; }; + A12E9E1D1E5DEA350029001B /* RCTPackagerClientResponder.h in Headers */ = {isa = PBXBuildFile; fileRef = A12E9E191E5DEA350029001B /* RCTPackagerClientResponder.h */; }; + A12E9E1E1E5DEA350029001B /* RCTPackagerClientResponder.m in Sources */ = {isa = PBXBuildFile; fileRef = A12E9E1A1E5DEA350029001B /* RCTPackagerClientResponder.m */; }; + A12E9E1F1E5DEAEF0029001B /* RCTPackagerClient.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = A12E9E171E5DEA350029001B /* RCTPackagerClient.h */; }; + A12E9E201E5DEAEF0029001B /* RCTPackagerClientResponder.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = A12E9E191E5DEA350029001B /* RCTPackagerClientResponder.h */; }; + A12E9E211E5DEAFB0029001B /* RCTPackagerClient.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = A12E9E171E5DEA350029001B /* RCTPackagerClient.h */; }; + A12E9E221E5DEAFB0029001B /* RCTPackagerClientResponder.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = A12E9E191E5DEA350029001B /* RCTPackagerClientResponder.h */; }; + A12E9E231E5DEB160029001B /* RCTPackagerClient.h in Headers */ = {isa = PBXBuildFile; fileRef = A12E9E171E5DEA350029001B /* RCTPackagerClient.h */; }; + A12E9E241E5DEB160029001B /* RCTPackagerClientResponder.h in Headers */ = {isa = PBXBuildFile; fileRef = A12E9E191E5DEA350029001B /* RCTPackagerClientResponder.h */; }; + A12E9E251E5DEB4D0029001B /* RCTPackagerClient.m in Sources */ = {isa = PBXBuildFile; fileRef = A12E9E181E5DEA350029001B /* RCTPackagerClient.m */; }; + A12E9E261E5DEB510029001B /* RCTPackagerClientResponder.m in Sources */ = {isa = PBXBuildFile; fileRef = A12E9E1A1E5DEA350029001B /* RCTPackagerClientResponder.m */; }; + A12E9E2A1E5DEB860029001B /* RCTReconnectingWebSocket.h in Headers */ = {isa = PBXBuildFile; fileRef = A12E9E281E5DEB860029001B /* RCTReconnectingWebSocket.h */; }; + A12E9E2B1E5DEB860029001B /* RCTSRWebSocket.h in Headers */ = {isa = PBXBuildFile; fileRef = A12E9E291E5DEB860029001B /* RCTSRWebSocket.h */; }; + A12E9E5A1E5DF8600029001B /* RCTReloadPackagerMethod.h in Headers */ = {isa = PBXBuildFile; fileRef = A12E9E581E5DF8600029001B /* RCTReloadPackagerMethod.h */; }; + A12E9E5B1E5DF8600029001B /* RCTReloadPackagerMethod.m in Sources */ = {isa = PBXBuildFile; fileRef = A12E9E591E5DF8600029001B /* RCTReloadPackagerMethod.m */; }; + A12E9E5C1E5DF86F0029001B /* RCTReloadPackagerMethod.h in Headers */ = {isa = PBXBuildFile; fileRef = A12E9E581E5DF8600029001B /* RCTReloadPackagerMethod.h */; }; + A12E9E5D1E5DF8720029001B /* RCTReloadPackagerMethod.m in Sources */ = {isa = PBXBuildFile; fileRef = A12E9E591E5DF8600029001B /* RCTReloadPackagerMethod.m */; }; A2440AA21DF8D854006E7BFC /* RCTReloadCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = A2440AA01DF8D854006E7BFC /* RCTReloadCommand.h */; }; A2440AA31DF8D854006E7BFC /* RCTReloadCommand.m in Sources */ = {isa = PBXBuildFile; fileRef = A2440AA11DF8D854006E7BFC /* RCTReloadCommand.m */; }; A2440AA41DF8D865006E7BFC /* RCTReloadCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = A2440AA01DF8D854006E7BFC /* RCTReloadCommand.h */; }; @@ -799,6 +817,8 @@ dstPath = include/React; dstSubfolderSpec = 16; files = ( + A12E9E211E5DEAFB0029001B /* RCTPackagerClient.h in Copy Headers */, + A12E9E221E5DEAFB0029001B /* RCTPackagerClientResponder.h in Copy Headers */, 3D5AC71D1E00572F000F9153 /* RCTTVView.h in Copy Headers */, 3D5AC71B1E005723000F9153 /* RCTReloadCommand.h in Copy Headers */, 3D5AC71C1E005723000F9153 /* RCTTVNavigationEventEmitter.h in Copy Headers */, @@ -964,6 +984,8 @@ dstPath = include/React; dstSubfolderSpec = 16; files = ( + A12E9E1F1E5DEAEF0029001B /* RCTPackagerClient.h in Copy Headers */, + A12E9E201E5DEAEF0029001B /* RCTPackagerClientResponder.h in Copy Headers */, 3D80D91F1DF6FA890028D040 /* RCTImageLoader.h in Copy Headers */, 3D80D9201DF6FA890028D040 /* RCTImageStoreManager.h in Copy Headers */, 3D80D9211DF6FA890028D040 /* RCTResizeMode.h in Copy Headers */, @@ -1373,6 +1395,14 @@ 83F15A171B7CC46900F10295 /* UIView+Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "UIView+Private.h"; sourceTree = ""; }; 945929C21DD62ADD00653A7D /* RCTConvert+Transform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "RCTConvert+Transform.h"; sourceTree = ""; }; 945929C31DD62ADD00653A7D /* RCTConvert+Transform.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "RCTConvert+Transform.m"; sourceTree = ""; }; + A12E9E171E5DEA350029001B /* RCTPackagerClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RCTPackagerClient.h; path = DevSupport/RCTPackagerClient.h; sourceTree = ""; }; + A12E9E181E5DEA350029001B /* RCTPackagerClient.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RCTPackagerClient.m; path = DevSupport/RCTPackagerClient.m; sourceTree = ""; }; + A12E9E191E5DEA350029001B /* RCTPackagerClientResponder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RCTPackagerClientResponder.h; path = DevSupport/RCTPackagerClientResponder.h; sourceTree = ""; }; + A12E9E1A1E5DEA350029001B /* RCTPackagerClientResponder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RCTPackagerClientResponder.m; path = DevSupport/RCTPackagerClientResponder.m; sourceTree = ""; }; + A12E9E281E5DEB860029001B /* RCTReconnectingWebSocket.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RCTReconnectingWebSocket.h; path = WebSocket/RCTReconnectingWebSocket.h; sourceTree = ""; }; + A12E9E291E5DEB860029001B /* RCTSRWebSocket.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RCTSRWebSocket.h; path = WebSocket/RCTSRWebSocket.h; sourceTree = ""; }; + A12E9E581E5DF8600029001B /* RCTReloadPackagerMethod.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RCTReloadPackagerMethod.h; path = DevSupport/RCTReloadPackagerMethod.h; sourceTree = ""; }; + A12E9E591E5DF8600029001B /* RCTReloadPackagerMethod.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RCTReloadPackagerMethod.m; path = DevSupport/RCTReloadPackagerMethod.m; sourceTree = ""; }; A2440AA01DF8D854006E7BFC /* RCTReloadCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTReloadCommand.h; sourceTree = ""; }; A2440AA11DF8D854006E7BFC /* RCTReloadCommand.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTReloadCommand.m; sourceTree = ""; }; AC70D2E81DE489E4002E6351 /* RCTJavaScriptLoader.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RCTJavaScriptLoader.mm; sourceTree = ""; }; @@ -1633,6 +1663,7 @@ 3D1FA0891DE4F4B900E03CC6 /* LinkingIOS */, 3D1FA0791DE4F2D200E03CC6 /* Network */, 3D1FA08A1DE4F4D600E03CC6 /* PushNotificationIOS */, + A12E9E271E5DEB600029001B /* WebSocket */, ); name = Libraries; path = ../Libraries; @@ -1714,6 +1745,7 @@ isa = PBXGroup; children = ( 83CBBA491A601E3B00E9B192 /* Base */, + A12E9E161E5DEA260029001B /* DevSupport */, 134FCB381A6E7F0800051CC8 /* Executors */, 13B07FE01A69315300A75B9A /* Modules */, 1450FF7F1BCFF28A00208362 /* Profiler */, @@ -1798,6 +1830,28 @@ path = Base; sourceTree = ""; }; + A12E9E161E5DEA260029001B /* DevSupport */ = { + isa = PBXGroup; + children = ( + A12E9E171E5DEA350029001B /* RCTPackagerClient.h */, + A12E9E181E5DEA350029001B /* RCTPackagerClient.m */, + A12E9E581E5DF8600029001B /* RCTReloadPackagerMethod.h */, + A12E9E591E5DF8600029001B /* RCTReloadPackagerMethod.m */, + A12E9E191E5DEA350029001B /* RCTPackagerClientResponder.h */, + A12E9E1A1E5DEA350029001B /* RCTPackagerClientResponder.m */, + ); + name = DevSupport; + sourceTree = ""; + }; + A12E9E271E5DEB600029001B /* WebSocket */ = { + isa = PBXGroup; + children = ( + A12E9E281E5DEB860029001B /* RCTReconnectingWebSocket.h */, + A12E9E291E5DEB860029001B /* RCTSRWebSocket.h */, + ); + name = WebSocket; + sourceTree = ""; + }; AC70D2EA1DE489FC002E6351 /* cxxreact */ = { isa = PBXGroup; children = ( @@ -1815,6 +1869,8 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( + A12E9E231E5DEB160029001B /* RCTPackagerClient.h in Headers */, + A12E9E241E5DEB160029001B /* RCTPackagerClientResponder.h in Headers */, 3D302F241DF828F800D6DDAE /* RCTImageLoader.h in Headers */, 3D302F251DF828F800D6DDAE /* RCTImageStoreManager.h in Headers */, 3D302F261DF828F800D6DDAE /* RCTResizeMode.h in Headers */, @@ -1870,6 +1926,7 @@ 3D302F561DF828F800D6DDAE /* RCTAlertManager.h in Headers */, 3D302F571DF828F800D6DDAE /* RCTAppState.h in Headers */, 3D302F581DF828F800D6DDAE /* RCTAsyncLocalStorage.h in Headers */, + A12E9E5C1E5DF86F0029001B /* RCTReloadPackagerMethod.h in Headers */, 3D302F591DF828F800D6DDAE /* RCTClipboard.h in Headers */, 3D302F5A1DF828F800D6DDAE /* RCTDevLoadingView.h in Headers */, 3D302F5B1DF828F800D6DDAE /* RCTDevMenu.h in Headers */, @@ -2017,8 +2074,10 @@ 3D80DA231DF820620028D040 /* RCTBridgeDelegate.h in Headers */, 3D80DA241DF820620028D040 /* RCTBridgeMethod.h in Headers */, 3D80DA251DF820620028D040 /* RCTBridgeModule.h in Headers */, + A12E9E1D1E5DEA350029001B /* RCTPackagerClientResponder.h in Headers */, 3D80DA261DF820620028D040 /* RCTBundleURLProvider.h in Headers */, 3D80DA271DF820620028D040 /* RCTConvert.h in Headers */, + A12E9E1B1E5DEA350029001B /* RCTPackagerClient.h in Headers */, 3D80DA281DF820620028D040 /* RCTDefines.h in Headers */, 3D80DA291DF820620028D040 /* RCTDisplayLink.h in Headers */, 3D80DA2A1DF820620028D040 /* RCTErrorCustomizer.h in Headers */, @@ -2029,6 +2088,8 @@ 3D80DA2E1DF820620028D040 /* RCTImageSource.h in Headers */, 3D80DA2F1DF820620028D040 /* RCTInvalidating.h in Headers */, 3D80DA301DF820620028D040 /* RCTJavaScriptExecutor.h in Headers */, + A12E9E5A1E5DF8600029001B /* RCTReloadPackagerMethod.h in Headers */, + A12E9E2A1E5DEB860029001B /* RCTReconnectingWebSocket.h in Headers */, 3D80DA311DF820620028D040 /* RCTJavaScriptLoader.h in Headers */, 3D80DA321DF820620028D040 /* RCTJSStackFrame.h in Headers */, 3D80DA331DF820620028D040 /* RCTKeyCommands.h in Headers */, @@ -2072,6 +2133,7 @@ 3D80DA5A1DF820620028D040 /* RCTUIManager.h in Headers */, 3D80DA5B1DF820620028D040 /* RCTFPSGraph.h in Headers */, 3D80DA5C1DF820620028D040 /* RCTJSCProfiler.h in Headers */, + A12E9E2B1E5DEB860029001B /* RCTSRWebSocket.h in Headers */, 3D80DA5D1DF820620028D040 /* RCTMacros.h in Headers */, 3D80DA5E1DF820620028D040 /* RCTProfile.h in Headers */, 3D80DA5F1DF820620028D040 /* RCTActivityIndicatorView.h in Headers */, @@ -2419,6 +2481,7 @@ 2D3B5E9B1D9B08A000451313 /* RCTFrameUpdate.m in Sources */, 2D3B5EE41D9B09BB00451313 /* RCTSegmentedControlManager.m in Sources */, 2D3B5EE31D9B09B700451313 /* RCTSegmentedControl.m in Sources */, + A12E9E251E5DEB4D0029001B /* RCTPackagerClient.m in Sources */, 2D3B5EB71D9B091800451313 /* RCTRedBox.m in Sources */, 2D3B5ED11D9B097500451313 /* RCTMapAnnotation.m in Sources */, 2D3B5EAF1D9B08FB00451313 /* RCTAccessibilityManager.m in Sources */, @@ -2443,6 +2506,7 @@ 2D3B5EB11D9B090100451313 /* RCTAppState.m in Sources */, 2D3B5EC21D9B093B00451313 /* RCTProfile.m in Sources */, 2D3B5ECB1D9B096200451313 /* RCTConvert+CoreLocation.m in Sources */, + A12E9E261E5DEB510029001B /* RCTPackagerClientResponder.m in Sources */, 2D3B5EEE1D9B09DA00451313 /* RCTView.m in Sources */, 594AD5D01E46D87500B07237 /* RCTScrollContentShadowView.m in Sources */, 2D3B5ECC1D9B096500451313 /* RCTConvert+MapKit.m in Sources */, @@ -2461,6 +2525,7 @@ 3DCD185D1DF978E7007FE5A1 /* RCTReloadCommand.m in Sources */, 2D3B5EC61D9B095000451313 /* RCTProfileTrampoline-x86_64.S in Sources */, 594AD5D41E46D87500B07237 /* RCTScrollContentViewManager.m in Sources */, + A12E9E5D1E5DF8720029001B /* RCTReloadPackagerMethod.m in Sources */, 3D5AC71A1E0056E0000F9153 /* RCTTVNavigationEventEmitter.m in Sources */, 3D7A27E31DE325DA002E3F95 /* RCTJSCErrorHandling.mm in Sources */, 2D3B5ED01D9B097200451313 /* RCTMap.m in Sources */, @@ -2568,6 +2633,7 @@ 13BCE8091C99CB9D00DD7AAD /* RCTRootShadowView.m in Sources */, 14C2CA711B3AC63800E6CBB2 /* RCTModuleMethod.m in Sources */, 006FC4141D9B20820057AAAD /* RCTMultipartDataTask.m in Sources */, + A12E9E1C1E5DEA350029001B /* RCTPackagerClient.m in Sources */, 13CC8A821B17642100940AE7 /* RCTBorderDrawing.m in Sources */, 83CBBA511A601E3B00E9B192 /* RCTAssert.m in Sources */, 13AF20451AE707F9005F5298 /* RCTSlider.m in Sources */, @@ -2615,6 +2681,7 @@ 13A6E20E1C19AA0C00845B82 /* RCTParserUtils.m in Sources */, 13E067571A70F44B002CDEE1 /* RCTView.m in Sources */, 3D7749441DC1065C007EC8D8 /* RCTPlatform.m in Sources */, + A12E9E1E1E5DEA350029001B /* RCTPackagerClientResponder.m in Sources */, 13AFBCA01C07247D00BBAEAA /* RCTMapOverlay.m in Sources */, 13D9FEEE1CDCD93000158BD7 /* RCTKeyboardObserver.m in Sources */, B233E6EA1D2D845D00BC68BA /* RCTI18nManager.m in Sources */, @@ -2644,6 +2711,7 @@ 14435CE51AAC4AE100FC20F4 /* RCTMap.m in Sources */, 13B0801C1A69489C00A75B9A /* RCTNavItem.m in Sources */, 83CBBA691A601EF300E9B192 /* RCTEventDispatcher.m in Sources */, + A12E9E5B1E5DF8600029001B /* RCTReloadPackagerMethod.m in Sources */, 83A1FE8F1B62643A00BE0E65 /* RCTModalHostViewManager.m in Sources */, 13E0674A1A70F434002CDEE1 /* RCTUIManager.m in Sources */, 391E86A41C623EC800009732 /* RCTTouchEvent.m in Sources */,